qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
64,290
<p>I was looking for a plugin for this, but so far I cant find one that does what I want. I limited the user role capabilities with 'Restrict Capabilities'. But the authors still have to click the category when writing a post. For it to be idiot proof I'd like to have the right category be the default (even if it's the...
[ { "answer_id": 64300, "author": "Ben HartLenn", "author_id": 6645, "author_profile": "https://wordpress.stackexchange.com/users/6645", "pm_score": 0, "selected": false, "text": "<p>Well it's hard to tell what you're talking about without context, but it kind of sounds like you just want ...
2012/09/05
[ "https://wordpress.stackexchange.com/questions/64290", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20099/" ]
I was looking for a plugin for this, but so far I cant find one that does what I want. I limited the user role capabilities with 'Restrict Capabilities'. But the authors still have to click the category when writing a post. For it to be idiot proof I'd like to have the right category be the default (even if it's the on...
This may be similar to what you are looking for, it doesn't force a category, but doesn't let the user submit the new post unless at least one category is selected This solution requires jQuery, but with little modification can be ported to plain JavaScript ``` //intercept the "update" or "publish" button $("#post")....
64,296
<p>I am using the Sleek child theme from Studio Press and want to do a PHP call to this external database for it to display just like this link: <a href="http://www.escort332.org/tuskegeecadets.php" rel="nofollow">http://www.escort332.org/tuskegeecadets.php</a> . The Theme page is this full width page: <a href="http://...
[ { "answer_id": 64322, "author": "vmassuchetto", "author_id": 7385, "author_profile": "https://wordpress.stackexchange.com/users/7385", "pm_score": 2, "selected": false, "text": "<p>I can't bee too specific answering your question, but you can certainly use a <a href=\"http://codex.wordpr...
2012/09/05
[ "https://wordpress.stackexchange.com/questions/64296", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20101/" ]
I am using the Sleek child theme from Studio Press and want to do a PHP call to this external database for it to display just like this link: <http://www.escort332.org/tuskegeecadets.php> . The Theme page is this full width page: <http://escort332.org/wordpress1/tusk...skegee-cadets/>. Is there a way to add the PHP cod...
I can't bee too specific answering your question, but you can certainly use a [`$wpdb`](http://codex.wordpress.org/Class_Reference/wpdb) instance to [access another database](http://wordpress.org/support/topic/pros-and-cons-of-adding-tables-to-the-wp-db?replies=8#post-1201613): ``` $db = new wpdb('user', 'password', '...
64,303
<p>How can i display 3 post types in same page search results.</p> <p><a href="http://cinema.trancelevel.com/" rel="nofollow">http://cinema.trancelevel.com/</a></p> <p>For example i have </p> <p>post_type1-Movies post_type2-Trailers post_type3-Subtitrari</p> <p>Wen i search i want to display the search results..</...
[ { "answer_id": 64307, "author": "Eric Holmes", "author_id": 23454, "author_profile": "https://wordpress.stackexchange.com/users/23454", "pm_score": 0, "selected": false, "text": "<p>You would need to alter the wp_query on your search page to accept <code>'post_type' =&gt; $_get['post_typ...
2012/09/05
[ "https://wordpress.stackexchange.com/questions/64303", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17885/" ]
How can i display 3 post types in same page search results. <http://cinema.trancelevel.com/> For example i have post\_type1-Movies post\_type2-Trailers post\_type3-Subtitrari Wen i search i want to display the search results.. Ex: i Search for Battleship Movie. I want the search results to display somting like t...
Make sure that your registration arguments for your post types have the `public` argument set to *true* or, alternately, `publicly_queryable` set to *true* and `exclude_from_search` set to *false*. Then, modify your search query by hooking into the `pre_get_posts` action: ``` function filter_search( $query ) { $p...
64,313
<p>The plugin "Video Embed &amp; Thumbnail Generator" does a great job of generating thumbnails from videos. It saves the thumbnail URL as metadata for the attachment. The thumbnail gets added to the uploads directory. Is there a way to take this image and add it to the media library so i can pass the image through ...
[ { "answer_id": 64323, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 3, "selected": false, "text": "<p>If the image is in the content source you can extract it and use <a href=\"http://codex.wordpress.org/Function_Ref...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64313", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6477/" ]
The plugin "Video Embed & Thumbnail Generator" does a great job of generating thumbnails from videos. It saves the thumbnail URL as metadata for the attachment. The thumbnail gets added to the uploads directory. Is there a way to take this image and add it to the media library so i can pass the image through the image\...
Here are the pertinant parts that I changed from the `kg_video_attachment_fields_to_save()` function which filters attachment\_fields\_to\_save: ``` $thumb_url = $attachment['kgflashmediaplayer-poster']; //insert the $thumb_url into the media library if it does not already exist if ( ! ($thumb_id = get_at...
64,331
<p>I'm working on an ajax request, I have several ajax requests on my functions.php. And all are working, but this:</p> <p>On my php I have this:</p> <pre><code>add_action("wp_ajax_fb_points", "get_fb_points"); add_action("wp_ajax_nopriv_fb_points", "get_fb_points"); function get_fb_points(){ if ( !wp_verify_non...
[ { "answer_id": 64336, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 0, "selected": false, "text": "<p>When passing data using ajax I prefer to use <a href=\"http://codex.wordpress.org/Function_Reference/check_ajax_re...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64331", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6519/" ]
I'm working on an ajax request, I have several ajax requests on my functions.php. And all are working, but this: On my php I have this: ``` add_action("wp_ajax_fb_points", "get_fb_points"); add_action("wp_ajax_nopriv_fb_points", "get_fb_points"); function get_fb_points(){ if ( !wp_verify_nonce($_REQUEST['nonce']...
I don't know I just submitted the ticket on track. I was using `get_current_user_id()` and it modifies the wp\_create\_nonce behavior. Sinces `wp_create_nonce` uses `wp_get_current_user()` I think there is the problem.
64,338
<p>I searched for a while but I didn't find any solution. I used the functions <a href="https://wordpress.stackexchange.com/questions/9394/getting-all-values-for-a-custom-field-key-cross-post">listed here</a>. It outputs something like this:</p> <pre><code>Array ( [0] =&gt; 15 [1] =&gt; 30 [2] =&gt; 50 ) <...
[ { "answer_id": 64454, "author": "amit", "author_id": 17968, "author_profile": "https://wordpress.stackexchange.com/users/17968", "pm_score": 4, "selected": true, "text": "<p><a href=\"http://codex.wordpress.org/Class_Reference/wpdb#SELECT_a_Column\" rel=\"noreferrer\"><code>get_col()</co...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64338", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6519/" ]
I searched for a while but I didn't find any solution. I used the functions [listed here](https://wordpress.stackexchange.com/questions/9394/getting-all-values-for-a-custom-field-key-cross-post). It outputs something like this: ``` Array ( [0] => 15 [1] => 30 [2] => 50 ) ``` But I want something like thi...
[`get_col()`](http://codex.wordpress.org/Class_Reference/wpdb#SELECT_a_Column) function returns only one column as array. To get two column result we can use [`get_results()`](http://codex.wordpress.org/Class_Reference/wpdb#SELECT_Generic_Results), Which will return an array of objects Which further can be converted i...
64,339
<p>I am using this code to load related posts with a custom taxonomy term slug:</p> <pre><code>&lt;?php global $post; $terms = get_the_terms( $post-&gt;ID , 'topics', 'string'); $do_not_duplicate[] = $post-&gt;ID; if(!empty($terms)){ foreach ($terms as $term) { query_posts( array( 'topics' =&gt; $...
[ { "answer_id": 64341, "author": "zigzag", "author_id": 19933, "author_profile": "https://wordpress.stackexchange.com/users/19933", "pm_score": 3, "selected": true, "text": "<p>You need to specify number of posts to retrieve. 'showposts' is how many to show on page, and is deprecated (use...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64339", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17376/" ]
I am using this code to load related posts with a custom taxonomy term slug: ``` <?php global $post; $terms = get_the_terms( $post->ID , 'topics', 'string'); $do_not_duplicate[] = $post->ID; if(!empty($terms)){ foreach ($terms as $term) { query_posts( array( 'topics' => $term->slug, 'showp...
You need to specify number of posts to retrieve. 'showposts' is how many to show on page, and is deprecated (use 'posts\_per\_page' instead) ``` 'showposts' => 4, 'numberposts' => 4, ```
64,345
<p>Hi I have a particular installation of WordPress, and I would like to know what is the name of the .php file to access to the blog.</p> <p>So to sum up : </p> <p>I have a navigation like that : HOME / PORTFOLIO / BLOG /CONTACT</p> <p>By default, the user arrives on the home which use "front-page.php" which displa...
[ { "answer_id": 64347, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>Use <code>home.php</code>, that’s the template for the list of newest blog posts. It will not affect the URL.</p>\n\n<...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64345", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15879/" ]
Hi I have a particular installation of WordPress, and I would like to know what is the name of the .php file to access to the blog. So to sum up : I have a navigation like that : HOME / PORTFOLIO / BLOG /CONTACT By default, the user arrives on the home which use "front-page.php" which display excerpt of last entrie...
Use `home.php`, that’s the template for the list of newest blog posts. It will not affect the URL. If you go to `wp-admin/options-reading.php` and choose a page for **Posts page** – this page will use `home.php`. So create a static page, assign the URL `/blog/` and select it in the settings. WordPress will take care o...
64,348
<p>I successfully managed to create admin bar item using this:</p> <pre><code>add_action('admin_bar_menu', 'toolbar_link_to_mypage', 999); function toolbar_link_to_mypage($wp_admin_bar){ global $wp_admin_bar; $theme_menu = array( 'id' =&gt; 'theme_page', 'title' =&gt; __('test', 'test'), ...
[ { "answer_id": 64347, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>Use <code>home.php</code>, that’s the template for the list of newest blog posts. It will not affect the URL.</p>\n\n<...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64348", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17167/" ]
I successfully managed to create admin bar item using this: ``` add_action('admin_bar_menu', 'toolbar_link_to_mypage', 999); function toolbar_link_to_mypage($wp_admin_bar){ global $wp_admin_bar; $theme_menu = array( 'id' => 'theme_page', 'title' => __('test', 'test'), 'href' => 'http:/...
Use `home.php`, that’s the template for the list of newest blog posts. It will not affect the URL. If you go to `wp-admin/options-reading.php` and choose a page for **Posts page** – this page will use `home.php`. So create a static page, assign the URL `/blog/` and select it in the settings. WordPress will take care o...
64,358
<p>I would love to get the list of posts by their custom taxonomy (=store) name.</p> <p>Here is what I have so far, but it is not working.</p> <p>Please help with the code.</p> <p>$mystorename is a variable holding the name of the store i want to query by.</p> <p>Any help will be appreciated.</p> <p>Thank you</p> ...
[ { "answer_id": 64388, "author": "Dave Hunt", "author_id": 1769, "author_profile": "https://wordpress.stackexchange.com/users/1769", "pm_score": 2, "selected": false, "text": "<p>I'm not sure if the get_posts function supports the tax_query. You might want to try creating a new WP_Query o...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64358", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20126/" ]
I would love to get the list of posts by their custom taxonomy (=store) name. Here is what I have so far, but it is not working. Please help with the code. $mystorename is a variable holding the name of the store i want to query by. Any help will be appreciated. Thank you ``` $args = array( 'tax_query' => arr...
I'm not sure if the get\_posts function supports the tax\_query. You might want to try creating a new WP\_Query object instead. ``` $args = array( 'tax_query' => array( array( 'taxonomy' => 'store', 'field' => 'name', 'terms' => $mystorename ) ) ); $query = new WP_Query($args);...
64,362
<p>I'm creating an events site for a theatre in wordpress - at the moment I have set up a custom post type for Events and am using a custom field 'event_date' (which formats to YYYY-MM-DD) to order the events on their listing page and also move them to the archive if past todays date.</p> <p>So far all working nicely....
[ { "answer_id": 64366, "author": "Simon Forster", "author_id": 17208, "author_profile": "https://wordpress.stackexchange.com/users/17208", "pm_score": 0, "selected": false, "text": "<p>Create an archive index for your custom post type (see <a href=\"http://codex.wordpress.org/Creating_an_...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64362", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2595/" ]
I'm creating an events site for a theatre in wordpress - at the moment I have set up a custom post type for Events and am using a custom field 'event\_date' (which formats to YYYY-MM-DD) to order the events on their listing page and also move them to the archive if past todays date. So far all working nicely. Next up...
Ok short of a better solution here is what I've come up with: ``` <?php $today = date('Y-m-d', strtotime('-6 hours')); query_posts(array( 'post_type' => 'events', 'posts_per_page' => 99, 'meta_key' => 'event_date', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array(array( '...
64,373
<p>I would like to change themes background color using a plugin. For when I use this code,</p> <pre><code>function change_background_of_theme(){ ?&gt; &lt;style&gt; #main{background: yellow;} &lt;/style&gt; &lt;?php } add_action('init','change_background_of_theme'); </code></pre> <p>This code only changes the bg ...
[ { "answer_id": 64375, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 1, "selected": false, "text": "<p>If the theme uses the custom-background functionality of WordPress, then WordPress outputs CSS code in the head whi...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64373", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12918/" ]
I would like to change themes background color using a plugin. For when I use this code, ``` function change_background_of_theme(){ ?> <style> #main{background: yellow;} </style> <?php } add_action('init','change_background_of_theme'); ``` This code only changes the bg color of the theme that use #main id. This b...
If the theme uses the custom-background functionality of WordPress, then WordPress outputs CSS code in the head which essentially says `body.custom-background { ... }` and it puts the chosen colors and image in there. So most themes sorta expect that to be on the body itself, and to have a custom-background class on ...
64,386
<p>I am working on a custom template for my office. I have a static front page and a static home page to display the blog posts. I am having a few minor issues and will have to create a few other questions as I fix each problem... Anyways, this problem is pretty interesting to me. </p> <p>While in development, I have ...
[ { "answer_id": 64375, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 1, "selected": false, "text": "<p>If the theme uses the custom-background functionality of WordPress, then WordPress outputs CSS code in the head whi...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64386", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19217/" ]
I am working on a custom template for my office. I have a static front page and a static home page to display the blog posts. I am having a few minor issues and will have to create a few other questions as I fix each problem... Anyways, this problem is pretty interesting to me. While in development, I have the post p...
If the theme uses the custom-background functionality of WordPress, then WordPress outputs CSS code in the head which essentially says `body.custom-background { ... }` and it puts the chosen colors and image in there. So most themes sorta expect that to be on the body itself, and to have a custom-background class on ...
64,398
<p>I would like to do a dynamic sidebar for my WordPress site, so it would pull in the correct Sidebar template based on the page title of the page.</p> <p>So if I had 10 sidebars all named like this:</p> <p>Sidebar Template Name: About Sidebar Template Name: Contact Sidebar Template Name: Jobs Sidebar Template Name:...
[ { "answer_id": 64399, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>Something like this should work:</p>\n\n<pre><code>if( is_page() ) :\n $this_page = get_queried_object();\n i...
2012/09/06
[ "https://wordpress.stackexchange.com/questions/64398", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18026/" ]
I would like to do a dynamic sidebar for my WordPress site, so it would pull in the correct Sidebar template based on the page title of the page. So if I had 10 sidebars all named like this: Sidebar Template Name: About Sidebar Template Name: Contact Sidebar Template Name: Jobs Sidebar Template Name: Etc Sidebar Temp...
Something like this should work: ``` if( is_page() ) : $this_page = get_queried_object(); if ( ! dynamic_sidebar( $this_page->post_title ) ) : echo 'No sidebar defined for this page title'; endif; endif; ```
64,425
<p>Hey i am using this theme called starblog and on the single gallery page it shows this cpde below</p> <pre><code>&lt;div id="nav-images" class="navigation clearfix"&gt; &lt;div class="nav-next"&gt;&lt;?php next_image_link() ?&gt;&lt;/div&gt; &lt;div class="nav-previous"&gt;&lt;?php previous...
[ { "answer_id": 64428, "author": "Pollux Khafra", "author_id": 12700, "author_profile": "https://wordpress.stackexchange.com/users/12700", "pm_score": 0, "selected": false, "text": "<p>This should do the trick. Just replace your code above with this.</p>\n\n<pre><code>&lt;div class=\"navi...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64425", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20145/" ]
Hey i am using this theme called starblog and on the single gallery page it shows this cpde below ``` <div id="nav-images" class="navigation clearfix"> <div class="nav-next"><?php next_image_link() ?></div> <div class="nav-previous"><?php previous_image_link() ?></div> </div> ``` It s...
The WordPress function [`next_image_link()`](http://codex.wordpress.org/Function_Reference/next_image_link) do accept a second parameter `$text` which will show up instead of a thumbnail image. **Example -** ``` <?php next_image_link( false, 'Next Image' ); ?> ```
64,430
<p>I was wondering if anyone knew of a paid membership plugin that streamlined the peyment/registration process into a single step.</p> <p>Ideally there would be a signup page. This page would have the typical fields (email address, possibly a user name and password) as well as the paypal button (only active when all ...
[ { "answer_id": 64428, "author": "Pollux Khafra", "author_id": 12700, "author_profile": "https://wordpress.stackexchange.com/users/12700", "pm_score": 0, "selected": false, "text": "<p>This should do the trick. Just replace your code above with this.</p>\n\n<pre><code>&lt;div class=\"navi...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64430", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20014/" ]
I was wondering if anyone knew of a paid membership plugin that streamlined the peyment/registration process into a single step. Ideally there would be a signup page. This page would have the typical fields (email address, possibly a user name and password) as well as the paypal button (only active when all required f...
The WordPress function [`next_image_link()`](http://codex.wordpress.org/Function_Reference/next_image_link) do accept a second parameter `$text` which will show up instead of a thumbnail image. **Example -** ``` <?php next_image_link( false, 'Next Image' ); ?> ```
64,431
<p>I've spent hours trying to figure this out, tried TONS of different methods and all failed in their own way.</p> <p>What I'm trying to do:</p> <p>Limit home page custom post types (woo_estate) to 6 and then paginate the rest.</p> <p>What happens:</p> <p>Not only the home page custom post types don't get limited,...
[ { "answer_id": 64428, "author": "Pollux Khafra", "author_id": 12700, "author_profile": "https://wordpress.stackexchange.com/users/12700", "pm_score": 0, "selected": false, "text": "<p>This should do the trick. Just replace your code above with this.</p>\n\n<pre><code>&lt;div class=\"navi...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64431", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19831/" ]
I've spent hours trying to figure this out, tried TONS of different methods and all failed in their own way. What I'm trying to do: Limit home page custom post types (woo\_estate) to 6 and then paginate the rest. What happens: Not only the home page custom post types don't get limited, no pagination is added. Curr...
The WordPress function [`next_image_link()`](http://codex.wordpress.org/Function_Reference/next_image_link) do accept a second parameter `$text` which will show up instead of a thumbnail image. **Example -** ``` <?php next_image_link( false, 'Next Image' ); ?> ```
64,434
<p>I am trying to implement a slider on my site but i cannot find out how to display the category for each post displayed. I want it to display over the thumbnail. is there a code i can enter to display category? </p>
[ { "answer_id": 64441, "author": "Veer", "author_id": 8672, "author_profile": "https://wordpress.stackexchange.com/users/8672", "pm_score": 0, "selected": false, "text": "<pre><code>function get_post_category($postId) {\n global $wpdb;\n if (!is_null($postId)) {\n $conditions...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64434", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20150/" ]
I am trying to implement a slider on my site but i cannot find out how to display the category for each post displayed. I want it to display over the thumbnail. is there a code i can enter to display category?
To get the current category of the post just try this ``` $cats = get_the_category( get_the_ID() ); echo $cat_name = $cats[0]->name; ```
64,467
<p>Is there a way to just split <code>the_title</code> into two different lines without a custom field? </p> <p>The titles in my blog are like small header above the maintitle.</p> <p>The Problem is, that at the moment I am using a custom field in the title - but google and disqus only use "original" title - without ...
[ { "answer_id": 64468, "author": "Joshua Abenazer", "author_id": 10251, "author_profile": "https://wordpress.stackexchange.com/users/10251", "pm_score": 2, "selected": false, "text": "<p>The best way to go about it is using the <code>the_title</code> filter. Put the following code in your...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64467", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17376/" ]
Is there a way to just split `the_title` into two different lines without a custom field? The titles in my blog are like small header above the maintitle. The Problem is, that at the moment I am using a custom field in the title - but google and disqus only use "original" title - without a custom field. So my ques...
The best way to go about it is using the `the_title` filter. Put the following code in your `functions.php`. ``` add_filter( 'the_title', 'wpse_64467_prefix_title', '', 2 ); function wpse_64467_prefix_title( $title, $id ){ $header_title = get_post_meta( $id, 'header_title', true ); $title = ( $header_title ) ?...
64,477
<p>I want to add some javascript directly below content, added by another plugin's shortcode.</p> <p>We are using the NextGen Gallery plugin and there are many articles containing the [nggallery] shortcode. I don't want to change all articles and I don't want to inform all authors to use another shortcode in the futur...
[ { "answer_id": 64516, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 2, "selected": false, "text": "<p>you could</p>\n\n<pre><code>remove_shortcode( 'nggallery' );\n</code></pre>\n\n<p>and then add it again:<...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64477", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14085/" ]
I want to add some javascript directly below content, added by another plugin's shortcode. We are using the NextGen Gallery plugin and there are many articles containing the [nggallery] shortcode. I don't want to change all articles and I don't want to inform all authors to use another shortcode in the future. And I a...
you could ``` remove_shortcode( 'nggallery' ); ``` and then add it again: ``` function put_script_after_nggallery_shortcode( $atts ){ global $nggShortcodes; $nggShortcodes->show_gallery($atts); //or otherwise duplicate the callback function wp_enqueue_script('special-ngg-sciprt', 'url-to-script', null, null, tru...
64,486
<p>I am using WordPress SEO plugin written by Yoast. This plugin, by default, shows "noindex,follow" on every page. I am sure I know the file that displays "noindex, follow" but after much "tweaking" I can't seem to remove the code.</p> <p>Here's the file: <a href="https://plugins.svn.wordpress.org/wordpress-seo/tags/...
[ { "answer_id": 64525, "author": "Ben HartLenn", "author_id": 6645, "author_profile": "https://wordpress.stackexchange.com/users/6645", "pm_score": 2, "selected": false, "text": "<p>Ooohhh you mean \"pagination\" pages. Gotcha now!</p>\n\n<p>It's hard to say for sure(I know I know), but a...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64486", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7371/" ]
I am using WordPress SEO plugin written by Yoast. This plugin, by default, shows "noindex,follow" on every page. I am sure I know the file that displays "noindex, follow" but after much "tweaking" I can't seem to remove the code. Here's the file: <https://plugins.svn.wordpress.org/wordpress-seo/tags/1.2.8.3/frontend/c...
Ooohhh you mean "pagination" pages. Gotcha now! It's hard to say for sure(I know I know), but at first glance it looks like this block of code would be what you're after: ``` if ( $wp_query->query_vars['paged'] && $wp_query->query_vars['paged'] > 1 && isset( $options['noindex-subpages'] ) && $options['noindex-subpage...
64,487
<p>I'm working on a site where some of the nav menu items disappear (from the front end, the back end, and the database). However, debugging is extremely difficult since they don't disappear immediately! As a result, I'm unable to figure out what's triggering the deletion.</p> <p>More info:</p> <ul> <li>It seems as t...
[ { "answer_id": 64987, "author": "Ben", "author_id": 8482, "author_profile": "https://wordpress.stackexchange.com/users/8482", "pm_score": 0, "selected": false, "text": "<p>Have you de-activated any plugins you may have installed?</p>\n\n<p>If you've already tried that and it's still happ...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64487", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/49/" ]
I'm working on a site where some of the nav menu items disappear (from the front end, the back end, and the database). However, debugging is extremely difficult since they don't disappear immediately! As a result, I'm unable to figure out what's triggering the deletion. More info: * It seems as though nav menu items ...
Log queries ----------- As the question says "it doesn't happen always", it's hard to tell what's really going on. When you can't see what happens (query in background) and don't know when it happens, then it's best to log it. The logger ---------- On activation, the plugin will try to create a log directory named `...
64,492
<p>I have this code in a template file, which loads <code>sidebar-sidebar_a.php</code>:</p> <pre><code>get_sidebar('sidebar_a'); </code></pre> <p>I would like to add a function to sidebar.php which has the effect of changing that to this if some condition is met:</p> <pre><code>get_sidebar('other'); </code></pre> <...
[ { "answer_id": 64493, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>Just pass a variable to <code>get_sidebar()</code>:</p>\n\n<pre><code>// Determine sidebar\n$sidebar = ( is...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64492", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3564/" ]
I have this code in a template file, which loads `sidebar-sidebar_a.php`: ``` get_sidebar('sidebar_a'); ``` I would like to add a function to sidebar.php which has the effect of changing that to this if some condition is met: ``` get_sidebar('other'); ``` so that it instead loads `sidebar-other.php`. I thought t...
Get sidebar is a really thin wrapper around `locate_template`, which just searches the current child theme and parent theme directory for the given sidebar. `get_sidebar` in `wp-includes/general-template.php`: ``` $templates = array(); if ( isset($name) ) $templates[] = "sidebar-{$name}.php"; $templates[] = 'sid...
64,496
<p>I've made a custom login template where you can login or request a link that sends you to the reset password form. What I need to do is make that unique link redirect to a custom reset password template (not wordpress's default). So this is kind of a two part question on how first to send a link to a custom template...
[ { "answer_id": 64493, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>Just pass a variable to <code>get_sidebar()</code>:</p>\n\n<pre><code>// Determine sidebar\n$sidebar = ( is...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64496", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12700/" ]
I've made a custom login template where you can login or request a link that sends you to the reset password form. What I need to do is make that unique link redirect to a custom reset password template (not wordpress's default). So this is kind of a two part question on how first to send a link to a custom template an...
Get sidebar is a really thin wrapper around `locate_template`, which just searches the current child theme and parent theme directory for the given sidebar. `get_sidebar` in `wp-includes/general-template.php`: ``` $templates = array(); if ( isset($name) ) $templates[] = "sidebar-{$name}.php"; $templates[] = 'sid...
64,501
<p>Is there a way to remove the link on full size images in posts/pages?</p> <p>I still would like to have it for the other smaller sizes. Since the full size image is already full size, it seems unnecessary to link to itself.</p>
[ { "answer_id": 64493, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>Just pass a variable to <code>get_sidebar()</code>:</p>\n\n<pre><code>// Determine sidebar\n$sidebar = ( is...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64501", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7332/" ]
Is there a way to remove the link on full size images in posts/pages? I still would like to have it for the other smaller sizes. Since the full size image is already full size, it seems unnecessary to link to itself.
Get sidebar is a really thin wrapper around `locate_template`, which just searches the current child theme and parent theme directory for the given sidebar. `get_sidebar` in `wp-includes/general-template.php`: ``` $templates = array(); if ( isset($name) ) $templates[] = "sidebar-{$name}.php"; $templates[] = 'sid...
64,509
<p>Why on earth is this piece of code not working?</p> <pre><code> $my_query = new WP_Query('category_name=feature'); while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); echo 'test'; endwhile; </code></pre> <p>I've tried with <code>Feature</code> and <code>feature</code>, no difference. ...
[ { "answer_id": 64514, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 2, "selected": false, "text": "<p>instead of hacking index.php why not use the pre_get_posts filter?</p>\n\n<pre><code>add_filter('pre_get_...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64509", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1447/" ]
Why on earth is this piece of code not working? ``` $my_query = new WP_Query('category_name=feature'); while ($my_query->have_posts()) : $my_query->the_post(); echo 'test'; endwhile; ``` I've tried with `Feature` and `feature`, no difference. I need to get post by category name. Any help appreci...
A common pitfall is the fact that: > > category\_name takes the **category SLUG** NOT the **name** as attribute > > > This is often mistaken.
64,512
<p>Our website has an open system for contributors (WP User Role) to add news and calendar content to the site.</p> <p>I'd like to set and lock the position of the content and meta boxes on the post edit screen. Is there a filter or function to set the order of the boxes before I <a href="https://wordpress.stackexchan...
[ { "answer_id": 67556, "author": "Nate", "author_id": 14862, "author_profile": "https://wordpress.stackexchange.com/users/14862", "pm_score": 3, "selected": true, "text": "<p>Found this while trolling the internets... Works Perfectly</p>\n\n<pre><code>add_action('admin_init', 'set_user_me...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64512", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14862/" ]
Our website has an open system for contributors (WP User Role) to add news and calendar content to the site. I'd like to set and lock the position of the content and meta boxes on the post edit screen. Is there a filter or function to set the order of the boxes before I [disable the option of changing the sort order](...
Found this while trolling the internets... Works Perfectly ``` add_action('admin_init', 'set_user_metaboxes'); //I want it to fire every time edit post screen comes up //add_action('user_register', 'set_user_metaboxes'); //You can also have it only set when a new user is created function set_user_metaboxes($user_id=...
64,515
<p>I am new to WordPress, and am still trying to learn the in's and out's in much respect to this well known CMS.</p> <p>I am wanting to know, if I should or must have a Fallback for main menu?</p> <p>This is what I am working with:</p> <pre><code>// This theme uses wp_nav_menu() in one location. register_nav_menus(...
[ { "answer_id": 64517, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 2, "selected": false, "text": "<p>See <a href=\"http://codex.wordpress.org/Function_Reference/wp_nav_menu\" rel=\"nofollow\"><code>wp_nav_m...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64515", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12971/" ]
I am new to WordPress, and am still trying to learn the in's and out's in much respect to this well known CMS. I am wanting to know, if I should or must have a Fallback for main menu? This is what I am working with: ``` // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => __(...
The parameter `fallback_cb` will be used when the user has no menu assigned to your `theme_location`. It should be a function that returns a string, but you can use `__return_false()` to suppress any output: ``` wp_nav_menu( array( 'theme_location' => 'primary', // No menu available: no output. ...
64,518
<p>Ola,</p> <p>i am building a complex cinema site, and i want to get movies by date</p> <p>Ex: The movies are aded trought post type,</p> <p>I have a custom field name date.</p> <p>How can i retrive the Movie that shoud play today in cinema ( date in custom field : 08.09.2012...)</p> <p>Ex: How can i retrive the ...
[ { "answer_id": 64519, "author": "Ben HartLenn", "author_id": 6645, "author_profile": "https://wordpress.stackexchange.com/users/6645", "pm_score": 0, "selected": false, "text": "<p>First you'll need to dynamically get todays data formatted the same as what you store in the custom field l...
2012/09/07
[ "https://wordpress.stackexchange.com/questions/64518", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17885/" ]
Ola, i am building a complex cinema site, and i want to get movies by date Ex: The movies are aded trought post type, I have a custom field name date. How can i retrive the Movie that shoud play today in cinema ( date in custom field : 08.09.2012...) Ex: How can i retrive the movie by date Site: <http://cinema.tr...
To be able to query on your dates beyond a simple date comparison you should reverse the format of your date field. Dates should always follow the [MySQL date format](http://dev.mysql.com/doc/refman/5.0/en/datetime.html) for reliable querying and sorting: `YYYY-MM-DD HH:MM:SS` To query movies for today you would use a...
64,540
<p>I am using a Genesis child theme that I would like to make some custom changes to it, but would like to be able to update it when a new version comes out without loosing my edits. I am familiar with the parent-child practice, but since my theme is already a child of genesis what is the best way to approach that?</p>...
[ { "answer_id": 64554, "author": "Anh Tran", "author_id": 2051, "author_profile": "https://wordpress.stackexchange.com/users/2051", "pm_score": 1, "selected": false, "text": "<p>From my understanding, there's no grand child theme in current version of WordPress. It's not supported at the ...
2012/09/08
[ "https://wordpress.stackexchange.com/questions/64540", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15771/" ]
I am using a Genesis child theme that I would like to make some custom changes to it, but would like to be able to update it when a new version comes out without loosing my edits. I am familiar with the parent-child practice, but since my theme is already a child of genesis what is the best way to approach that? First...
Genesis (and others like it) has always had a problem with a lack of consensus on how to cope with updates to its child themes. The simple conventional answer is that you should seldom or never update them, because it may be a very time-intensive process to avoid breaking things. StudioPress does not do auto-updates fo...
64,549
<p>I have a few Ajax services that I'm setting up. All of them require being logged in so I've attached hooks into the "wp_ajax_[$service]". The problem is when I call these services I just get a "0" response. I also get no record of anything in my php error log. </p> <p>What I'm wondering is:</p> <ol> <li>Is there a...
[ { "answer_id": 83358, "author": "user123", "author_id": 26623, "author_profile": "https://wordpress.stackexchange.com/users/26623", "pm_score": 2, "selected": false, "text": "<p>According to the <a href=\"http://codex.wordpress.org/AJAX_in_Plugins\" rel=\"nofollow\">WordPress documentati...
2012/09/08
[ "https://wordpress.stackexchange.com/questions/64549", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16085/" ]
I have a few Ajax services that I'm setting up. All of them require being logged in so I've attached hooks into the "wp\_ajax\_[$service]". The problem is when I call these services I just get a "0" response. I also get no record of anything in my php error log. What I'm wondering is: 1. Is there a way to hook into ...
According to the [WordPress documentation](http://codex.wordpress.org/AJAX_in_Plugins), you should call `die()` at the end of your PHP function to return proper results.
64,576
<p>I've got a custom role for my site and users can only access their profile page, this appears to be the minimum for wordpress. However, the accounts are managed by us and this is a private site, we do not want users to be able to change their username, email or password using wordpress.</p> <p>The only issue we hav...
[ { "answer_id": 64581, "author": "Carl Rannaberg", "author_id": 19886, "author_profile": "https://wordpress.stackexchange.com/users/19886", "pm_score": 4, "selected": true, "text": "<p>There are two possible solutions for your problem.</p>\n\n<ol>\n<li><p>You can download \"Login redirect...
2012/09/08
[ "https://wordpress.stackexchange.com/questions/64576", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19105/" ]
I've got a custom role for my site and users can only access their profile page, this appears to be the minimum for wordpress. However, the accounts are managed by us and this is a private site, we do not want users to be able to change their username, email or password using wordpress. The only issue we have right no...
There are two possible solutions for your problem. 1. You can download "Login redirect" plugin from here: <http://wordpress.org/extend/plugins/peters-login-redirect/> 2. You should use a login\_redirect filter: > > > ``` > function my_login_redirect($redirect_to, $request) { > $redirect_url = get_bloginfo( 'url' ) ...
64,580
<p>I am trying to echo the category nicename to reference a category image stored in my images folder in another folder called categories.</p> <p>I am using this code:</p> <pre><code>$category = get_the_category(); echo '&lt;img src="'.get_bloginfo('template_directory').'/images/categories/'.$category-&gt;category_ni...
[ { "answer_id": 64583, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>refer to the codex entry for <a href=\"http://codex.wordpress.org/Function_Reference/get_the_category\" rel=\"nofol...
2012/09/08
[ "https://wordpress.stackexchange.com/questions/64580", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13413/" ]
I am trying to echo the category nicename to reference a category image stored in my images folder in another folder called categories. I am using this code: ``` $category = get_the_category(); echo '<img src="'.get_bloginfo('template_directory').'/images/categories/'.$category->category_nicename.'.png">'; ``` But ...
\*get\_the\_category();\* is designed to return multiple categories. You have to provide index for deciding which categories' nicename you want to echo. Something like below, ``` $category = get_the_category(); echo '<img src="'.get_bloginfo('template_directory').'/images/categories/'.$category[0]->category_nicename....
64,596
<p>I am trying to pass a variable value to a shortcode attribute. I can't get it to work.</p> <p>Is the following supposed to work, or must values be literal?</p> <pre><code>$mycat = 'books'; $myshortcode = '[products category="'.$mycat .'"]'; echo do_shortcode($myshortcode); </code></pre> <p>The above outputs noth...
[ { "answer_id": 64593, "author": "Douglas.Sesar", "author_id": 19945, "author_profile": "https://wordpress.stackexchange.com/users/19945", "pm_score": 4, "selected": true, "text": "<p>I hate to mention this on Wordpress.Stackexchange, but I would go with using Magento in place of Wordpres...
2012/09/08
[ "https://wordpress.stackexchange.com/questions/64596", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2071/" ]
I am trying to pass a variable value to a shortcode attribute. I can't get it to work. Is the following supposed to work, or must values be literal? ``` $mycat = 'books'; $myshortcode = '[products category="'.$mycat .'"]'; echo do_shortcode($myshortcode); ``` The above outputs nothing. If I replace it with ``` $...
I hate to mention this on Wordpress.Stackexchange, but I would go with using Magento in place of Wordpress. I love Wordpress and use it on almost every website that I build, but it was not specifically made for e-commerce. Magento handles just about everything better in regards to e-commerce. I only tend to use Wordpr...
64,607
<p>I try to password protect my custom page such that before any content is shown the user must enter a password. More specific, in my code below, anything inside the content-div-container should be password protected: </p> <pre><code>&lt;?php /* Template Name: custom_page */ ?&gt; &lt;?php get_header(); ?&gt; &lt;d...
[ { "answer_id": 64609, "author": "Douglas.Sesar", "author_id": 19945, "author_profile": "https://wordpress.stackexchange.com/users/19945", "pm_score": -1, "selected": false, "text": "<p>I would suggest using the Membership Plugin; it allows for users of a certain type to access to specifi...
2012/09/09
[ "https://wordpress.stackexchange.com/questions/64607", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20212/" ]
I try to password protect my custom page such that before any content is shown the user must enter a password. More specific, in my code below, anything inside the content-div-container should be password protected: ``` <?php /* Template Name: custom_page */ ?> <?php get_header(); ?> <div id="content"> <div id="m...
When you select password protected option in page back-end, It by-default works for content only. i.e. the\_content() But if you want to password protect whole page or have a custom template, you need to have the following structure. ``` <?php global $post; get_header(); if ( ! post_password_required( $post ) ) { ...
64,611
<p>I´m working on a front end registration form adn have gotten as far as getting the standard registration form to work, but... I´d like to add the oportunity to let the user choose his/her own password.</p> <p>I´m a bit noob at this so could anyone plese help me? :)</p> <p>Here is my code so far:</p> <pre><code>&l...
[ { "answer_id": 64617, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 5, "selected": true, "text": "<p>Its Not has hard as you think it is :)</p>\n\n<p>Add the password fields to your form :</p>\n\n<pre><code>pas...
2012/09/09
[ "https://wordpress.stackexchange.com/questions/64611", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12727/" ]
I´m working on a front end registration form adn have gotten as far as getting the standard registration form to work, but... I´d like to add the oportunity to let the user choose his/her own password. I´m a bit noob at this so could anyone plese help me? :) Here is my code so far: ``` <?php if(!is_user_logged_in())...
Its Not has hard as you think it is :) Add the password fields to your form : ``` password: <input type="password" name="pass1" style="width:250px; margin-bottom:3px;"><br /> repeat password: <input type="password" name="pass2" style="width:250px; margin-bottom:3px;"><br /> ``` then in your `if($_POST){` replace th...
64,620
<p>I created one page for posts and changed the default post page to that page in <strong>Settings > Reading</strong>. When registering for the site the default new user role is subscriber.</p> <p>The problem is after the login when I click on my <code>diaryview</code> page it shows all the posts of other users but I ...
[ { "answer_id": 64641, "author": "Douglas.Sesar", "author_id": 19945, "author_profile": "https://wordpress.stackexchange.com/users/19945", "pm_score": 1, "selected": false, "text": "<p>Try using wp_query</p>\n\n<p>Here is the codex link:</p>\n\n<p><a href=\"http://codex.wordpress.org/Clas...
2012/09/09
[ "https://wordpress.stackexchange.com/questions/64620", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20218/" ]
I created one page for posts and changed the default post page to that page in **Settings > Reading**. When registering for the site the default new user role is subscriber. The problem is after the login when I click on my `diaryview` page it shows all the posts of other users but I want to see only my posts in my `d...
Try using wp\_query Here is the codex link: [WP\_Query - Docs - WordPress](http://codex.wordpress.org/Class_Reference/WP_Query) Here is an example of something that may help: ``` global $current_user; get_currentuserinfo(); $authorID = $current_user->ID; $args = array( 'post_type' => 'post',...
64,632
<p>I got a request to develop the following design with Wordpress: <a href="http://imm.io/DLrl" rel="nofollow">http://imm.io/DLrl</a> (design is pixelated by me for the purpose of privacy). </p> <p>As you can see there is a pretty random structure of image placement and the webmaster should have maximum flexibility in...
[ { "answer_id": 64637, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<p>I wrote a plugin named <a href=\"https://github.com/franz-josef-kaiser/Dynamic-Image-Resize\" rel=\"nofollow\">»Dyn...
2012/09/09
[ "https://wordpress.stackexchange.com/questions/64632", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3323/" ]
I got a request to develop the following design with Wordpress: <http://imm.io/DLrl> (design is pixelated by me for the purpose of privacy). As you can see there is a pretty random structure of image placement and the webmaster should have maximum flexibility in deciding how to place images, how many and in which siz...
I wrote a plugin named [»Dynamic Image resize«](https://github.com/franz-josef-kaiser/Dynamic-Image-Resize) for exactly that purpose. It features a template tag and a shortcode (that takes the exact same amount of arguments, the template tag takes. ``` // The args need to be an array dynamic_image_resize( array( ...
64,635
<p>I've been trying to use the "featured image" from the home (the blog index) with no luck. It's working for every single page, but it's not working for the home.</p> <p>The code looks something like this:</p> <pre><code>// Don't use on single posts if (!is_single()) { if (is_home()) { if (fu...
[ { "answer_id": 64639, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 0, "selected": false, "text": "<p>You have 2 quick options, via the template file using <code>the_post_thumbnail</code> for the loop. I assume your o...
2012/09/09
[ "https://wordpress.stackexchange.com/questions/64635", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20222/" ]
I've been trying to use the "featured image" from the home (the blog index) with no luck. It's working for every single page, but it's not working for the home. The code looks something like this: ``` // Don't use on single posts if (!is_single()) { if (is_home()) { if (function_exists('wp_get...
if you are referring to the 'page for posts', then try (only relevant section of your code shown): ``` if (is_home() && get_option('page_for_posts') ) { $img = wp_get_attachment_image_src(get_post_thumbnail_id(get_option('page_for_posts')),'full'); $featured_image = $img[0]; } else { ```
64,648
<p>I am using Wordpress 3.4.2, latest version! I have no plugins installed except the one that I am writing.</p> <p>So Here's the deal, I'm reading a json feed and i'm trying to import its content into a table that i created in my wordpress database. I've used a similar set of code in another plugin that I wrote an...
[ { "answer_id": 64651, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 2, "selected": false, "text": "<blockquote>\n <p>I saw on here one other guy was having problems with <code>$wpdb-&gt;prepare</code>. Am I using it ...
2012/09/09
[ "https://wordpress.stackexchange.com/questions/64648", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18119/" ]
I am using Wordpress 3.4.2, latest version! I have no plugins installed except the one that I am writing. So Here's the deal, I'm reading a json feed and i'm trying to import its content into a table that i created in my wordpress database. I've used a similar set of code in another plugin that I wrote and it works fi...
Success! I got the wpdb->prepare to work FINALLY and I'd love to share my code snippet here -- Hopefully someone else will find this useful. **My Situation** I was trying to import data from a feed into a custom table from a plugin I am writing. Several websites and even the guys that replied to this thread encourage...
64,652
<p>I am developing a theme and I wanted to add some extra content to the built in background options page. I know how to use the settings API to create new theme options and settings but I can't seem to figure out where it's actually calling to the background page. I have searched through <code>wp-includes/theme.php</c...
[ { "answer_id": 64657, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": true, "text": "<p>The page content for custom backgrounds is created in <code>wp-admin/custom-background.php</code>. There is no action a...
2012/09/09
[ "https://wordpress.stackexchange.com/questions/64652", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20227/" ]
I am developing a theme and I wanted to add some extra content to the built in background options page. I know how to use the settings API to create new theme options and settings but I can't seem to figure out where it's actually calling to the background page. I have searched through `wp-includes/theme.php` and still...
The page content for custom backgrounds is created in `wp-admin/custom-background.php`. There is no action available where the fields are printed. To **add** new fields we have to print JavaScript into the page footer. The action is `'admin_footer-appearance_page_custom-background'`. To **save** those field values w...
64,653
<p>So, I'm using my wordpress with a static front page and then I have Blog link that opens the blog posts. </p> <p>My question is, how can I apply a different template/styling only to that area?</p>
[ { "answer_id": 64657, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": true, "text": "<p>The page content for custom backgrounds is created in <code>wp-admin/custom-background.php</code>. There is no action a...
2012/09/09
[ "https://wordpress.stackexchange.com/questions/64653", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16117/" ]
So, I'm using my wordpress with a static front page and then I have Blog link that opens the blog posts. My question is, how can I apply a different template/styling only to that area?
The page content for custom backgrounds is created in `wp-admin/custom-background.php`. There is no action available where the fields are printed. To **add** new fields we have to print JavaScript into the page footer. The action is `'admin_footer-appearance_page_custom-background'`. To **save** those field values w...
64,665
<p>I would like to add a button to this toolbar, right of "fullscreen":</p> <p><img src="https://i.stack.imgur.com/z1Rlt.png" alt="enter image description here"></p> <p>The button should add this: „“</p> <p>If text is selected, it should get around the text, like this: „selected text“</p> <p>How can I add such a bu...
[ { "answer_id": 64667, "author": "Joshua Abenazer", "author_id": 10251, "author_profile": "https://wordpress.stackexchange.com/users/10251", "pm_score": 2, "selected": true, "text": "<p>Try adding the following code in your function.php</p>\n\n<pre><code>add_action( 'admin_footer-post-new...
2012/09/10
[ "https://wordpress.stackexchange.com/questions/64665", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7289/" ]
I would like to add a button to this toolbar, right of "fullscreen": ![enter image description here](https://i.stack.imgur.com/z1Rlt.png) The button should add this: „“ If text is selected, it should get around the text, like this: „selected text“ How can I add such a button to the ed\_toolbar (class: quicktags-too...
Try adding the following code in your function.php ``` add_action( 'admin_footer-post-new.php', 'wpse_64665_add_quick_tag' ); add_action( 'admin_footer-post.php', 'wpse_64665_add_quick_tag' ); function wpse_64665_add_quick_tag() { ?> <script type="text/javascript"> edButtons[edButtons.length] = new edB...
64,691
<p>I'm writing a plugin, I want to prevent posts have multiple categories <em>(i.e same product having category "Samsung" &amp; "Apple")</em>. Any idea on how to use some actions/filters to achieve this using my plug-in?</p>
[ { "answer_id": 64695, "author": "jocken", "author_id": 11145, "author_profile": "https://wordpress.stackexchange.com/users/11145", "pm_score": 1, "selected": false, "text": "<p>There are jquery plugins that change category checkboxes to radio buttons <a href=\"http://wordpress.org/suppor...
2012/09/10
[ "https://wordpress.stackexchange.com/questions/64691", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20011/" ]
I'm writing a plugin, I want to prevent posts have multiple categories *(i.e same product having category "Samsung" & "Apple")*. Any idea on how to use some actions/filters to achieve this using my plug-in?
Try the following code. What this would do is convert the category taxonomy checkboxes to radio buttons. In this way only one category can be selected. ``` add_filter('wp_terms_checklist_args', 'wpse_64691_one_category_only', '', 2); function wpse_64691_one_category_only( $args, $post_id){ $args['walker'] = new WP...
64,697
<p><a href="http://parlourdc.com" rel="nofollow noreferrer">Live site.</a></p> <p>I've got a custom theme, wherein the homepage(front-page.php) is static and the &quot;posts&quot; page is Press(index.php). Everything with the theme works great, with the exception of the posts not showing when viewing the Press page- it...
[ { "answer_id": 64712, "author": "Michael", "author_id": 4884, "author_profile": "https://wordpress.stackexchange.com/users/4884", "pm_score": 0, "selected": false, "text": "<p>rename <strong><em>home.php</em></strong> to something else, possibly to <strong><em>front-page.php</em></strong...
2012/09/10
[ "https://wordpress.stackexchange.com/questions/64697", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14606/" ]
[Live site.](http://parlourdc.com) I've got a custom theme, wherein the homepage(front-page.php) is static and the "posts" page is Press(index.php). Everything with the theme works great, with the exception of the posts not showing when viewing the Press page- it shows the homepage content instead. In the Reading set...
The template naming is a bit confusing in this situation, but what is happening is normal behavior in the [Template Hierarchy](http://codex.wordpress.org/Template_Hierarchy). `home.php` shows your posts page, whether it's on the front page, or assigned to another page when using a static front page. If you want your `...
64,701
<p>Need help with a wordpress-task</p> <p>I want ALL the posts from sub categories to be excluded.</p> <p>Example:</p> <ul> <li>Cake <ul> <li>Pie <ul> <li>Apple</li> <li>Pear</li> <li>Banana</li> </ul></li> </ul></li> </ul> <p>If i post a post in Banana, i don't want it to show up in Pie or Cake. I just want posts ...
[ { "answer_id": 78688, "author": "Dido Kotsev", "author_id": 25576, "author_profile": "https://wordpress.stackexchange.com/users/25576", "pm_score": 0, "selected": false, "text": "<p>I cannot test it right now, but you can try with this code:</p>\n\n<pre><code>$current_cat = intval( get_q...
2012/09/10
[ "https://wordpress.stackexchange.com/questions/64701", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20246/" ]
Need help with a wordpress-task I want ALL the posts from sub categories to be excluded. Example: * Cake + Pie - Apple - Pear - Banana If i post a post in Banana, i don't want it to show up in Pie or Cake. I just want posts that are posted in banana to show in banana, not in the top categories. How can i do...
Don't change your template, and please do **not** use `query_posts`. Add this to your `function.php`: ``` add_action('pre_get_posts', 'filter_out_children'); function filter_out_children( $query ) { if ( is_main_query() && is_category() && ! is_admin() ) { $qo = $query->get_queried_object(); $tax_query =...
64,702
<p>I'm working on a theme that uses a slider to display blog posts. Beneath the slider is a pagination that displays like a timeline, with a date instead of a page number, calling the corresponding blog post. I want to display the comments for each post, but outside the slider. So, I have this code in my header, to get...
[ { "answer_id": 64705, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>Your PHP file isn't loaded in the context of the WordPress environment, so you don't have access to any WordPress f...
2012/09/10
[ "https://wordpress.stackexchange.com/questions/64702", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15662/" ]
I'm working on a theme that uses a slider to display blog posts. Beneath the slider is a pagination that displays like a timeline, with a date instead of a page number, calling the corresponding blog post. I want to display the comments for each post, but outside the slider. So, I have this code in my header, to get th...
Aha, I think my syntax was wrong. I changed: ``` action: 'do_ajax', data: { 'post_id' : '72' //using a post id that I *know* has comments, for testing! }, ``` to: ``` data: { 'action' : 'do_ajax', 'post_id' : '72' }, ``` and I'm getting the correct response from the `console.log` which shows: ```...
64,725
<p>I'm using gravity forms for a sign-up form and I set up a hidden field that is automatically filled with a random string generated and passed to the form by</p> <pre><code>add_filter("gform_field_value_random_number", "generate_random_number"); function generate_random_number($value){ $value = substr(str_shu...
[ { "answer_id": 64705, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>Your PHP file isn't loaded in the context of the WordPress environment, so you don't have access to any WordPress f...
2012/09/10
[ "https://wordpress.stackexchange.com/questions/64725", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20254/" ]
I'm using gravity forms for a sign-up form and I set up a hidden field that is automatically filled with a random string generated and passed to the form by ``` add_filter("gform_field_value_random_number", "generate_random_number"); function generate_random_number($value){ $value = substr(str_shuffle(str_repea...
Aha, I think my syntax was wrong. I changed: ``` action: 'do_ajax', data: { 'post_id' : '72' //using a post id that I *know* has comments, for testing! }, ``` to: ``` data: { 'action' : 'do_ajax', 'post_id' : '72' }, ``` and I'm getting the correct response from the `console.log` which shows: ```...
64,731
<p>I'm looking add-in a bit more speficity to the WP Cron intervals. To add a "weekly" interval, I've done the following:</p> <pre><code>function re_not_add_weekly( $schedules ) { $schedules['weekly'] = array( 'interval' =&gt; 604800, //that's how many seconds in a week, for the unix timestamp 'dis...
[ { "answer_id": 64742, "author": "Damien", "author_id": 17132, "author_profile": "https://wordpress.stackexchange.com/users/17132", "pm_score": 0, "selected": false, "text": "<p>According to <a href=\"http://codex.wordpress.org/Function_Reference/wp_get_schedules\" rel=\"nofollow\">Codex ...
2012/09/10
[ "https://wordpress.stackexchange.com/questions/64731", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9605/" ]
I'm looking add-in a bit more speficity to the WP Cron intervals. To add a "weekly" interval, I've done the following: ``` function re_not_add_weekly( $schedules ) { $schedules['weekly'] = array( 'interval' => 604800, //that's how many seconds in a week, for the unix timestamp 'display' => __('week...
WP-Cron is not intended to be that precise, and should not be used if you have to have things scheduled at specific times. WP-Cron is a "best effort" scheduling mechanism, and it cannot guarantee run timing like a real cron system can. If you need precision of this nature, the only real answer is to not use WP-Cron fo...
64,763
<p>I am using this big theme that is almost entirely relying on widgets and sliders. Now I trying to avoid looking for <code>post_thumbnail</code> output code in all the included files in order to achieve fallback which should then grab first image in post or at last display default image.</p> <p>Is there a way of con...
[ { "answer_id": 64813, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": true, "text": "<p>you can use the <code>post_thumbnail_html</code> filter hook which passes 5 variables to your hooked function ...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64763", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13434/" ]
I am using this big theme that is almost entirely relying on widgets and sliders. Now I trying to avoid looking for `post_thumbnail` output code in all the included files in order to achieve fallback which should then grab first image in post or at last display default image. Is there a way of controlling this via `fu...
you can use the `post_thumbnail_html` filter hook which passes 5 variables to your hooked function : * `$html` - the Output html of the post thumbnail * `$post_id` - the post ID. * `$post_thumbnail_id` - the attachment id of the image * `$size` - the size requested or default * `$attr` - Query string or array of attri...
64,784
<p>I'm creating a Wordpress site with a Superfish CSS3 / Jquery dropdown menu, complete with hoverIntent as displayed here:</p> <p><a href="http://users.tpg.com.au/j_birch/plugins/superfish/#examples" rel="nofollow">http://users.tpg.com.au/j_birch/plugins/superfish/#examples</a></p> <p>As far as I can see, this menu ...
[ { "answer_id": 64813, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": true, "text": "<p>you can use the <code>post_thumbnail_html</code> filter hook which passes 5 variables to your hooked function ...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64784", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9838/" ]
I'm creating a Wordpress site with a Superfish CSS3 / Jquery dropdown menu, complete with hoverIntent as displayed here: <http://users.tpg.com.au/j_birch/plugins/superfish/#examples> As far as I can see, this menu works well on mobile devices, because the link values refer to the same page, like `#a`, so that clickin...
you can use the `post_thumbnail_html` filter hook which passes 5 variables to your hooked function : * `$html` - the Output html of the post thumbnail * `$post_id` - the post ID. * `$post_thumbnail_id` - the attachment id of the image * `$size` - the size requested or default * `$attr` - Query string or array of attri...
64,793
<p>I'm using an if/else control structure to add class attributes to tags. Could I use a switch control structure instead and if so, how? If not, is there a better way to do this than what I'm doing?</p> <pre><code>&lt;div &lt;?php if (is_page( 'project' )) { echo 'class="project"'; } elseif (is_page('home')) ...
[ { "answer_id": 64842, "author": "Ben HartLenn", "author_id": 6645, "author_profile": "https://wordpress.stackexchange.com/users/6645", "pm_score": 2, "selected": false, "text": "<p>Ok, now we have something to work with.</p>\n\n<pre><code>switch($post-&gt;post_name)\n{\n case \"projec...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64793", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16352/" ]
I'm using an if/else control structure to add class attributes to tags. Could I use a switch control structure instead and if so, how? If not, is there a better way to do this than what I'm doing? ``` <div <?php if (is_page( 'project' )) { echo 'class="project"'; } elseif (is_page('home')) {echo 'class="home"'...
While Ben's answer is basically correct, is\_page also checks to make sure that the query is indeed a Page and not something else with the same post\_name. So to be 100% accurate, you could do something like this: ``` if ( is_page() ) { // only do this for actual pages $page_obj = get_queried_object(); switch ( $...
64,818
<p>In my Wordpress site I have a hack that looks at the uri and does a redirect to a subdomain. The problem is <code>wp_redirect</code> calls <code>wp_sanitize_redirect</code> which will strip out <code>@</code> signs, so when a user tries to load something like</p> <pre><code>oursite.com?email=foo@bar.com </code></pr...
[ { "answer_id": 64820, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p><strong>Question</strong> why does <code>wp_sanitize_redirect</code> strip out <code>@</code> signs,...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64818", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8123/" ]
In my Wordpress site I have a hack that looks at the uri and does a redirect to a subdomain. The problem is `wp_redirect` calls `wp_sanitize_redirect` which will strip out `@` signs, so when a user tries to load something like ``` oursite.com?email=foo@bar.com ``` The page that gets loaded should be ``` prefix.our...
> > **Question** why does `wp_sanitize_redirect` strip out `@` signs, exactly? Anybody could anyway try to load a url with an `@` sign in it - is there some security issue I'm not thinking about? > > > Just take a look at the source: ``` function wp_sanitize_redirect($location) { $location = preg_replace('|[^...
64,822
<p>In a plugin, I want to provide a function for users to set the default query in their templates, so they can use some custom loops. What would be the best way of doing it?</p> <p>I imagine something like this:</p> <pre><code>my_plugin_set_query(); if ( have_posts() ) { while ( have_posts() ) { the_post...
[ { "answer_id": 64820, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p><strong>Question</strong> why does <code>wp_sanitize_redirect</code> strip out <code>@</code> signs,...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64822", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7385/" ]
In a plugin, I want to provide a function for users to set the default query in their templates, so they can use some custom loops. What would be the best way of doing it? I imagine something like this: ``` my_plugin_set_query(); if ( have_posts() ) { while ( have_posts() ) { the_post(); ... itera...
> > **Question** why does `wp_sanitize_redirect` strip out `@` signs, exactly? Anybody could anyway try to load a url with an `@` sign in it - is there some security issue I'm not thinking about? > > > Just take a look at the source: ``` function wp_sanitize_redirect($location) { $location = preg_replace('|[^...
64,827
<p>I have a site using a static homepage, and a posts page called Press(<code>press.php</code>). The template is being pulled up correctly, however no posts are shown. Any ideas why? Thanks in advance.</p> <p><a href="http://parlourdc.com/press" rel="nofollow">Live site.</a></p> <p><strong>press.php</strong></p> <p...
[ { "answer_id": 64820, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p><strong>Question</strong> why does <code>wp_sanitize_redirect</code> strip out <code>@</code> signs,...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64827", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14606/" ]
I have a site using a static homepage, and a posts page called Press(`press.php`). The template is being pulled up correctly, however no posts are shown. Any ideas why? Thanks in advance. [Live site.](http://parlourdc.com/press) **press.php** ``` <?php /* Template Name: Press */ ?> <?php get_header(); ?> <div id=...
> > **Question** why does `wp_sanitize_redirect` strip out `@` signs, exactly? Anybody could anyway try to load a url with an `@` sign in it - is there some security issue I'm not thinking about? > > > Just take a look at the source: ``` function wp_sanitize_redirect($location) { $location = preg_replace('|[^...
64,839
<p>Is it possible to load site comments on-demand instead of having them always display at the bottom of the post? Like by clicking on <kbd>Load Comments...</kbd>. </p> <p>You can check <strong><a href="http://www.labnol.org/" rel="nofollow">labnol.org</a></strong>. They are using Disqus comment system which loads by ...
[ { "answer_id": 64851, "author": "Douglas.Sesar", "author_id": 19945, "author_profile": "https://wordpress.stackexchange.com/users/19945", "pm_score": 2, "selected": true, "text": "<p>You could try an easy jQuery approach of hiding the comments div and inserting a button to make it appear...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64839", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19942/" ]
Is it possible to load site comments on-demand instead of having them always display at the bottom of the post? Like by clicking on `Load Comments...`. You can check **[labnol.org](http://www.labnol.org/)**. They are using Disqus comment system which loads by clicking. How could I achieve that?
You could try an easy jQuery approach of hiding the comments div and inserting a button to make it appear. Instructions: In your functions.php file of your theme, place this line of code to ensure that jQuery has been included to run the code: ``` wp_enqueue_script('jquery'); ``` Then you could add this function t...
64,854
<p>I need the terms in my tax_query to be the ones from the current post. I am trying to this by using a variable. The value of the variable is given by using the get_terms() function.</p> <p>The problem is that it is not returning anything. It does however return the correct posts when I manually put the terms in the...
[ { "answer_id": 64885, "author": "westondeboer", "author_id": 2691, "author_profile": "https://wordpress.stackexchange.com/users/2691", "pm_score": 0, "selected": false, "text": "<pre><code>$tags1 = wp_get_post_terms($post-&gt;ID, 'b');\n</code></pre>\n\n<p>Is what you are looking for? It...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64854", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20297/" ]
I need the terms in my tax\_query to be the ones from the current post. I am trying to this by using a variable. The value of the variable is given by using the get\_terms() function. The problem is that it is not returning anything. It does however return the correct posts when I manually put the terms in the array. ...
'terms' => array('$tags1'), Remove the single quotes and it should look like 'terms' => array($tags1) OR 'terms' => $tags1 No need to make it an array, if you are using just one value.
64,861
<p>We're working on this site: <a href="http://granthammond.staging.wpengine.com/" rel="nofollow">http://granthammond.staging.wpengine.com/</a> which will no longer be using tags, i need a way to strip / remove all the tag links in the post content, for example: any hyperlinks containing <code>/tag/</code> need to go...
[ { "answer_id": 64862, "author": "FlashingCursor", "author_id": 9276, "author_profile": "https://wordpress.stackexchange.com/users/9276", "pm_score": 0, "selected": false, "text": "<p>To your themes functions.php file, add the following:</p>\n\n<pre><code>add_filter( 'the_tags', 'remove_l...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64861", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14466/" ]
We're working on this site: <http://granthammond.staging.wpengine.com/> which will no longer be using tags, i need a way to strip / remove all the tag links in the post content, for example: any hyperlinks containing `/tag/` need to go, in their entirety, ``` <a href="http://www.granthammond.com/tag/nashville-real-...
1) For existing post content, you can add a filter to `the_content` to remove them from the output before they are seen by a user: ``` function remove_tag_links( $content ) { return preg_replace( '#<a [^>]*\bhref=\\\?"[^"]+(?=/tag/)[^"]+\\\?"[^>]*>(.+?)</a>#si', '$1', $content ); } add_filter( 'the_content', 'remo...
64,873
<p>I'm working on a site wherein the owner wants people(potential real estate clients) to be able to write their home-owning hopes, dreams, desires, etc. I'm thinking something similar to the functionality of comments, like a live-feed testimonials page?</p> <p>My question is how do I facilitate this? I'm not too conc...
[ { "answer_id": 64862, "author": "FlashingCursor", "author_id": 9276, "author_profile": "https://wordpress.stackexchange.com/users/9276", "pm_score": 0, "selected": false, "text": "<p>To your themes functions.php file, add the following:</p>\n\n<pre><code>add_filter( 'the_tags', 'remove_l...
2012/09/11
[ "https://wordpress.stackexchange.com/questions/64873", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14606/" ]
I'm working on a site wherein the owner wants people(potential real estate clients) to be able to write their home-owning hopes, dreams, desires, etc. I'm thinking something similar to the functionality of comments, like a live-feed testimonials page? My question is how do I facilitate this? I'm not too concerned with...
1) For existing post content, you can add a filter to `the_content` to remove them from the output before they are seen by a user: ``` function remove_tag_links( $content ) { return preg_replace( '#<a [^>]*\bhref=\\\?"[^"]+(?=/tag/)[^"]+\\\?"[^>]*>(.+?)</a>#si', '$1', $content ); } add_filter( 'the_content', 'remo...
64,910
<p>WP recently_edited option can be very useful - it tracks last 5 files that you've made changes to. Only problem is - well, that's all, 5 files.</p> <p>What if I've been made numerous changes to Wordpress theme files by using default WP admin editor?</p> <p>It would be helpfull if I had list of, say last 20 files e...
[ { "answer_id": 64913, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": true, "text": "<p>The function is <code>update_recently_edited</code> in <code>wp-admin/includes/misc.php</code>. unfortunately it is ...
2012/09/12
[ "https://wordpress.stackexchange.com/questions/64910", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20317/" ]
WP recently\_edited option can be very useful - it tracks last 5 files that you've made changes to. Only problem is - well, that's all, 5 files. What if I've been made numerous changes to Wordpress theme files by using default WP admin editor? It would be helpfull if I had list of, say last 20 files edited and time w...
The function is `update_recently_edited` in `wp-admin/includes/misc.php`. unfortunately it is fixed at 5: ``` function update_recently_edited( $file ) { $oldfiles = (array) get_option( 'recently_edited' ); if ( $oldfiles ) { $oldfiles = array_reverse( $oldfiles ); $oldfiles[] = $file; $...
64,918
<p>The loop below works fine, apart from the fact that the pagination will always stop on page 6. No matter what arguments i specify, it will never show more than 6 pages. </p> <p>Does anyone know why?</p> <pre><code>&lt;?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $idxarg...
[ { "answer_id": 64923, "author": "Ciprian", "author_id": 7349, "author_profile": "https://wordpress.stackexchange.com/users/7349", "pm_score": 0, "selected": false, "text": "<p>How many posts per page have you specified inside your Settings -> Reading screen?</p>\n\n<p>Also, try placing a...
2012/09/12
[ "https://wordpress.stackexchange.com/questions/64918", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1778/" ]
The loop below works fine, apart from the fact that the pagination will always stop on page 6. No matter what arguments i specify, it will never show more than 6 pages. Does anyone know why? ``` <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $idxargs = array( 'post...
Trying to use pagination from a different query is always fraught with potential disaster. `next_posts_link` accepts a second argument, `$max_pages`, which may solve your issue if you pass it properly: ``` next_posts_link( __( 'Next'), $idxloop->max_num_pages ); ``` However, the *real* answer to this question is to ...
64,939
<p>I´m trying to find a snippet to add a predefined custom field. Does anyone know how or where i can find this?</p> <p>I know I can do this with CustomPress, but I´m trying to do this without a plugin.</p>
[ { "answer_id": 64962, "author": "Douglas.Sesar", "author_id": 19945, "author_profile": "https://wordpress.stackexchange.com/users/19945", "pm_score": 2, "selected": false, "text": "<p>Take a look at adding a custom meta box for any type of predefined meta field.</p>\n\n<p><a href=\"http:...
2012/09/12
[ "https://wordpress.stackexchange.com/questions/64939", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12727/" ]
I´m trying to find a snippet to add a predefined custom field. Does anyone know how or where i can find this? I know I can do this with CustomPress, but I´m trying to do this without a plugin.
Take a look at adding a custom meta box for any type of predefined meta field. [add\_meta\_box - Docs - WordPress](http://codex.wordpress.org/Function_Reference/add_meta_box) You will need to add a hook to the 'save\_post' action in order to save the meta data also. Here is a quick and simple version: ``` add_a...
64,950
<p>How can I apply <code>pre_get_posts</code> to a custom query?</p> <p>For example, if I have:</p> <pre><code>$custom_query = new WP_Query(...) //code here </code></pre> <p>How can I apply the <code>pre_get_posts</code> for this <code>$custom_query</code>?</p>
[ { "answer_id": 64972, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 0, "selected": false, "text": "<h2>pre_get_posts fires for every post query.</h2>\n<p>There is really no reason to apply it to a specific custom que...
2012/09/12
[ "https://wordpress.stackexchange.com/questions/64950", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20286/" ]
How can I apply `pre_get_posts` to a custom query? For example, if I have: ``` $custom_query = new WP_Query(...) //code here ``` How can I apply the `pre_get_posts` for this `$custom_query`?
For some use cases, couldn't you use `$query->get()` to target specific custom queries? For example: say you've got a custom query for a `slider` post-type. Perhaps something like this? ``` function wpse64950_filter_pre_get_posts( $query ) { if ( ! is_main_query() ) { if ( 'slider' == $query->get( 'post_t...
64,967
<p>I am working on a plugin that requires on-the-fly manipulation of content output. This is solely dependent on the current <code>$_GET</code> variable or <code>$_REQUEST</code> variable.</p> <p>Depending on what the variable is set to, it will call a certain class method to handle the user's request and display the ...
[ { "answer_id": 64969, "author": "Ciprian", "author_id": 7349, "author_profile": "https://wordpress.stackexchange.com/users/7349", "pm_score": 0, "selected": false, "text": "<p>I'd recommend using <code>mysql_real_escape_string($_GET)</code> on any GET request. It's a very powerful PHP fe...
2012/09/12
[ "https://wordpress.stackexchange.com/questions/64967", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9579/" ]
I am working on a plugin that requires on-the-fly manipulation of content output. This is solely dependent on the current `$_GET` variable or `$_REQUEST` variable. Depending on what the variable is set to, it will call a certain class method to handle the user's request and display the proper content. I am fully awar...
WordPress doesn't provide any specific data validation functions for SUPERGLOBALS. ---------------------------------------------------------------------------------- ### I use the PHP [filter\_input](http://php.net/manual/en/function.filter-input.php) function then escape it as I would any untrusted variable. ``` $ur...
64,968
<p>When I use the settings API in a multisite installation and the options page sits at the network level, posting the options to <code>options.php</code> does not work, because the administration page sits at <code>wp-admin/network</code> and WP expects the page to be at <code>wp-admin</code>.</p> <p>I added a functi...
[ { "answer_id": 72503, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 5, "selected": true, "text": "<p>For network option pages the correct form action URL is:</p>\n\n<pre><code>wp-admin/network/edit.php?action=your_option...
2012/09/12
[ "https://wordpress.stackexchange.com/questions/64968", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14656/" ]
When I use the settings API in a multisite installation and the options page sits at the network level, posting the options to `options.php` does not work, because the administration page sits at `wp-admin/network` and WP expects the page to be at `wp-admin`. I added a function that checks whether this WP installation...
For network option pages the correct form action URL is: ``` wp-admin/network/edit.php?action=your_option_name ``` Then you have to register a callback: ``` add_action( 'network_admin_edit_your_option_name', 'your_save_network_options_function' ); ``` In that callback function inspect the `$_POST` data...
64,988
<p>The question says it all, I think. I'd like to create a new submenu page using edit.php which will only display pages which use a certain template file (or files). </p> <p>Possible? </p>
[ { "answer_id": 65155, "author": "lancemonotone", "author_id": 20344, "author_profile": "https://wordpress.stackexchange.com/users/20344", "pm_score": 0, "selected": false, "text": "<pre><code> add_action('admin_menu','add_home_page_menu');\n add_action('load-edit.php', 'filter_home...
2012/09/12
[ "https://wordpress.stackexchange.com/questions/64988", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20344/" ]
The question says it all, I think. I'd like to create a new submenu page using edit.php which will only display pages which use a certain template file (or files). Possible?
Try this: ``` <?php // add submenu page add_action('admin_menu', 'add_template_submenu'); function add_template_submenu() { add_pages_page( 'My Template', 'My Template', 'edit_pages', 'edit.php?post_type=page&template=your-template-file.php'); } // check for the template name passed in $_GET and add it to the...
65,013
<p>In my theme, I'd like to display the publish date and (only) if the post was updated after the publish date, also display the updated date. The code in my theme now looks like this:</p> <pre><code>*/ stuff above here to display publish date, then do this stuff to see if updated */ if ( get_the_date() != get_the_mo...
[ { "answer_id": 65025, "author": "Ben HartLenn", "author_id": 6645, "author_profile": "https://wordpress.stackexchange.com/users/6645", "pm_score": 3, "selected": true, "text": "<p>get_the_date() and get_modified_date() don't return time values: so, if you change your conditional statemen...
2012/09/13
[ "https://wordpress.stackexchange.com/questions/65013", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/507/" ]
In my theme, I'd like to display the publish date and (only) if the post was updated after the publish date, also display the updated date. The code in my theme now looks like this: ``` */ stuff above here to display publish date, then do this stuff to see if updated */ if ( get_the_date() != get_the_modified_date() )...
get\_the\_date() and get\_modified\_date() don't return time values: so, if you change your conditional statement to the below, it should work: ``` if ( get_the_modified_date() > get_the_date() ) { ... } ``` Now if the updated date is greater than the original publish date(by one day), the if statement is true.
65,015
<p>I need a second set of eyes, because its late and I can't see this anymore. </p> <p>Why won't this save? What am I missing? </p> <pre><code>add_action("admin_menu", "tf_book_stuff_create"); function tf_book_stuff_create(){ add_meta_box('tf_book_stuff', 'Book Stuff', 'tf_book_stuff', 'books'); } function tf_b...
[ { "answer_id": 65025, "author": "Ben HartLenn", "author_id": 6645, "author_profile": "https://wordpress.stackexchange.com/users/6645", "pm_score": 3, "selected": true, "text": "<p>get_the_date() and get_modified_date() don't return time values: so, if you change your conditional statemen...
2012/09/13
[ "https://wordpress.stackexchange.com/questions/65015", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8574/" ]
I need a second set of eyes, because its late and I can't see this anymore. Why won't this save? What am I missing? ``` add_action("admin_menu", "tf_book_stuff_create"); function tf_book_stuff_create(){ add_meta_box('tf_book_stuff', 'Book Stuff', 'tf_book_stuff', 'books'); } function tf_book_stuff() { glo...
get\_the\_date() and get\_modified\_date() don't return time values: so, if you change your conditional statement to the below, it should work: ``` if ( get_the_modified_date() > get_the_date() ) { ... } ``` Now if the updated date is greater than the original publish date(by one day), the if statement is true.
65,059
<p>I use the following code in functions.php in order to obtain all the images attached to a post so I can retrieve them via AJAX.</p> <pre><code>&lt;?php function get_all_images($post_id=0, $size='bigger', $attributes='') { $post_id = $_POST['post_id']; if ($post_id&lt;1) $postid = get_the_ID(); if ($imag...
[ { "answer_id": 65054, "author": "bryceadams", "author_id": 14895, "author_profile": "https://wordpress.stackexchange.com/users/14895", "pm_score": -1, "selected": false, "text": "<p>Go back to the old install. After you exported the SQL database, open it up in any text editor and do a \"...
2012/09/13
[ "https://wordpress.stackexchange.com/questions/65059", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7838/" ]
I use the following code in functions.php in order to obtain all the images attached to a post so I can retrieve them via AJAX. ``` <?php function get_all_images($post_id=0, $size='bigger', $attributes='') { $post_id = $_POST['post_id']; if ($post_id<1) $postid = get_the_ID(); if ($images = get_children(ar...
Use the script found here: <https://interconnectit.com/products/search-and-replace-for-wordpress-databases/> Because WordPress [serializes](http://nl.php.net/serialize) some urls in option and meta tables a simple replace won't do. A siple replace will break your data. This script will preserve your data and r...
65,060
<p>I have a multsite installation with canonical setup like <code>site1.domain.com</code> and <code>site2.domain.com</code> etc. How do I change the default root site from site <code>1</code> to site <code>2</code>?</p> <p>I tried to change these two values in <code>wp-config</code> to <code>5</code> instead of <code>...
[ { "answer_id": 65065, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<p>Go to Dashboard » My Sites and change the site in the drop down.</p>\n" }, { "answer_id": 65069, "autho...
2012/09/13
[ "https://wordpress.stackexchange.com/questions/65060", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13713/" ]
I have a multsite installation with canonical setup like `site1.domain.com` and `site2.domain.com` etc. How do I change the default root site from site `1` to site `2`? I tried to change these two values in `wp-config` to `5` instead of `1` and there was no effect: ``` define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BL...
Current site Id defines the primary network id. You can have more than one network if you use a [multi-network plugin](https://web.archive.org/web/20120908131024/http://wpebooks.com/networks/). Current blog id defines the primary blog within the primary network. To change the main blog to '2' (if you only have one netw...
65,068
<pre><code>http://69.89.31.200/~horologi/shop/ </code></pre> <p>I'm working on the site above and the client has requested that on the shop page, all the product information is displayed on that page, including all product thumbnails. I have copied the WooCommerce template files into my theme directory so I can modif...
[ { "answer_id": 65065, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<p>Go to Dashboard » My Sites and change the site in the drop down.</p>\n" }, { "answer_id": 65069, "autho...
2012/09/13
[ "https://wordpress.stackexchange.com/questions/65068", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19151/" ]
``` http://69.89.31.200/~horologi/shop/ ``` I'm working on the site above and the client has requested that on the shop page, all the product information is displayed on that page, including all product thumbnails. I have copied the WooCommerce template files into my theme directory so I can modify them, and have bee...
Current site Id defines the primary network id. You can have more than one network if you use a [multi-network plugin](https://web.archive.org/web/20120908131024/http://wpebooks.com/networks/). Current blog id defines the primary blog within the primary network. To change the main blog to '2' (if you only have one netw...
65,085
<p>I'm working on a plugin that changes the password requirements to be a bit stricter, however wherever there is a password field to create a password, WordPress' hints are now no longer accurate (e.g. Password must consists of seven characters).</p> <p>How can I replace those hints? Is there a filter/function that c...
[ { "answer_id": 65087, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 2, "selected": true, "text": "<p>You can filter <code>'gettext'</code>.</p>\n\n<p>Sample code, not tested:</p>\n\n<pre><code>add_filter( 'gettext', 'wps...
2012/09/13
[ "https://wordpress.stackexchange.com/questions/65085", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14656/" ]
I'm working on a plugin that changes the password requirements to be a bit stricter, however wherever there is a password field to create a password, WordPress' hints are now no longer accurate (e.g. Password must consists of seven characters). How can I replace those hints? Is there a filter/function that can help wi...
You can filter `'gettext'`. Sample code, not tested: ``` add_filter( 'gettext', 'wpse_65085_change_error_messages', 10, 3 ); function wpse_65085_change_error_messages( $translated, $text, domain ) { if ( 'default' !== $domain ) { return $translated; } switch( $text ) { case 'Hin...
65,111
<p>I haven't ever seen a tag such as <code>do_action('something_10')</code>. Is it invalid if I use numbers?</p> <p>If the method is valid, how can I write different numbers in the tag string conditionally? For example, is the following code correct($grade is the number)?</p> <pre><code>do_action("new_grade_$grade") ...
[ { "answer_id": 65112, "author": "Brian Fegter", "author_id": 4793, "author_profile": "https://wordpress.stackexchange.com/users/4793", "pm_score": 2, "selected": false, "text": "<p>Yes, you can dynamically create your own action hooks. WordPress has several dynamic hooks like <code>admin...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65111", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5210/" ]
I haven't ever seen a tag such as `do_action('something_10')`. Is it invalid if I use numbers? If the method is valid, how can I write different numbers in the tag string conditionally? For example, is the following code correct($grade is the number)? ``` do_action("new_grade_$grade") ```
1. When you "hook"/`add_action/*_filter('whatever');` a callback function to `do_action('whatever');`, then you basically add the function (or object-method) name to the `global $wp_filters`-array. 2. Doing so, you add the function/method name to an array that is built like the following ``` $wp_filter[ $tag ][ $prior...
65,115
<p>I am trying to use WordPress authentication on a custom PHP page however when checking "is_user_logged_in" it returns nothing at all and other functions are also returning nothing helpful.</p> <p>The code I am using is:</p> <pre><code>require $_SERVER['DOCUMENT_ROOT'] . "/wp-load.php"; require $_SERVER['DOCUMENT_R...
[ { "answer_id": 65118, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<h2>Is my global set up?</h2>\n\n<p>As you can see from taking a look at the »Help«-panel, when you're using my <a hre...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65115", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14014/" ]
I am trying to use WordPress authentication on a custom PHP page however when checking "is\_user\_logged\_in" it returns nothing at all and other functions are also returning nothing helpful. The code I am using is: ``` require $_SERVER['DOCUMENT_ROOT'] . "/wp-load.php"; require $_SERVER['DOCUMENT_ROOT'] . "/wp-blog-...
Is my global set up? -------------------- As you can see from taking a look at the »Help«-panel, when you're using my [»Current Admin Screen Info«](https://gist.github.com/3711215) 1), there're certain points/hooks/filters in code, that need to pass by before a global is set up. ![enter image description here](https:...
65,122
<p>I'm looking for some suggestions or tutorial links about how to create a meta box that allows users to choose from a list of link categories. So far I've been looking at <a href="http://wordpress.org/support/topic/terms-of-custom-taxonomy-in-a-dropdown-menu" rel="nofollow noreferrer">this post about taxonomies in a ...
[ { "answer_id": 65127, "author": "Brent", "author_id": 10972, "author_profile": "https://wordpress.stackexchange.com/users/10972", "pm_score": 0, "selected": false, "text": "<p>Ok, this took me a minute to realize what you were wanting to do, and to make sure that I understand it, I'm goi...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65122", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8574/" ]
I'm looking for some suggestions or tutorial links about how to create a meta box that allows users to choose from a list of link categories. So far I've been looking at [this post about taxonomies in a drop down](http://wordpress.org/support/topic/terms-of-custom-taxonomy-in-a-dropdown-menu) and [this post about an au...
Found the last bit. It was just a syntax error: ``` <?php selected( $selected, ".$term_id". ); ?> ``` Should be... ``` <?php selected( $selected, $term_id ); ?> ``` Entire Function: ``` function tf_book_deets_create(){ add_meta_box('tf_book_purchase', 'Book Purchase Links', 'tf_book_purchase', 'books','side','de...
65,136
<p>So here's my code, using the qTranslate plugin:</p> <pre><code> query_posts(array('post_type' =&gt; 'uk_blog', 'numberposts' =&gt; 2)); $i = 0; while(have_posts()): the_post($post);?&gt; &lt;div class="third-column"&lt;?php if ($i == 1) echo ' style="margin-right:0;"';?&gt;&gt; &lt;h2&gt;&lt;a hr...
[ { "answer_id": 65368, "author": "Daniel Sachs", "author_id": 4451, "author_profile": "https://wordpress.stackexchange.com/users/4451", "pm_score": 1, "selected": false, "text": "<p>Try using </p>\n\n<pre><code>&lt;h2&gt;\n &lt;a href=\"&lt;?php get_permalink($post-&gt;ID);?&gt;\"&gt;\...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65136", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3570/" ]
So here's my code, using the qTranslate plugin: ``` query_posts(array('post_type' => 'uk_blog', 'numberposts' => 2)); $i = 0; while(have_posts()): the_post($post);?> <div class="third-column"<?php if ($i == 1) echo ' style="margin-right:0;"';?>> <h2><a href="<?php get_permalink($post->ID);?>"><?php...
I've experienced issues like this with qTranslate, and the first thing you should do definitely is to make sure that you are using `the_title()` or the `the_title` filter, as suggested by Daniel Sachs. Since your widget is already calling `the_title()` that's clearly not the case. On a few occasions (specifically whil...
65,137
<p>Is there a way to force users to write a page title before publishing? I have found example of requiring post titles, but not page titles.</p>
[ { "answer_id": 65274, "author": "hampusn", "author_id": 20373, "author_profile": "https://wordpress.stackexchange.com/users/20373", "pm_score": 4, "selected": true, "text": "<p>Start with downloading the plugin called <a href=\"http://wordpress.org/extend/plugins/force-post-title\" rel=\...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65137", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17400/" ]
Is there a way to force users to write a page title before publishing? I have found example of requiring post titles, but not page titles.
Start with downloading the plugin called [Force Post Title](http://wordpress.org/extend/plugins/force-post-title). Here's the plugin with one row (2 with the comment line) added to the bottom, based on our comments. What happens is that a small jQuery script is added to the page **Create Post/Page**. The script will ...
65,139
<p>I have the following shortcode in one of my pages</p> <pre><code>[[Intern: Termine/News]] </code></pre> <p>This works on a password protected sub page. Now I want that all news of the category Termine/News are on the parent page. So I put the code on the password protected parent page. Now the text is rendered - I...
[ { "answer_id": 65140, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 2, "selected": false, "text": "<p>This is invalid syntax. See shortcodes like HTML: </p>\n\n<ul>\n<li>Opening delimiter <code>[</code>, </li>\n<li>name ...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65139", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13921/" ]
I have the following shortcode in one of my pages ``` [[Intern: Termine/News]] ``` This works on a password protected sub page. Now I want that all news of the category Termine/News are on the parent page. So I put the code on the password protected parent page. Now the text is rendered - I only can see the shortcod...
This is invalid syntax. See shortcodes like HTML: * Opening delimiter `[`, * name `intern`, * empty space, * attribute name, * equal sign `=`, * attribute value (enclosed with quotes (`'` or `"`), * closing delimiter `]`. Doubled delimiters force the shortcode to be shown as it is, the shortcode handler [will not be...
65,146
<p>How can I exclude one specific post from a WP_Query query? (For example, show all posts apart from a post with the ID 278)</p> <p>I've tried the post__not_in argument but it just removes all posts..</p> <p>Any help would be great.</p> <p>Here is my current query</p> <pre><code>&lt;?php $temp = $wp_query; ...
[ { "answer_id": 65149, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 4, "selected": false, "text": "<p>You have to define the <code>post__not_in</code> arg as array. Even for a single value. And please don't overwrite ...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65146", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18547/" ]
How can I exclude one specific post from a WP\_Query query? (For example, show all posts apart from a post with the ID 278) I've tried the post\_\_not\_in argument but it just removes all posts.. Any help would be great. Here is my current query ``` <?php $temp = $wp_query; $wp_query= null; $wp_query = ...
I suppose this was heavy, but to answer your original question, I've collected all of the posts id's in an array in the first loop, and excluded those posts from the second loop using **'post\_\_not\_in'** which expects an array of post id's ``` <?php $args1 = array('category_name' => 'test-cat-1', 'order' => 'ASC'); ...
65,157
<p>How can I refresh the <code>wp-admin/edit.php</code> page after a user clicks <strong>Update</strong> in the <em>Quick-edit</em> form?</p>
[ { "answer_id": 65175, "author": "getWeberForStackExchange", "author_id": 5927, "author_profile": "https://wordpress.stackexchange.com/users/5927", "pm_score": 1, "selected": true, "text": "<p>I dug through WordPress' <code>wp-admin/js/inline-edit-post-dev.js</code> and found that there a...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65157", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5927/" ]
How can I refresh the `wp-admin/edit.php` page after a user clicks **Update** in the *Quick-edit* form?
I dug through WordPress' `wp-admin/js/inline-edit-post-dev.js` and found that there aren't any hooks for executing JS code after the quick-edit update. I decided to override the `inlineEditPost.save` function from `wp-admin/js/inline-edit-post-dev.js`, similar to [how WordPress recommends updating form data when the ...
65,176
<p>I want to create a search that does:</p> <ol> <li>Search within my custom taxonomy - custom-tags</li> <li>search the post title</li> <li>search select meta field ?? dont know</li> <li>search with custom post type - easy part</li> </ol> <p>I looked wordpress API but couldn't find any useful built in functions, i ...
[ { "answer_id": 65177, "author": "jessica", "author_id": 2659, "author_profile": "https://wordpress.stackexchange.com/users/2659", "pm_score": 1, "selected": false, "text": "<p>You can do everything you need using the search parameters allowed in <a href=\"http://codex.wordpress.org/Class...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65176", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20426/" ]
I want to create a search that does: 1. Search within my custom taxonomy - custom-tags 2. search the post title 3. search select meta field ?? dont know 4. search with custom post type - easy part I looked wordpress API but couldn't find any useful built in functions, i created a custom query below: there is bug here...
You can do everything you need using the search parameters allowed in [WP\_Query](http://codex.wordpress.org/Class_Reference/WP_Query) -- except searching in the post title only. In order to do that, see [this answer](https://wordpress.stackexchange.com/a/11826/2659). Make sure to look at the taxonomy and meta subquer...
65,178
<p>I have a custom post type called Books and a page structure like this:</p> <pre><code>Home Products &amp; Services - Services - Products -- Books </code></pre> <p>I am using Wordpress custom Menus for the 1st level navigation (displayed horizontally), and wp_list_pages to print out the subnavigation based on the p...
[ { "answer_id": 65181, "author": "Z. Zlatev", "author_id": 4192, "author_profile": "https://wordpress.stackexchange.com/users/4192", "pm_score": 1, "selected": false, "text": "<p>First thing that comes to mind is to use the built-in walker the Nav Menus use. That would be something like t...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65178", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12495/" ]
I have a custom post type called Books and a page structure like this: ``` Home Products & Services - Services - Products -- Books ``` I am using Wordpress custom Menus for the 1st level navigation (displayed horizontally), and wp\_list\_pages to print out the subnavigation based on the page selected from the 1st le...
You can add a custom class via the [`nav_menu_css_class`](http://codex.wordpress.org/Plugin_API/Filter_Reference/nav_menu_css_class) filter, like so: ``` function wpa_65178_nav_class( $classes, $item ) { if( is_singular('book') && $item->title == 'Products & Services' ) { $classes[] = 'current_page_anc...
65,183
<p>If I understand <code>is_single()</code> correctly, it's only supposed to return <code>true</code> when the current "post" (in a generic sense) is a literal post (i.e., it has a <code>post_type</code> of <code>post</code>), and that it will return <code>false</code> when the current "post" is a page, attachment, etc...
[ { "answer_id": 65185, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p>The Codex page for <code>is_single</code> should be updated, what you're seeing is correct behavior. According to t...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65183", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20428/" ]
If I understand `is_single()` correctly, it's only supposed to return `true` when the current "post" (in a generic sense) is a literal post (i.e., it has a `post_type` of `post`), and that it will return `false` when the current "post" is a page, attachment, etc. This is what the Codex says: ``` is_single() returns tr...
The Codex page for `is_single` should be updated, what you're seeing is correct behavior. According to the main [Conditional Tags](http://codex.wordpress.org/Conditional_Tags#A_Single_Post_Page) Codex page: > > **is\_single()** > > > When any single Post (**or attachment**, or custom Post Type) page is being displa...
65,190
<p>I want to display a message when the user try to activate my plugin. This message will ask if him really wants to activate the plugin or, if him change his mind, cancel the activation. How can I accomplish that? This is the code for the warning message just for reference.</p> <p>--- UPDATED CODE ---</p> <pre><code...
[ { "answer_id": 65199, "author": "Brian Fegter", "author_id": 4793, "author_profile": "https://wordpress.stackexchange.com/users/4793", "pm_score": 1, "selected": false, "text": "<p>You need to create two distinctions <em>activated</em> and <em>enabled</em>. You <strong>HAVE TO</strong> h...
2012/09/14
[ "https://wordpress.stackexchange.com/questions/65190", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17098/" ]
I want to display a message when the user try to activate my plugin. This message will ask if him really wants to activate the plugin or, if him change his mind, cancel the activation. How can I accomplish that? This is the code for the warning message just for reference. --- UPDATED CODE --- ``` register_activation_...
You can read more about the details of [activation on this answer](https://wordpress.stackexchange.com/questions/25910/uninstall-activate-deactivate-a-plugin-typical-features-how-to/25979#25979). Basically you need to hook a function to [`register_activation_hook()`](http://queryposts.com/function/register_activation_...
65,217
<p>I'm using allot of custom queries, and qtranslate. Qtranslate works with everything that has home url in it. But for posts /thumb permalinks if I change language to Russian for example links remain default language specific.</p> <p>So if I'm browsing /ru/ links on that page lack /ru/ so I get redirected back to def...
[ { "answer_id": 65223, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>I figured it out.</p>\n\n<p>For the reference problem was links in custom post types. As it appears Qtranslate in ...
2012/09/15
[ "https://wordpress.stackexchange.com/questions/65217", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm using allot of custom queries, and qtranslate. Qtranslate works with everything that has home url in it. But for posts /thumb permalinks if I change language to Russian for example links remain default language specific. So if I'm browsing /ru/ links on that page lack /ru/ so I get redirected back to default langu...
I figured it out. For the reference problem was links in custom post types. As it appears Qtranslate in its current iteration doesn't support custom post types. And the\_permalink or get\_permalink will not change to current lang as you switch them. Solution was very simple. Just include this in functions.php file o...
65,220
<p>i have this code.</p> <pre><code>&lt;?php add_action('add_meta_boxes', 'ct_meta_add'); add_action('save_post','ct_meta_save'); add_action('save_post','ct_parent'); // add meta functions function ct_meta_add() { add_meta_box( 'ct_chap', //id 'Thông tin chương', //title 'ct_meta_show', //c...
[ { "answer_id": 65223, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>I figured it out.</p>\n\n<p>For the reference problem was links in custom post types. As it appears Qtranslate in ...
2012/09/15
[ "https://wordpress.stackexchange.com/questions/65220", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20245/" ]
i have this code. ``` <?php add_action('add_meta_boxes', 'ct_meta_add'); add_action('save_post','ct_meta_save'); add_action('save_post','ct_parent'); // add meta functions function ct_meta_add() { add_meta_box( 'ct_chap', //id 'Thông tin chương', //title 'ct_meta_show', //callback function ...
I figured it out. For the reference problem was links in custom post types. As it appears Qtranslate in its current iteration doesn't support custom post types. And the\_permalink or get\_permalink will not change to current lang as you switch them. Solution was very simple. Just include this in functions.php file o...
65,222
<p>I've been looking for function about post views count. I found this simple functions using update and get post meta.</p> <pre><code>function setPostViews($postID) { $count_key = 'views'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($post...
[ { "answer_id": 65228, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 4, "selected": true, "text": "<p>A very basic solution would be to use the <a href=\"http://codex.wordpress.org/Transients_API\" rel=\"noreferrer\"...
2012/09/15
[ "https://wordpress.stackexchange.com/questions/65222", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16596/" ]
I've been looking for function about post views count. I found this simple functions using update and get post meta. ``` function setPostViews($postID) { $count_key = 'views'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key...
A very basic solution would be to use the [Transients API](http://codex.wordpress.org/Transients_API), an example... ``` function setPostViews($postID) { $user_ip = $_SERVER['REMOTE_ADDR']; //retrieve the current IP address of the visitor $key = $user_ip . 'x' . $postID; //combine post ID & IP to form unique ...
65,232
<p>I am trying to redirect all non-www to www URLs in my WordPress MultiSite install. I am using a simple <code>.htaccess</code> rule like this:</p> <pre><code># Redirect non-www to www: RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] </code></pre> <p>Normally this would ...
[ { "answer_id": 65234, "author": "Lalit Kaushik", "author_id": 20389, "author_profile": "https://wordpress.stackexchange.com/users/20389", "pm_score": 2, "selected": false, "text": "<p>login to admin and check go to <strong>General settings</strong></p>\n\n<p>check <strong>WordPress Addre...
2012/09/15
[ "https://wordpress.stackexchange.com/questions/65232", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17869/" ]
I am trying to redirect all non-www to www URLs in my WordPress MultiSite install. I am using a simple `.htaccess` rule like this: ``` # Redirect non-www to www: RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] ``` Normally this would work, however WordPress already seems...
Answer: Don't disable it, use it to do the redirection you want. * If you have a subdomain install, then you cannot do this at all, the www is a subdomain. * If you have a sub-directory install and want all the sites to be www, then edit your wp-config.php and change the DOMAIN\_CURRENT\_SITE to be your www domain. * ...
65,249
<p>I'd like to make a metabox with a name and a URL input on my custom post type.</p> <p>I want the result to show up in my content on my post. I have a movie review site. So for example I want it to look like this:</p> <blockquote> <p><strong>Mission Impossible 5 (2012)</strong></p> <p><em>Ethan Hunt is at it...
[ { "answer_id": 65269, "author": "bryceadams", "author_id": 14895, "author_profile": "https://wordpress.stackexchange.com/users/14895", "pm_score": 0, "selected": false, "text": "<p>There are two parts to what you need to do:</p>\n\n<ol>\n<li>Create the meta field (Youtube URL).</li>\n<li...
2012/09/15
[ "https://wordpress.stackexchange.com/questions/65249", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20454/" ]
I'd like to make a metabox with a name and a URL input on my custom post type. I want the result to show up in my content on my post. I have a movie review site. So for example I want it to look like this: > > **Mission Impossible 5 (2012)** > > > *Ethan Hunt is at it again, but this time it personal. The evil met...
Imho, the fastest way would be by using the [Meta Box Wrapper Class](http://www.deluxeblogtips.com/meta-box/), which is a plugin by now. Download and activate it. **Next in your functions.php add the following:** ``` $prefix = 'cheas_cool_metabox_'; global $meta_boxes; $meta_boxes = array(); $meta_boxes[] = array( ...
65,275
<p>I want to allow users to upload custom files to specific plugin directory. The problem is, obviously, that WP removes everything upon plugin version update. </p> <p>I think that the <code>upgrader_pre_install</code> and <code>upgrader_post_install</code> hooks may be useful, but unfortunately so far I wasn't able t...
[ { "answer_id": 65277, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 0, "selected": false, "text": "<p>The plugin directory cannot be used for uploads:</p>\n\n<ol>\n<li>You might not have write access here.</li>\n<li>It w...
2012/09/16
[ "https://wordpress.stackexchange.com/questions/65275", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4451/" ]
I want to allow users to upload custom files to specific plugin directory. The problem is, obviously, that WP removes everything upon plugin version update. I think that the `upgrader_pre_install` and `upgrader_post_install` hooks may be useful, but unfortunately so far I wasn't able to find any info to help me. In...
To answer my own question here is what I've found for the sake of keeping questions answered. What this does is copying the important directory before upgrade and recovering it after upgrade: ``` function my_dir_copy($source, $dest) { if (is_link($source)) { return symlink(readlink($source), $dest); } ...
65,300
<p>I want to make a force redirect for single.php to index so that it is never reachable by direct access (the site is built in a way that you retrieve all the content on the index page, still need to have this page available though because of an ajax function). I assume this is done in .htaccess?</p> <p>Edit: I need ...
[ { "answer_id": 65302, "author": "Lalit Kaushik", "author_id": 20389, "author_profile": "https://wordpress.stackexchange.com/users/20389", "pm_score": 3, "selected": true, "text": "<p>put this code in functions.php file</p>\n\n<pre><code>add_action('wp', 'myfun');\n function myfun(){ \n ...
2012/09/16
[ "https://wordpress.stackexchange.com/questions/65300", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3390/" ]
I want to make a force redirect for single.php to index so that it is never reachable by direct access (the site is built in a way that you retrieve all the content on the index page, still need to have this page available though because of an ajax function). I assume this is done in .htaccess? Edit: I need to be able...
put this code in functions.php file ``` add_action('wp', 'myfun'); function myfun(){ if(is_single()){ wp_redirect( home_url() ); exit; } } ``` hope this trick solve your problem. all the best ;)
65,334
<p>could anyone please tell me how to hide post metadata from home page? I would like to have them displayed only in post page.</p> <p>This is my website <a href="http://studyor.comuf.com" rel="nofollow">http://studyor.comuf.com</a> and the theme was made with artisteer</p> <p>Thanks!</p> <h2>Edit</h2> <p>Code copi...
[ { "answer_id": 65306, "author": "Damien", "author_id": 17132, "author_profile": "https://wordpress.stackexchange.com/users/17132", "pm_score": 1, "selected": true, "text": "<p>Just to help you out ... Wordpress and Magento are comparable as they are both PHP content management systems. H...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65334", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20488/" ]
could anyone please tell me how to hide post metadata from home page? I would like to have them displayed only in post page. This is my website <http://studyor.comuf.com> and the theme was made with artisteer Thanks! Edit ---- Code copied/pasted from below: ``` <?php get_header(); ?> <div class="art-layout-...
Just to help you out ... Wordpress and Magento are comparable as they are both PHP content management systems. However Magento doesn't compare to WooCommerce in the way you mention it above. For example: you may not need WordPress if you installed Magento. But you have to install WordPress to use WooCommerce. What ...
65,356
<p>In the footer i load the Google maps api. But only on the contact page, i used the google maps api. Now i want to make code. That the google maps api is only load in the contact template pages. How can i make that.</p> <p>This is the script tag in the footer.</p> <pre><code> &lt;script type="text/javascript" src="...
[ { "answer_id": 65358, "author": "janw", "author_id": 10911, "author_profile": "https://wordpress.stackexchange.com/users/10911", "pm_score": 0, "selected": false, "text": "<p>Javascript (and css) should be added with <a href=\"http://codex.wordpress.org/Function_Reference/wp_enqueue_scri...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65356", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17868/" ]
In the footer i load the Google maps api. But only on the contact page, i used the google maps api. Now i want to make code. That the google maps api is only load in the contact template pages. How can i make that. This is the script tag in the footer. ``` <script type="text/javascript" src="//maps.google.com/maps/a...
You've got [»Conditional Tags«](http://codex.wordpress.org/Conditional_Tags) in WordPress. Those allow you do determine if some condition meets or not (basically those are parts of the `$wp_query` object, just wrapped with a public API function). In detail: There's [`is_page()`](http://codex.wordpress.org/Function_Ref...
65,374
<p>hi guys im aqeel im trying to implement a slide show in a wordpress site's home page but it not working it simply contains the <code>easyslider1.5.js</code> file which i put in js folder css which of course in css folder. Then i used </p> <pre><code>wp_register_script( 'slides', get_bloginfo('template_url')."/js/ea...
[ { "answer_id": 65377, "author": "Lalit Kaushik", "author_id": 20389, "author_profile": "https://wordpress.stackexchange.com/users/20389", "pm_score": 0, "selected": false, "text": "<p>Put this code in current theme's functions.php file</p>\n\n<pre><code>add_action('wp_enqueue_scripts', '...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65374", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19278/" ]
hi guys im aqeel im trying to implement a slide show in a wordpress site's home page but it not working it simply contains the `easyslider1.5.js` file which i put in js folder css which of course in css folder. Then i used ``` wp_register_script( 'slides', get_bloginfo('template_url')."/js/easySlider1.5.js" ); wp_enq...
There's a reason, why one should use [the proper hook](http://wpdevel.wordpress.com/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/), which - in this case - is `wp_enqueue_scripts`. Then always keep in mind, that some plugins might require a dependency/are dependen...
65,380
<p>Is there a way to prevent the featured image from even showing up in a post's gallery? </p> <p>e.g. when editing the gallery in the admin for a post, the featured image isn't there.</p>
[ { "answer_id": 65382, "author": "janw", "author_id": 10911, "author_profile": "https://wordpress.stackexchange.com/users/10911", "pm_score": 0, "selected": false, "text": "<p>If you use the <a href=\"http://codex.wordpress.org/Gallery_Shortcode\" rel=\"nofollow\"><code>gallery</code> sho...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65380", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20058/" ]
Is there a way to prevent the featured image from even showing up in a post's gallery? e.g. when editing the gallery in the admin for a post, the featured image isn't there.
Okay, I had the same problem and just solved it by adding an "exclude" field to the shortcode. Like so... ``` [gallery link="file" columns="4" orderby="title" exclude="1050"] ``` You have to just pull the ID number of the file you don't want to show. This works without adding any functions or edits to the theme.
65,384
<p>I bought a theme from Themeforest and now I would like to convert it to a custom made theme. I was creating the theme with the Underscores theme: <a href="http://underscores.me/" rel="nofollow">http://underscores.me/</a> but how do I keep the same custom post types in the next theme?</p> <p>Is this less time consu...
[ { "answer_id": 65382, "author": "janw", "author_id": 10911, "author_profile": "https://wordpress.stackexchange.com/users/10911", "pm_score": 0, "selected": false, "text": "<p>If you use the <a href=\"http://codex.wordpress.org/Gallery_Shortcode\" rel=\"nofollow\"><code>gallery</code> sho...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65384", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15330/" ]
I bought a theme from Themeforest and now I would like to convert it to a custom made theme. I was creating the theme with the Underscores theme: <http://underscores.me/> but how do I keep the same custom post types in the next theme? Is this less time consuming than recoding the purchased theme?
Okay, I had the same problem and just solved it by adding an "exclude" field to the shortcode. Like so... ``` [gallery link="file" columns="4" orderby="title" exclude="1050"] ``` You have to just pull the ID number of the file you don't want to show. This works without adding any functions or edits to the theme.
65,389
<p>Is it possible to run an array to not show the first 6 posts, but then to show posts labeled 7-15 say?</p> <p>So that way I can display the first 6 posts elsewhere and then the rest somewhere else?</p> <p>More Information:</p> <p>I have a site here: <a href="http://universitycompare.com/student-info" rel="nofollo...
[ { "answer_id": 65382, "author": "janw", "author_id": 10911, "author_profile": "https://wordpress.stackexchange.com/users/10911", "pm_score": 0, "selected": false, "text": "<p>If you use the <a href=\"http://codex.wordpress.org/Gallery_Shortcode\" rel=\"nofollow\"><code>gallery</code> sho...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65389", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18026/" ]
Is it possible to run an array to not show the first 6 posts, but then to show posts labeled 7-15 say? So that way I can display the first 6 posts elsewhere and then the rest somewhere else? More Information: I have a site here: <http://universitycompare.com/student-info> and I would like the site to display the fir...
Okay, I had the same problem and just solved it by adding an "exclude" field to the shortcode. Like so... ``` [gallery link="file" columns="4" orderby="title" exclude="1050"] ``` You have to just pull the ID number of the file you don't want to show. This works without adding any functions or edits to the theme.
65,395
<p>When a user resets their password via the link in the password reset email, I know I can use the <code>password_reset</code> hook to get the user object and the new password. I want to validate the new password to ensure that the strength requirements are met, but I'm not sure on how to generate the error messages s...
[ { "answer_id": 65397, "author": "Kuldeep Daftary", "author_id": 20241, "author_profile": "https://wordpress.stackexchange.com/users/20241", "pm_score": -1, "selected": false, "text": "<p>I'm not 100% sure If I understood your question, but <a href=\"http://wordpress.org/extend/plugins/fo...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65395", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14656/" ]
When a user resets their password via the link in the password reset email, I know I can use the `password_reset` hook to get the user object and the new password. I want to validate the new password to ensure that the strength requirements are met, but I'm not sure on how to generate the error messages so that they di...
You can try using hook the `validate_password_reset` to validate password. Following code can be used to validate alphanumeric password. ``` add_action('validate_password_reset','wdm_validate_password_reset',10,2); function wdm_validate_password_reset( $errors, $user) { $exp = '/^(?=.*\d)((?=...
65,422
<p>I guess I need to know how to call meta data into metaboxes for beginners.</p> <p>I'm using </p> <pre><code>$posts = get_posts(array( 'post_type' =&gt; 'slidertype', 'post_status' =&gt; 'publish', 'posts_per_page' =&gt; -1, 'fields' =&gt; 'ids' ) ); //loop over eac...
[ { "answer_id": 65397, "author": "Kuldeep Daftary", "author_id": 20241, "author_profile": "https://wordpress.stackexchange.com/users/20241", "pm_score": -1, "selected": false, "text": "<p>I'm not 100% sure If I understood your question, but <a href=\"http://wordpress.org/extend/plugins/fo...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65422", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18726/" ]
I guess I need to know how to call meta data into metaboxes for beginners. I'm using ``` $posts = get_posts(array( 'post_type' => 'slidertype', 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids' ) ); //loop over each post foreach($posts as $p){...
You can try using hook the `validate_password_reset` to validate password. Following code can be used to validate alphanumeric password. ``` add_action('validate_password_reset','wdm_validate_password_reset',10,2); function wdm_validate_password_reset( $errors, $user) { $exp = '/^(?=.*\d)((?=...
65,428
<p>I wrote a simple function to get the contents in a folder (called templates) in my wordpress plugin, but am having problems getting the path to work (thus the function always dies). My question is: Is there a wordpress function or something that will give me the path to my plugin as required for the opendir functi...
[ { "answer_id": 65436, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 1, "selected": false, "text": "<p>Here is an example...</p>\n\n<pre><code> //..path/to/wp-content/plugins/your-plugin-basedir/\n $path = plugin_di...
2012/09/17
[ "https://wordpress.stackexchange.com/questions/65428", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18778/" ]
I wrote a simple function to get the contents in a folder (called templates) in my wordpress plugin, but am having problems getting the path to work (thus the function always dies). My question is: Is there a wordpress function or something that will give me the path to my plugin as required for the opendir function to...
Here is an example... ``` //..path/to/wp-content/plugins/your-plugin-basedir/ $path = plugin_dir_path( __FILE__); //..directory within your plugin $path .= 'templates'; //..continue with your script... $dir_handle = @opendir($path) or die("Cannot open the damn file $path"); ``` UPDATE ====...