wordpress-plugin

Wordpress - Fatal error: Call to a member function get_var() on a non-object $wpdb

蹲街弑〆低调 提交于 2019-12-09 03:39:04
问题 [Solution by s_ha_dum on http://wordpress.stackexchange.com] I'm trying to direct users to a certain post based on a password entered in post settings. I have almost working code: Form on page: <form method="post" action=""> <input type="password" name="passwordfield"> <input type="hidden" name="homepagepassword" value="1"> <input type="submit" value="Submit"> </form> Code in functions.php function doPasswordStuff(){ if(isset($_POST['homepagepassword'])){ $post_password = $_POST[

How to remove Disqus reaction from the counter?

拈花ヽ惹草 提交于 2019-12-09 02:31:10
问题 Two questions for Stackoverflow ninjas: I have a blog using Disqus. However, the theme I'm using do not have space to have the 'Reactions' (# of Twitters), just have the space for the numbers of the Comments. OK, Basically I do not have space enough to stay with this 'Reactions' provided for Disqus. Does anyone knows how could I remove just the 'Reactions" counts from Disqus? The new Disqus put a box with "Your site is using the new Disqus. Check the Disqus 2012 F.A.Q. or visit our support

How to make wordpress blog completely invisible to public [Not Private]

末鹿安然 提交于 2019-12-08 21:40:47
I want to close a wordpress blog I have from the public and keep it only for myself. I know I can set it to private but it shows an uggly log-in page and I dont want people trying to access it (using random usernames/pass etc) or think that its still open but its for members with accounts or anything like that. I would like the blog to point to a " server not found " for the public and when I am logged in as admin to be able to see my posts and backend aswell as frontend. How can I make this possible? My suggestion would be the following: function is_login_page() { return in_array( $GLOBALS[

Wordpress: Function not running when importing posts via RSS

帅比萌擦擦* 提交于 2019-12-08 13:52:20
问题 I am running the following function in functions.php and the code works and updates the custom fields when the post is edited. function indeedgeo_edit_post($post_id, $post){ //determine post type if(get_post_type( $post_id ) == 'job_listing'){ //indeed geo split $indeedgeo = get_post_meta($post_id, indeedgeo, true); $indeedgeos=explode(' ',$indeedgeo); $_jr_geo_latitude = $indeedgeos[0]; $_jr_geo_longitude = $indeedgeos[1]; update_post_meta($post_id, test1, $_jr_geo_latitude); update_post

Meta Query Filter by Tag Wordpress

青春壹個敷衍的年華 提交于 2019-12-08 13:15:19
问题 I currently have multiple pages, and in each page is a custom field which is named 'country'. In the 'country' field I have this value 'uk, usa, brazil'. What I'm wanting to do is display posts on the page which have the tags I have listed in the custom field 'country' (In this case show posts which has any of the tags 'uk', 'usa' and 'brazil'). I have the following code, but I don't know how to manipulate it to do the above? $args = array ( 'post_type' => array( 'post' ), // YOUR POST TYPE

Wordpress: Load custom field in ajax

落花浮王杯 提交于 2019-12-08 10:59:57
问题 On wordpress I want to make a post template where if a user clicks on a link it will load the custom field value via ajax. I found a plugin here How to load the custom field values of the post via ajax in wordpress but the download link seems to be dead so I'm unable to download :( can anyone help me code? I'm not a programmer so tell me the easiest solution 回答1: In functions.php file <?php add_action('wp_ajax_load_custom_field_data','load_custom_field_data'); add_action('wp_ajax_nopriv_load

Uniquely identifying a WordPress blog?

浪子不回头ぞ 提交于 2019-12-08 10:49:04
问题 I'm working on implementing a WordPress plugin which has a one-click setup procedure that calls my server to set things up by sending a unique key to the server, and then use that code from that time on to configure the system in the future. Is there a way in WordPress to get a unique blog ID? At first glance, I looked at get_current_blog_id , but it is a pretty local and non-unique number. Then, I looked at maybe taking the NONCE_KEY defined in wp-config.php , and hashing that with SHA512.

How to avoid double inclusion of Bootstrap.js?

帅比萌擦擦* 提交于 2019-12-08 09:42:06
问题 We've been developing a Wordpress theme and stumbled on a weird problem. A popup displayed by bootstrap.js appears for a fraction of a second and then disappears. After thorough research I have figured out that the problem is caused by a plugin which also uses bootstrap.js. Two bootstrap.js were loaded, one from our theme and another from the plugin. How to avoid this conflict? 回答1: The solution is to check if bootstrap.js is already enqueued. I've added the following to functions.php of the

preg_replace not replacing in a Wordpress plugin

一笑奈何 提交于 2019-12-08 08:59:16
问题 In follow-up to my previous question, I want to replace every instance of an ALL-CAPS * word with a link of the following format: dictionary.com/browse/<TERM> The preg_replace call I am using is this: $content = preg_replace('#[A-Z][A-Z]+#', '<a href="//dictionary.com/browse/$1">$1</a>', $content); Using http://gskinner.com/RegExr, it appears I have my regex correct, and that it should be replacing on each find. Have I done something wrong, either in the preg_replace call, or pehaps in the

how to go to other pages of my wordpress plugin

老子叫甜甜 提交于 2019-12-08 07:33:34
问题 I have a function that once is done should open a page called "nexpage.php" at the end of function I have used the following but none of them work. include works but when I use this,it includes the new page in current page which I do not want, and need to close the current page and open the next page. function myfunc(){ ......... include "nextpage.php"; echo "<a href='nextpage.php'>NewPage</a>"; <<does not find it include_once "nextpage.php"; << open it in the page so javascript does not work