wordpress-plugin

Can Wordpress posts be rendered dynamically?

时光毁灭记忆、已成空白 提交于 2019-12-04 07:07:11
I want to make a blog page which is generating content for particular user based on his/her Facebook likes, activity etc. For example I like Shakira and Coca Cola on Facebook. When entering the blog and connecting via Facebook, the blog gets that info and searches for Shakira's YouTube video through YouTube API and shows me the video in a WordPress post. After the blog searches for news connected with Coca Cola and shows news about it also in a post. There is no problem with FB connect, YouTube search or Google search. My problem is WordPress. As there can be a lot of users and a lot of

wordpress plugin: query post-ID in plugin?

柔情痞子 提交于 2019-12-04 06:24:22
问题 hey guys, maybe some of you have experience with programming wordpress plugins. I have a probably rather simpel question, but i couldn't find anything on the web. <?php /* Plugin Name: test */ function test($content) { echo $post_id; return $content; } add_filter('the_content', 'test'); ?> I have a simpel plugin that should echo out the unique ID of every post in it's content. So on my frontpage with 10 posts every post should have it's ID echoed out. Any idea how to achieve that? thank you!

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found

眉间皱痕 提交于 2019-12-04 03:50:01
问题 I am trying to resolve an issue I have been having with one of my wordpress plugins. This is line 666 function isUrl($url) { return preg_match("^http:\/\/[-0-9a-z\._]+.*$/i", trim( $url )); } What are your inputs on how I can resolve this warning? It's quite irritating. I can't figure it out and I've tried, researched everything! 回答1: / is missing. preg_match('/pattern/',$string); preg_match("/^http:\/\/[-0-9a-z\._]+.*$/i", trim( $url )); 回答2: As it has been said in other answers, you have to

How to load the Wordpress environment in a php script?

此生再无相见时 提交于 2019-12-04 03:05:46
How can I load the Wordpress environment in a script, so I can use Wordpress' functions? I need this because I need to call several functions from a script which is executed asynchronously. you need to load the wp-load.php file, which will then allow you to call wordpress functions. For example: require( '../wordpress/wp-load.php' ); with 'wordpress' being your install root. 来源: https://stackoverflow.com/questions/5235200/how-to-load-the-wordpress-environment-in-a-php-script

Comment pop up disappears and a “confirm” button appears instead when using facebook like button

不羁的心 提交于 2019-12-04 02:41:48
I'm trying to include a facebook like button in my wordpress blog with the correspondent opengraph tags to show an image, description, etc. While I was testing it (liking and unliking a lot to check results), after clicking the like button, the comment pop up blinked and then out of the blue a "confirm" link appeared. This is so annoying. I've later researched the issue (after banging my head for a big big while) just to find out it seems to be part of a fb policy applied to suspicious sites to prevent spam. Is there any way to fix this? What can I do? This is really a bad thing since this way

Is there any way to prevent Woocommerce from defaulting to one particular (local pickup) shipping method?

江枫思渺然 提交于 2019-12-04 02:36:58
问题 I want to prevent Woocommerce from defaulting to the local pickup option . I do need the local pickup as and option for customers, but not as a default. I have encountered what I think is a bug in woocommerce and there is a workaround documented; but the workaround will not work for me because ( apart from hacking the Woocommerce core ) I don't want to default to the most expensive method either, which is how the workaround operates, because I have premium methods. There is a setting for

Wordpress : Change title of sidebar widget dynamically

↘锁芯ラ 提交于 2019-12-03 18:11:16
问题 Is it possible to get the title of the widgets that I have enabled in my sidebar so I can insert that as a name for my class attribute? For example: 'before_title' => <h2 class="title of the widget">', If I inspect the element, I want to see: <h2 class="author"> and <h2 class="links"> etc... Thanks 回答1: It's definitely possible, but if you want to do it dynamically, you'd need to use a filter. The dynamic_sidebar_params filter should work for you. If you're unfamiliar with what filters do,

Contact Form 7 - add custom function on email send

荒凉一梦 提交于 2019-12-03 17:47:59
问题 Just playing around with Wordpress / Contact Form 7 . Is it possible to add custom javascript function on successful email send event? 回答1: Write this in additional settings at the bottom of the contact form configuration page: on_sent_ok: "some js code here" UPDATE: You can use it to call functions like this: on_sent_ok: "your_function();" Or write some code (this one redirects to thank you page): on_sent_ok: "document.location='/thank-you-page/';" 回答2: Contact Form 7 emits a number of

Wordpress API: Add / Remove Tags on Posts

房东的猫 提交于 2019-12-03 17:45:34
问题 I know it seems like a simple operation, but I can't find any resource or documentation that explains how to programmatically add and remove tags to a post using the post ID. Below is a sample of what I'm using, but it seems to overwrite all the other tags... function addTerm($id, $tax, $term) { $term_id = is_term($term); $term_id = intval($term_id); if (!$term_id) { $term_id = wp_insert_term($term, $tax); $term_id = $term_id['term_id']; $term_id = intval($term_id); } $result = wp_set_object

Woocommerce Admin Order Details - Show custom data on order details page

守給你的承諾、 提交于 2019-12-03 17:09:43
问题 I'm searching and trying it for 2 days with no success, please help. I want to filter woocommerce orders to add additional details from db to order details page based on product attribute but I can't find the right woocommerce action/filter hook for this task. Here suppose I've variable $is_customized = false ; If $is_customized == true then I need to add custom data from database to orders detail page. NOTE: I don't want to add additional meta box instead I want to change order detail table