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
121,194
<p>Im having a problem with my menu and custom post type.</p> <p>I have a custom post type of "services". I have created new page for it called Services. On that page Im displaying a list of all the post from that custom post type. The current-menu-item class is working as itended.</p> <p>But the problem is when I cl...
[ { "answer_id": 121199, "author": "Joey Yax", "author_id": 6148, "author_profile": "https://wordpress.stackexchange.com/users/6148", "pm_score": 4, "selected": true, "text": "<p>I usually include the following parent variable, filter and method in my plugins to account for this case. I've...
2013/11/04
[ "https://wordpress.stackexchange.com/questions/121194", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41331/" ]
Im having a problem with my menu and custom post type. I have a custom post type of "services". I have created new page for it called Services. On that page Im displaying a list of all the post from that custom post type. The current-menu-item class is working as itended. But the problem is when I click on one of the...
I usually include the following parent variable, filter and method in my plugins to account for this case. I've never been sure if this is the "right" way of going about it, but feels better than applying it with javascript. ``` class Plugin_Name { private $parent = 'services'; // ideally this is a setting in your...
121,211
<p>I have a site <strong><a href="http://azeverything.com" rel="nofollow">here</a></strong>... </p> <p>If a user clicks on <strong>Submit an Event</strong> or <strong>Send an Article</strong>, they are re-directed to a 404 page because I have it set up to make the page private. </p> <p>What I want to do is if the use...
[ { "answer_id": 121213, "author": "user9", "author_id": 33790, "author_profile": "https://wordpress.stackexchange.com/users/33790", "pm_score": 0, "selected": false, "text": "<p>Then, you could try the <a href=\"http://wordpress.org/plugins/quick-pagepost-redirect-plugin/\" rel=\"nofollow...
2013/11/04
[ "https://wordpress.stackexchange.com/questions/121211", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37625/" ]
I have a site **[here](http://azeverything.com)**... If a user clicks on **Submit an Event** or **Send an Article**, they are re-directed to a 404 page because I have it set up to make the page private. What I want to do is if the user is logged in, it goes to the correct page. But if the user isn't logged in, then...
In that page's template, do something like... ``` if(!is_user_logged_in()){ $redirect = get_permalink(1); // where this integer is id of registration page wp_redirect($redirect); exit; } ```
121,232
<p>I'm using the Simple Fields plugin (<a href="http://wordpress.org/plugins/simple-fields/" rel="nofollow">http://wordpress.org/plugins/simple-fields/</a>) and am having the hardest time creating a slideshow from a repeatable field group. I've tried piecing everything that I could find from the documentation and from ...
[ { "answer_id": 121248, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<p>You're calling <a href=\"http://queryposts.com/function/wp_get_attachment_image_src/\" rel=\"nofollow\"><code>wp_g...
2013/11/04
[ "https://wordpress.stackexchange.com/questions/121232", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20013/" ]
I'm using the Simple Fields plugin (<http://wordpress.org/plugins/simple-fields/>) and am having the hardest time creating a slideshow from a repeatable field group. I've tried piecing everything that I could find from the documentation and from others who have had similar issues, but everything I try results in an "in...
Finally was able to ask a friend to help me get this to work in person. Here's what we changed: ``` <ul class="slides"> <?php $slideshow_repeat = simple_fields_get_post_group_values( get_the_id(), "Slideshow", true, 2 ); print_r( $slideshow_repeat ); foreach ( $slideshow_repeat as $slide ) { //...
121,250
<p>This is my index.php (my homepage). It displays two loops. The first one displays the sticky posts and the second displays all of the posts. The <code>&lt;div id="primary"&gt;</code> that is located after the first loop is not appearing in my code or functions in my css. This is my code:</p> <pre><code> &lt;?php...
[ { "answer_id": 121253, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 0, "selected": false, "text": "<p>Use</p>\n<pre><code>wp_reset_postdata()\n</code></pre>\n<p>after where the first <code>WP_Query()</cod...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121250", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23774/" ]
This is my index.php (my homepage). It displays two loops. The first one displays the sticky posts and the second displays all of the posts. The `<div id="primary">` that is located after the first loop is not appearing in my code or functions in my css. This is my code: ``` <?php get_header(); ?> <div id="top-hom...
`<!-- end top homepage -- >` That is not a valid comment. I suspect that it has something to do with that. I really hate those typos. Hard to find.
121,252
<p>I use this code to download a file from remote server to mine. The file is created and saved but in the home directory. I want it in the plugin directory.</p> <pre><code>$url ='*.dat'; // Use wp_remote_get to fetch the data $response = wp_remote_get($url); // Save the body part to a variable $fileContent = $respon...
[ { "answer_id": 121253, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 0, "selected": false, "text": "<p>Use</p>\n<pre><code>wp_reset_postdata()\n</code></pre>\n<p>after where the first <code>WP_Query()</cod...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121252", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41168/" ]
I use this code to download a file from remote server to mine. The file is created and saved but in the home directory. I want it in the plugin directory. ``` $url ='*.dat'; // Use wp_remote_get to fetch the data $response = wp_remote_get($url); // Save the body part to a variable $fileContent = $response['body']; /...
`<!-- end top homepage -- >` That is not a valid comment. I suspect that it has something to do with that. I really hate those typos. Hard to find.
121,273
<p>I was wondering how to check if a css file is already loaded. For example, I have in my theme Font Awesome <code>font-awesome.min.css</code> and I have a plugin that make use of Font Awesome too. So, I ended up with two <code>font-awesome.min.css</code> stylesheets loaded. Is there a way to check if a CSS sheet is a...
[ { "answer_id": 121283, "author": "Ravinder Kumar", "author_id": 29439, "author_profile": "https://wordpress.stackexchange.com/users/29439", "pm_score": 2, "selected": false, "text": "<p>you can stop loading multiple font-awesome.min.css:</p>\n\n<p>1).use same handle as in you plugin used...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121273", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9060/" ]
I was wondering how to check if a css file is already loaded. For example, I have in my theme Font Awesome `font-awesome.min.css` and I have a plugin that make use of Font Awesome too. So, I ended up with two `font-awesome.min.css` stylesheets loaded. Is there a way to check if a CSS sheet is already loaded before I en...
I've +1 the Ravs answer because it it good and it should works in most case, however it assumes that you know the handle used by 3rd party theme/plugins and this is not always true. If all developer used same handle for same styles/scripts the problem does not exists, because **WordPress automatically skip styles and ...
121,285
<p>I have my news query which is on my index file.</p> <p>I want to include a post into this query which is infact a page.</p> <p>Is there anyway to do this?</p> <pre><code>&lt;?php query_posts(array( 'posts_per_page' =&gt; 5, 'paged' =&gt; $paged )); if ( have_posts() ) : ?&gt; </code></pre> <p>My page id ...
[ { "answer_id": 121294, "author": "Subharanjan", "author_id": 13615, "author_profile": "https://wordpress.stackexchange.com/users/13615", "pm_score": 0, "selected": false, "text": "<p>Something like this.. probably !!</p>\n\n<pre><code>if ( have_posts() ) {\n while ( have_posts() ) {\n...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121285", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11327/" ]
I have my news query which is on my index file. I want to include a post into this query which is infact a page. Is there anyway to do this? ``` <?php query_posts(array( 'posts_per_page' => 5, 'paged' => $paged )); if ( have_posts() ) : ?> ``` My page id is 6417 - If I use post\_\_in then that is the only ...
And here is the correct implementation: Register the `category` taxonomy for the `page` post-type: ``` function wpse121285_add_category_to_pages() { register_taxonomy_for_object_type('category', 'page'); } add_action( 'admin_init', 'wpse121285_add_category_to_pages' ); ``` Add the appropriate category term ...
121,299
<p>am using this function to delete post from front</p> <pre><code>// Delete from Front-End Link function wp_delete_post_link($link = 'Delete This', $before = '', $after = '', $title="Move this item to the Trash", $cssClass="delete-post") { global $post; if ( $post-&gt;post_type == 'page' ) { if ( !cu...
[ { "answer_id": 128700, "author": "henrywright", "author_id": 22599, "author_profile": "https://wordpress.stackexchange.com/users/22599", "pm_score": 2, "selected": false, "text": "<p>The solution to this is to modify your restrict admin function to allow for certain circumstances.</p>\n\...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121299", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41301/" ]
am using this function to delete post from front ``` // Delete from Front-End Link function wp_delete_post_link($link = 'Delete This', $before = '', $after = '', $title="Move this item to the Trash", $cssClass="delete-post") { global $post; if ( $post->post_type == 'page' ) { if ( !current_user_can( '...
The solution to this is to modify your restrict admin function to allow for certain circumstances. ``` function restrict_admin() { // Bail if a user is trying to trash a post. if ( isset( $_GET[ 'action'] ) && 'trash' == $_GET[ 'action'] ) return; // Kill execution if not an administrator. if...
121,308
<h2>Question</h2> <p>What'd be an optimal way to redirect the home page of a WordPress site to a category archive without involving external factors (e.g. Apache's .htaccess) i.e. within WordPress?</p> <h2>Why?</h2> <p>(Only to justify the question. Please let this not turn the question into <em>too localized</em>.)...
[ { "answer_id": 121312, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": true, "text": "<p>Eliminating all of the other solutions, there is at least one remaining: <a href=\"http://codex.wordpress.o...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121308", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10691/" ]
Question -------- What'd be an optimal way to redirect the home page of a WordPress site to a category archive without involving external factors (e.g. Apache's .htaccess) i.e. within WordPress? Why? ---- (Only to justify the question. Please let this not turn the question into *too localized*.) It's a news site. T...
Eliminating all of the other solutions, there is at least one remaining: [`template_redirect`](http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect): ``` function wpse121308_redirect_homepage() { // Check for blog posts index // NOT site front page, // which would be is_front_page() ...
121,309
<p>I'm developing a plugin and I want to insert menu items programmatically.</p> <p>When my theme creates a menu, it uses this call:</p> <pre><code>wp_nav_menu( array( 'theme_location' =&gt; 'primary', 'menu_class' =&gt; 'nav-menu' ) ); </code></pre> <p>Which resulted in something like this in the HTML:</p> <pre><c...
[ { "answer_id": 121311, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>You can set <code>container</code> to <code>false</code> and use the <code>items_wrap</code> argument to omit the ...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121309", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41369/" ]
I'm developing a plugin and I want to insert menu items programmatically. When my theme creates a menu, it uses this call: ``` wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ``` Which resulted in something like this in the HTML: ``` <div class="nav-menu"><ul> <li class="cur...
Before being printed, all the menu items get run through a filter. You can target the `wp_nav_menu_items` filter to tack things on to the menu: ``` // Filter wp_nav_menu() to add additional links and other output function new_nav_menu_items($items) { $homelink = '<li class="home"><a href="' . home_url( '/' ) . '">...
121,323
<p>I'm using a custom fields plugin for WordPress (Advanced Custom Fields) and am using a time picker field set to format: "h:mm tt". Using a typical WP query, I'm attempting to sort by "start time" in ascending order, but the returned lists of posts seems to sort on ascending numerical value (i.e. 12:00 PM would appea...
[ { "answer_id": 121329, "author": "Fernando Baltazar", "author_id": 10218, "author_profile": "https://wordpress.stackexchange.com/users/10218", "pm_score": -1, "selected": false, "text": "<p>I had the same problem two years ago but, I got a tip to get my custom metafields sorted correctly...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121323", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41375/" ]
I'm using a custom fields plugin for WordPress (Advanced Custom Fields) and am using a time picker field set to format: "h:mm tt". Using a typical WP query, I'm attempting to sort by "start time" in ascending order, but the returned lists of posts seems to sort on ascending numerical value (i.e. 12:00 PM would appear a...
I don't see any reason why your code should not work, and when I test things it does work. I think that one of the following is happening: 1. Your `meta_key` is wrong. Perhaps it is prepended by a `_` for example. 2. You don't have correct, or consistent, timestamps 3. You have sticky posts getting in the way 4. There...
121,334
<p>It needs connectivity to wordpress.org and is timing out. I am behind a corporate firewall. I have never had this issue come up before in previous versions. Why does themes.php need access to wordpress.org and what can I do so it doesn't (or maybe something that will allow me to use my proxy settings).</p> <p>Ad...
[ { "answer_id": 121336, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": false, "text": "<p>Navigating WP admin in general tends to trigger multiple external requests, such as fetching news feeds and theme/p...
2013/11/05
[ "https://wordpress.stackexchange.com/questions/121334", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32393/" ]
It needs connectivity to wordpress.org and is timing out. I am behind a corporate firewall. I have never had this issue come up before in previous versions. Why does themes.php need access to wordpress.org and what can I do so it doesn't (or maybe something that will allow me to use my proxy settings). Adding in error...
Navigating WP admin in general tends to trigger multiple external requests, such as fetching news feeds and theme/plugin updates (not counting whatever plugin/themes might be doing on their own). You can put configuration constants into `wp-config.php` to block external requests completely/partially: ``` define( 'WP_...
121,359
<p>I am setting up a one page WordPress site. I am getting some pages listed in my site that does not have content. For example, I will get the empty blog page as well as the blog template. So I thought I could throw in a check to see if the page has content and if it does go ahead and post that information. I am havin...
[ { "answer_id": 121361, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 6, "selected": true, "text": "<p>The content is a property of the <code>post</code> object, not of the query object.</p>\n\n<p>Use <code>$post</code> o...
2013/11/06
[ "https://wordpress.stackexchange.com/questions/121359", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14761/" ]
I am setting up a one page WordPress site. I am getting some pages listed in my site that does not have content. For example, I will get the empty blog page as well as the blog template. So I thought I could throw in a check to see if the page has content and if it does go ahead and post that information. I am having t...
The content is a property of the `post` object, not of the query object. Use `$post` or `get_post()` instead: ``` if( '' !== get_post()->post_content ) { // do something } ```
121,386
<p>I need a way that lets my users register they're weight (kg) and maybe % of bodyfat and save that information on each user in the DB.</p> <p>Then i need a way to output that number again on the logged in user</p> <p>What would be the easiest approach to do something like this?</p>
[ { "answer_id": 121361, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 6, "selected": true, "text": "<p>The content is a property of the <code>post</code> object, not of the query object.</p>\n\n<p>Use <code>$post</code> o...
2013/11/06
[ "https://wordpress.stackexchange.com/questions/121386", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12727/" ]
I need a way that lets my users register they're weight (kg) and maybe % of bodyfat and save that information on each user in the DB. Then i need a way to output that number again on the logged in user What would be the easiest approach to do something like this?
The content is a property of the `post` object, not of the query object. Use `$post` or `get_post()` instead: ``` if( '' !== get_post()->post_content ) { // do something } ```
121,450
<p>I've used the settings API to create a very simple page for plugin settings. This is my first time using the API, and through various tutorials online and answers here, I think I've figured it out. This is backed up by the fact that the page even works!!</p> <p>However, something weird is happening:</p> <p><img ...
[ { "answer_id": 121482, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 4, "selected": true, "text": "<p>You don't need a form to submit a comment to the wp-comments-post.php file, or to send a pingback or trackback. Spa...
2013/11/06
[ "https://wordpress.stackexchange.com/questions/121450", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24178/" ]
I've used the settings API to create a very simple page for plugin settings. This is my first time using the API, and through various tutorials online and answers here, I think I've figured it out. This is backed up by the fact that the page even works!! However, something weird is happening: ![two notices regarding ...
You don't need a form to submit a comment to the wp-comments-post.php file, or to send a pingback or trackback. Spammers don't use forms, they simply send their spam directly. Removing the form doesn't "turn off" comments. To do that, go to the Posts screen, and use the Quick Edit to actually disable comments and trac...
121,459
<p>I'm building a shop based on WooCommerce. I need to add an extra checkbox on the checkout page called Shipping Insurance. Once the field is checked, i need to add an extra $3 to the Order Total. I was able to add a fixed fee this way:</p> <pre><code>function woo_add_cart_fee() { global $woocommerce; $woocommerc...
[ { "answer_id": 121488, "author": "Tarei SuperChur King", "author_id": 41448, "author_profile": "https://wordpress.stackexchange.com/users/41448", "pm_score": 0, "selected": false, "text": "<p>This won't completely answer your question, but the official WooCommerce documentation has an ex...
2013/11/06
[ "https://wordpress.stackexchange.com/questions/121459", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8038/" ]
I'm building a shop based on WooCommerce. I need to add an extra checkbox on the checkout page called Shipping Insurance. Once the field is checked, i need to add an extra $3 to the Order Total. I was able to add a fixed fee this way: ``` function woo_add_cart_fee() { global $woocommerce; $woocommerce->cart->add_f...
Ok, so this is how i did it. Create a product called Shipping Insurance which is $3, make sure its a hidden product(Catalog Visibility on the right side) Use the following code in your theme's functions.php file: ``` add_action('woocommerce_cart_totals_after_shipping', 'wc_shipping_insurance_note_after_cart'); funct...
121,463
<p>I need to add a language file to an existing plugin. Not for translation reasons, but because I'd like to change all occurrences of a certain word to something else. While I could just drop another .po/.mo file set into the plugin's languages directory, I don't want to lose the language file when the plugin is updat...
[ { "answer_id": 121465, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 3, "selected": true, "text": "<p>Best way to do this is probably by using a second, custom-made, plugin.</p>\n\n<p>Make a new plugin directory. Call...
2013/11/06
[ "https://wordpress.stackexchange.com/questions/121463", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/300/" ]
I need to add a language file to an existing plugin. Not for translation reasons, but because I'd like to change all occurrences of a certain word to something else. While I could just drop another .po/.mo file set into the plugin's languages directory, I don't want to lose the language file when the plugin is updated....
Best way to do this is probably by using a second, custom-made, plugin. Make a new plugin directory. Call it something like "example-com-custom-langs" or something unique to your site. In there, make a php file with a plugin header describing what the plugin does (for your own sanity), and do something like this: ```...
121,472
<p>I'm having trouble including an external .php file into my WordPress theme.</p> <p><strong>WordPress installation URL:</strong> mydomainname.com/blog</p> <p><strong>PHP File URL:</strong> mydomainname.com/testing/assets/inc/analytics.php</p> <p>I'm trying to include this PHP file from within header.php of my Word...
[ { "answer_id": 121473, "author": "Andrew Bartel", "author_id": 17879, "author_profile": "https://wordpress.stackexchange.com/users/17879", "pm_score": 2, "selected": true, "text": "<p>You need to use file paths, not urls, so if mydomainname.com/blog is at /home/account/public_html/blog t...
2013/11/06
[ "https://wordpress.stackexchange.com/questions/121472", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31828/" ]
I'm having trouble including an external .php file into my WordPress theme. **WordPress installation URL:** mydomainname.com/blog **PHP File URL:** mydomainname.com/testing/assets/inc/analytics.php I'm trying to include this PHP file from within header.php of my WordPress theme. My line of code looks like this: ``...
You need to use file paths, not urls, so if mydomainname.com/blog is at /home/account/public\_html/blog then your file is /home/account/public\_html/testing/assets/inc/analytics.php. I would recommend putting it into a one-off plugin though.
121,486
<p>I'm trying to create a magazine style website. For this particular page (not homepage) I'd like to fetch the latest post and style it one way (style1). For all the other posts I'd like to just display smaller (style2).</p> <p>This is working fine, BUT I would also like to enable pagination. Is there anyway to have ...
[ { "answer_id": 121498, "author": "GhostToast", "author_id": 13676, "author_profile": "https://wordpress.stackexchange.com/users/13676", "pm_score": 0, "selected": false, "text": "<p>You can include in your conditional <a href=\"http://codex.wordpress.org/Function_Reference/is_paged\" rel...
2013/11/06
[ "https://wordpress.stackexchange.com/questions/121486", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41450/" ]
I'm trying to create a magazine style website. For this particular page (not homepage) I'd like to fetch the latest post and style it one way (style1). For all the other posts I'd like to just display smaller (style2). This is working fine, BUT I would also like to enable pagination. Is there anyway to have pagination...
Edit ---- So, the reason that this isn't working is because you've modified the question to specify that this is happening in a **custom page template**. Since this is the case, you'll need to use two separate custom queries, and won't need to bother with filtering the main query via `pre_get_posts`. The first query ...
121,489
<p>Is there a way to split up the post content and the gallery short code. I want to display the gallery outside my normal content no matter how or where it is placed. I can use this to get the shortcode itself:</p> <pre><code>if(has_shortcode(get_the_content(), 'gallery')){ $pattern = get_shortcode_regex(); ...
[ { "answer_id": 121508, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 6, "selected": true, "text": "<p>\nOpen to anybody who can simplify this but here's what I came up with that worked for me. </p>\n\n<p>First ...
2013/11/06
[ "https://wordpress.stackexchange.com/questions/121489", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7355/" ]
Is there a way to split up the post content and the gallery short code. I want to display the gallery outside my normal content no matter how or where it is placed. I can use this to get the shortcode itself: ``` if(has_shortcode(get_the_content(), 'gallery')){ $pattern = get_shortcode_regex(); preg_match("/$...
Open to anybody who can simplify this but here's what I came up with that worked for me. First thing's first - get the gallery, using [`get_post_gallery()`](https://developer.wordpress.org/reference/functions/get_post_gallery/), as soon as the loop starts: ```php <?php if( have_posts() ) : ?> <?php while( have_...
121,524
<p>I'm trying to add two columns to the users.php file. I'm not sure how to add both $total_time_display and $logged_in_amount_display. How could I return both values?</p> <p>Here is my code:</p> <pre><code>add_filter('manage_users_columns', 'freeman_add_user_minutes_column'); function freeman_add_user_minutes_column...
[ { "answer_id": 121534, "author": "Oleg Butuzov", "author_id": 14536, "author_profile": "https://wordpress.stackexchange.com/users/14536", "pm_score": 2, "selected": false, "text": "<p>Please check what the value of the <code>show_in_menu</code> and <code>show_ui</code> arguments for <a h...
2013/11/07
[ "https://wordpress.stackexchange.com/questions/121524", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28560/" ]
I'm trying to add two columns to the users.php file. I'm not sure how to add both $total\_time\_display and $logged\_in\_amount\_display. How could I return both values? Here is my code: ``` add_filter('manage_users_columns', 'freeman_add_user_minutes_column'); function freeman_add_user_minutes_column($columns) { ...
Please check what the value of the `show_in_menu` and `show_ui` arguments for [register\_post\_type](http://codex.wordpress.org/Function_Reference/register_post_type) your post types before you register tham.
121,546
<p>If <code>$a</code> contains the ID of a certain post, how can one obtain the corresponding author ID? I've tried with</p> <pre><code>$b = get_post( $a); $c = $b-&gt;post_author; $d = $c-&gt;ID; </code></pre> <p>but it does not work.</p>
[ { "answer_id": 121534, "author": "Oleg Butuzov", "author_id": 14536, "author_profile": "https://wordpress.stackexchange.com/users/14536", "pm_score": 2, "selected": false, "text": "<p>Please check what the value of the <code>show_in_menu</code> and <code>show_ui</code> arguments for <a h...
2013/11/07
[ "https://wordpress.stackexchange.com/questions/121546", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20109/" ]
If `$a` contains the ID of a certain post, how can one obtain the corresponding author ID? I've tried with ``` $b = get_post( $a); $c = $b->post_author; $d = $c->ID; ``` but it does not work.
Please check what the value of the `show_in_menu` and `show_ui` arguments for [register\_post\_type](http://codex.wordpress.org/Function_Reference/register_post_type) your post types before you register tham.
121,567
<p>I'm trying to build a debates-like system. </p> <p>It will work like this:</p> <p>A page will display the post with a countdown timer, so user will be able to submit comment till a specific period of time. (this will be the first page users will see)</p> <p>All the comments submitted in that period of time will b...
[ { "answer_id": 123560, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 3, "selected": true, "text": "<p>I was trying to reproduce what are you describing:</p>\n\n<blockquote>\n <p>Through the VAT setting...
2013/11/07
[ "https://wordpress.stackexchange.com/questions/121567", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12572/" ]
I'm trying to build a debates-like system. It will work like this: A page will display the post with a countdown timer, so user will be able to submit comment till a specific period of time. (this will be the first page users will see) All the comments submitted in that period of time will be displayed in a child p...
I was trying to reproduce what are you describing: > > Through the VAT settings on WooCommerce, I setup an extra rule for the > specific postal code with zero tax - unfortunately the result is a > line of zero tax, and a line of standard VAT, rather than the desired > line of zero tax only. > > > I then tried to...
121,569
<p>I'm working on a site for someone that doesn't have any keys in the wp-config file. Isn't this a serious issue? I know I can generate these but I wonder if this will have any side-effects..also, is this currently a security risk because the site had been hacked. </p> <p>Example:</p> <pre><code>define('AUTH_KEY', '...
[ { "answer_id": 121577, "author": "Stephen Harris", "author_id": 9364, "author_profile": "https://wordpress.stackexchange.com/users/9364", "pm_score": 0, "selected": false, "text": "<p>Yes, predictable (or known) keys present a serious security vulnerability. </p>\n\n<p>These keys (salts)...
2013/11/07
[ "https://wordpress.stackexchange.com/questions/121569", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5827/" ]
I'm working on a site for someone that doesn't have any keys in the wp-config file. Isn't this a serious issue? I know I can generate these but I wonder if this will have any side-effects..also, is this currently a security risk because the site had been hacked. Example: ``` define('AUTH_KEY', 'put your unique phras...
It is indeed a security issue to have those left as the defaults, but it is not an extremely serious issue. To mitigate the problem of known default salts, WordPress intentionally recognizes when those values are left as "put your unique phrase here" and will not use that phrase as a key/salt. Instead, it generates r...
121,600
<p>I'm developing a website that needs to allow users, within Gravity Forms, to submit a PDF file and have a JPG thumbnail created of the first page of the PDF that is then displayed in the created post.</p> <p>My plan was to have a function that would allow for this, and add the JPG link to a custom field, so it can ...
[ { "answer_id": 121633, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 3, "selected": true, "text": "<p>If I'm not totally mistaken, the code you have given on your update won't work, because the file/mim...
2013/11/07
[ "https://wordpress.stackexchange.com/questions/121600", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4132/" ]
I'm developing a website that needs to allow users, within Gravity Forms, to submit a PDF file and have a JPG thumbnail created of the first page of the PDF that is then displayed in the created post. My plan was to have a function that would allow for this, and add the JPG link to a custom field, so it can then be di...
If I'm not totally mistaken, the code you have given on your update won't work, because the file/mime type pdf isn't supported by the [WP\_image\_editor class](http://codex.wordpress.org/Class_Reference/WP_Image_Editor) called by [wp\_get\_image\_editor()](http://codex.wordpress.org/Function_Reference/wp_get_image_edit...
121,606
<p>I'm trying to figure out how to rewrite URLs while dropping the original parameter (whether it's a number or text); basically exactly what WP does with it's clean permalinks</p> <p>Does a database lookup table exist that matches the post ID# to the permalink string as set in the post editor?</p>
[ { "answer_id": 121633, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 3, "selected": true, "text": "<p>If I'm not totally mistaken, the code you have given on your update won't work, because the file/mim...
2013/11/07
[ "https://wordpress.stackexchange.com/questions/121606", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10663/" ]
I'm trying to figure out how to rewrite URLs while dropping the original parameter (whether it's a number or text); basically exactly what WP does with it's clean permalinks Does a database lookup table exist that matches the post ID# to the permalink string as set in the post editor?
If I'm not totally mistaken, the code you have given on your update won't work, because the file/mime type pdf isn't supported by the [WP\_image\_editor class](http://codex.wordpress.org/Class_Reference/WP_Image_Editor) called by [wp\_get\_image\_editor()](http://codex.wordpress.org/Function_Reference/wp_get_image_edit...
121,608
<p>I'm trying to remove a widget area called 'Primary' from a certain page on a site. This is the function where I manage the sidebars:</p> <pre><code>//ADD CATEGORIES IN SIDEBAR OF SINGLE POST TYPE add_action( 'genesis_sidebar', 'add_mysite_sidebar' ); function add_mysite_sidebar() { if( get_post_type() == 'post'...
[ { "answer_id": 121633, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 3, "selected": true, "text": "<p>If I'm not totally mistaken, the code you have given on your update won't work, because the file/mim...
2013/11/07
[ "https://wordpress.stackexchange.com/questions/121608", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8325/" ]
I'm trying to remove a widget area called 'Primary' from a certain page on a site. This is the function where I manage the sidebars: ``` //ADD CATEGORIES IN SIDEBAR OF SINGLE POST TYPE add_action( 'genesis_sidebar', 'add_mysite_sidebar' ); function add_mysite_sidebar() { if( get_post_type() == 'post' ){ ...
If I'm not totally mistaken, the code you have given on your update won't work, because the file/mime type pdf isn't supported by the [WP\_image\_editor class](http://codex.wordpress.org/Class_Reference/WP_Image_Editor) called by [wp\_get\_image\_editor()](http://codex.wordpress.org/Function_Reference/wp_get_image_edit...
121,615
<p>I currently am using a child theme, and its parent theme has registered sidebars already..</p> <p>My. problem is that i want to change the parent theme's dynamic sidebar </p> <p>From:</p> <pre><code>register_sidebar(array( 'name' =&gt; 'Footer', 'before_widget' =&gt; '&lt;div class="span3"&gt;', 'afte...
[ { "answer_id": 121620, "author": "reikyoushin", "author_id": 32687, "author_profile": "https://wordpress.stackexchange.com/users/32687", "pm_score": 2, "selected": false, "text": "<p>Here is what worked:</p>\n\n<pre><code>add_action( 'after_setup_theme', 'parent_override' );\nfunction pa...
2013/11/07
[ "https://wordpress.stackexchange.com/questions/121615", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32687/" ]
I currently am using a child theme, and its parent theme has registered sidebars already.. My. problem is that i want to change the parent theme's dynamic sidebar From: ``` register_sidebar(array( 'name' => 'Footer', 'before_widget' => '<div class="span3">', 'after_widget' => '</div>', 'before_title...
Here is what worked: ``` add_action( 'after_setup_theme', 'parent_override' ); function parent_override() { unregister_sidebar('sidebar-4'); /** I have looked for the ID of the sidebar by looking at * the source code in the admin.. and saw the widget's id="sidebar-4" */ register_side...
121,632
<p>I am working on a plugin that adds meta data for each user to the users.php table that is displayed by adding columns. I have that done but I would like to also add a button that will delete the meta data of the users when pressed. I'm not sure how I can add it. I would like it to be to the right of the 'change' but...
[ { "answer_id": 121646, "author": "josh", "author_id": 24323, "author_profile": "https://wordpress.stackexchange.com/users/24323", "pm_score": 4, "selected": true, "text": "<p>Okay.. you COULD add a button like you mentioned; but I think this is going to require a lot more code. The user...
2013/11/08
[ "https://wordpress.stackexchange.com/questions/121632", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28560/" ]
I am working on a plugin that adds meta data for each user to the users.php table that is displayed by adding columns. I have that done but I would like to also add a button that will delete the meta data of the users when pressed. I'm not sure how I can add it. I would like it to be to the right of the 'change' button...
Okay.. you COULD add a button like you mentioned; but I think this is going to require a lot more code. The users.php page is using the WP List Table class.. which means we can hook into the `bulk actions` and add our custom value there. So, let's create a function to add a new value into the bulk actions dropdown box...
121,679
<p>How to hook a filter to catch get_post_meta when alternate a custom field output?</p> <p>I have fill a custom field(meta data) in a post, just like this: </p> <pre><code>&lt;!--:de--&gt;Nominale spanning&lt;!--:--&gt;&lt;!--:zh/cn--&gt;额定电压&lt;!--:--&gt;&lt;!--:en--&gt;Arrester Accessories&lt;!--:--&gt; </code></p...
[ { "answer_id": 161210, "author": "forlogos", "author_id": 20951, "author_profile": "https://wordpress.stackexchange.com/users/20951", "pm_score": 3, "selected": false, "text": "<p>Just had the same problem and, using your code above, here is how I solved it:</p>\n\n<pre><code>function ge...
2013/11/08
[ "https://wordpress.stackexchange.com/questions/121679", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33836/" ]
How to hook a filter to catch get\_post\_meta when alternate a custom field output? I have fill a custom field(meta data) in a post, just like this: ``` <!--:de-->Nominale spanning<!--:--><!--:zh/cn-->额定电压<!--:--><!--:en-->Arrester Accessories<!--:--> ``` I need to get this output translated,so I wondering how to ...
After a lot of messing around with this, I think I found a fairly good solution here. I realize this is over a year after you asked but this was bothering me and I couldn't find a good solution until now. The problem is that the get\_post\_metadata function doesn't allow you to access the current value. This means yo...
121,688
<p>There is a question very similar to mine, which can be found <a href="https://wordpress.stackexchange.com/questions/57189/how-can-i-make-wp-pagenavi-work-on-a-custom-query-built-upon-a-form-submission">here</a>. The difference with my question is: my search form is on several pages (<code>page.php</code> and <code>s...
[ { "answer_id": 123385, "author": "Subharanjan", "author_id": 13615, "author_profile": "https://wordpress.stackexchange.com/users/13615", "pm_score": 0, "selected": false, "text": "<p>Instead of this line </p>\n\n<pre><code>$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;\n...
2013/11/08
[ "https://wordpress.stackexchange.com/questions/121688", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36783/" ]
There is a question very similar to mine, which can be found [here](https://wordpress.stackexchange.com/questions/57189/how-can-i-make-wp-pagenavi-work-on-a-custom-query-built-upon-a-form-submission). The difference with my question is: my search form is on several pages (`page.php` and `single.php`) and I don't use wp...
There are some things that should be changed in your code: 1. Please no not use `$_SESSION` stuff. So do not add session\_start anywhere. You can pass the current state via the query string, using `method="get"` in your form. 2. For a better flow, you can pass the current page to `search_v1` function as argument, in t...
121,699
<p>I am currently developing a site, I have three custom post types (speakers, events, videos). Each event has a relationship with speakers so when a event is created they select what speakers spoke at that event. my event page works fine and I can call the speakers fine. The problem I am having in my videos custom pos...
[ { "answer_id": 121712, "author": "pburke", "author_id": 41528, "author_profile": "https://wordpress.stackexchange.com/users/41528", "pm_score": 0, "selected": false, "text": "<p>Looks like you're using both <code>get_posts()</code> and <code>new WP_Query()</code> -- You only need one or ...
2013/11/08
[ "https://wordpress.stackexchange.com/questions/121699", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41522/" ]
I am currently developing a site, I have three custom post types (speakers, events, videos). Each event has a relationship with speakers so when a event is created they select what speakers spoke at that event. my event page works fine and I can call the speakers fine. The problem I am having in my videos custom post t...
I got this working after by using the below code <http://hastebin.com/dufucamaja.xml>
121,702
<p>I am using <code>wp_list_categories</code> to display all terms of my custom taxonomy <code>'categories'.</code></p> <p>The function is outputting all my terms successfully but the current category is not being highlighted, even though <code>'current_category'</code> is set to <code>1</code> in my arguments.</p> <...
[ { "answer_id": 121704, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 2, "selected": true, "text": "<p>This will add a <code>current-cat</code> class to any / all categories connected to the post, not jut one. ...
2013/11/08
[ "https://wordpress.stackexchange.com/questions/121702", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34122/" ]
I am using `wp_list_categories` to display all terms of my custom taxonomy `'categories'.` The function is outputting all my terms successfully but the current category is not being highlighted, even though `'current_category'` is set to `1` in my arguments. The function is being outputted on `taxonomy-categories.php...
This will add a `current-cat` class to any / all categories connected to the post, not jut one. Add this to `functions.php` ``` function tax_cat_active( $output, $args ) { if(is_single()){ global $post; $terms = get_the_terms( $post->ID, $args['taxonomy'] ); foreach( $terms as $term ) if ( pr...
121,710
<p>I have a custom post type where I've created 3 pages in a parent-child relationship. The pages are created like this : PARENT-CHILD-GRANDCHILD</p> <p>I want the child and the grandchild pages to get the same content as the parent page and everything I add from the dashboard in the content area to be added after th...
[ { "answer_id": 121704, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 2, "selected": true, "text": "<p>This will add a <code>current-cat</code> class to any / all categories connected to the post, not jut one. ...
2013/11/08
[ "https://wordpress.stackexchange.com/questions/121710", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12572/" ]
I have a custom post type where I've created 3 pages in a parent-child relationship. The pages are created like this : PARENT-CHILD-GRANDCHILD I want the child and the grandchild pages to get the same content as the parent page and everything I add from the dashboard in the content area to be added after the parent p...
This will add a `current-cat` class to any / all categories connected to the post, not jut one. Add this to `functions.php` ``` function tax_cat_active( $output, $args ) { if(is_single()){ global $post; $terms = get_the_terms( $post->ID, $args['taxonomy'] ); foreach( $terms as $term ) if ( pr...
121,732
<p>When loading content in gettext calls (__(), _e(), etc.) they translate fine when I render the page in the browser normally (PHP delivers the content to the browser), however when I make AJAX calls, the gettext does not translate.</p> <p>I thought maybe it was that word specifically, but when I use the gettext call...
[ { "answer_id": 168760, "author": "alibabaei", "author_id": 63627, "author_profile": "https://wordpress.stackexchange.com/users/63627", "pm_score": 1, "selected": false, "text": "<p>it is too late but for public use:</p>\n\n<pre><code>/* if qTranslate is installed */\n/* set front locale ...
2013/11/08
[ "https://wordpress.stackexchange.com/questions/121732", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41533/" ]
When loading content in gettext calls (\_\_(), \_e(), etc.) they translate fine when I render the page in the browser normally (PHP delivers the content to the browser), however when I make AJAX calls, the gettext does not translate. I thought maybe it was that word specifically, but when I use the gettext call in con...
it is too late but for public use: ``` /* if qTranslate is installed */ /* set front locale for ajax calls requested from front-end */ function set_locale_for_frontend_ajax_calls() { if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX && substr( $_SERVER['HTTP_REFERER'], 0, strlen( admin_url() ) ) !...
121,749
<p>I wanted to count number of posts (public, private, protected) according to a category name suppose <code>blog</code> . To get all the posts no matter what category i used <code>$total_pages = wp_count_posts()-&gt;publish;</code></p> <p>But i cant figure out how to count number of posts for a category name <code>bl...
[ { "answer_id": 168760, "author": "alibabaei", "author_id": 63627, "author_profile": "https://wordpress.stackexchange.com/users/63627", "pm_score": 1, "selected": false, "text": "<p>it is too late but for public use:</p>\n\n<pre><code>/* if qTranslate is installed */\n/* set front locale ...
2013/11/09
[ "https://wordpress.stackexchange.com/questions/121749", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41094/" ]
I wanted to count number of posts (public, private, protected) according to a category name suppose `blog` . To get all the posts no matter what category i used `$total_pages = wp_count_posts()->publish;` But i cant figure out how to count number of posts for a category name `blog`
it is too late but for public use: ``` /* if qTranslate is installed */ /* set front locale for ajax calls requested from front-end */ function set_locale_for_frontend_ajax_calls() { if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX && substr( $_SERVER['HTTP_REFERER'], 0, strlen( admin_url() ) ) !...
121,767
<p><em>See updates below.</em> I upgraded to 3.7.1 using svn. I did this on my localhost first to make sure everything is fine. Everything was, so I proceeded to do it on the server. However, on the server, the users' avatars are not showing up and instead everyone is getting Gravatar's mystery man.</p> <p>Here is th...
[ { "answer_id": 122953, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 2, "selected": false, "text": "<p><strong>Debug ideas:</strong></p>\n\n<p>You could try to see if this has any effect: </p>\n\n<pre><code>add_f...
2013/11/09
[ "https://wordpress.stackexchange.com/questions/121767", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20710/" ]
*See updates below.* I upgraded to 3.7.1 using svn. I did this on my localhost first to make sure everything is fine. Everything was, so I proceeded to do it on the server. However, on the server, the users' avatars are not showing up and instead everyone is getting Gravatar's mystery man. Here is the code I have in m...
It turns out there was something wrong with the uploads folder. If anybody has this issue in the future, this is what to do. 1. Deactivate BuddyPress. 2. `chmod 777 uploads/` 3. Reinstall BuddyPress 4. `chmod 775 uploads/` That was all it was.
122,785
<p>So, I'm working on a plugin in which I'm making a custom page containing a login form as well as one for user registration; I have the forms built and operational, below is my code.</p> <pre><code>&lt;!-- Begin login form --&gt; &lt;form name="loginform" id="login_form" class="login_form" action="&lt...
[ { "answer_id": 122953, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 2, "selected": false, "text": "<p><strong>Debug ideas:</strong></p>\n\n<p>You could try to see if this has any effect: </p>\n\n<pre><code>add_f...
2013/11/09
[ "https://wordpress.stackexchange.com/questions/122785", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40491/" ]
So, I'm working on a plugin in which I'm making a custom page containing a login form as well as one for user registration; I have the forms built and operational, below is my code. ``` <!-- Begin login form --> <form name="loginform" id="login_form" class="login_form" action="<?php echo esc_url( wp_log...
It turns out there was something wrong with the uploads folder. If anybody has this issue in the future, this is what to do. 1. Deactivate BuddyPress. 2. `chmod 777 uploads/` 3. Reinstall BuddyPress 4. `chmod 775 uploads/` That was all it was.
122,806
<p>I'm looking forward to display, somewhere in the homepage of a WP site, a legend saying:</p> <blockquote> <p><strong>Last updated:</strong> XX/XX</p> </blockquote> <p>by grabbing the date from the most recent post, but not showing any of its content, just the date.</p> <p>Is there any quick way to do this?</p>
[ { "answer_id": 122810, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 1, "selected": false, "text": "<p>There are different way to do this.</p>\n\n<p>The easiest, in my opinion is to use <code>wp_get_recent_posts<...
2013/11/10
[ "https://wordpress.stackexchange.com/questions/122806", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38346/" ]
I'm looking forward to display, somewhere in the homepage of a WP site, a legend saying: > > **Last updated:** XX/XX > > > by grabbing the date from the most recent post, but not showing any of its content, just the date. Is there any quick way to do this?
I would save an option on post save: ``` add_action( 'save_post', function($id,$p) { if ( (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX) || ($p->post_status === 'auto-draft') ) { return; } update_option('_last_site_update',$p->post_da...
122,827
<p>I have lots of images that has to be uploaded via media library. I want to know, is it possible to add file name to <code>alt</code> attribute field automatically when I am uploading them? At the moment I have to open each image and add the <code>alt</code> attribute manually.</p>
[ { "answer_id": 122828, "author": "Christine Cooper", "author_id": 24875, "author_profile": "https://wordpress.stackexchange.com/users/24875", "pm_score": 1, "selected": false, "text": "<p>A viable solution I <a href=\"https://gist.github.com/svil4ok/1991931\" rel=\"nofollow\">found</a> w...
2013/11/10
[ "https://wordpress.stackexchange.com/questions/122827", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42580/" ]
I have lots of images that has to be uploaded via media library. I want to know, is it possible to add file name to `alt` attribute field automatically when I am uploading them? At the moment I have to open each image and add the `alt` attribute manually.
A viable solution I [found](https://gist.github.com/svil4ok/1991931) was adding the *post title* to images missing the `ALT` attribute. Add the following to your `functions.php` file: ``` function add_alt_tags($content) { global $post; preg_match_all('/<img (.*?)\/>/', $content, $images); if(!...
122,854
<p>Can anyone help me on how to add two sidebars on the main page of my WordPress site. I need one on the left and the right. I'm new to WordPress and don't know much about the code, even when I tried reading the codex. My website is <a href="http://www.sushidelivery.com.ph" rel="nofollow">here</a> I am using a Ready T...
[ { "answer_id": 122828, "author": "Christine Cooper", "author_id": 24875, "author_profile": "https://wordpress.stackexchange.com/users/24875", "pm_score": 1, "selected": false, "text": "<p>A viable solution I <a href=\"https://gist.github.com/svil4ok/1991931\" rel=\"nofollow\">found</a> w...
2013/11/11
[ "https://wordpress.stackexchange.com/questions/122854", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36610/" ]
Can anyone help me on how to add two sidebars on the main page of my WordPress site. I need one on the left and the right. I'm new to WordPress and don't know much about the code, even when I tried reading the codex. My website is [here](http://www.sushidelivery.com.ph) I am using a Ready To be theme, with Ready E-Comm...
A viable solution I [found](https://gist.github.com/svil4ok/1991931) was adding the *post title* to images missing the `ALT` attribute. Add the following to your `functions.php` file: ``` function add_alt_tags($content) { global $post; preg_match_all('/<img (.*?)\/>/', $content, $images); if(!...
122,875
<p>I am trying to learn how to process AJAX requests in Wordpress the correct way. To do this I am adapting <a href="http://wptheming.com/2013/07/simple-ajax-example/" rel="nofollow">this tutorial</a> to create a super simple AJAX request to place the ID of a post (from a link) into my page content.</p> <p><strong>The...
[ { "answer_id": 122879, "author": "Sheixt", "author_id": 42607, "author_profile": "https://wordpress.stackexchange.com/users/42607", "pm_score": 2, "selected": false, "text": "<p>This is one of those rare times I can proudly say... there isn't any problem here!</p>\n\n<p>The reason the se...
2013/11/11
[ "https://wordpress.stackexchange.com/questions/122875", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42607/" ]
I am trying to learn how to process AJAX requests in Wordpress the correct way. To do this I am adapting [this tutorial](http://wptheming.com/2013/07/simple-ajax-example/) to create a super simple AJAX request to place the ID of a post (from a link) into my page content. **The Logic** 1. When the `#our-work a` links ...
This is one of those rare times I can proudly say... there isn't any problem here! The reason the server is returning with `0` is because I was logged in! The `wp_ajax_nopriv_example_ajax_request` is only for users who are **not** logged in. After logging out this works fine. So if you are looking to do the same thi...
122,881
<p>I'm using the following code to display my custom post taxonomies: </p> <pre><code>function display_post_taxonomies( $content ) { if( is_single() ) { $args = array( 'public' =&gt; true, '_builtin' =&gt; false ); $output = 'objects'; $operator = 'and'; $taxonomies = get_taxonomie...
[ { "answer_id": 122891, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 1, "selected": false, "text": "<p>What you need is set the <code>show_option_none</code> to a string easily recognizable and then add the resul...
2013/11/11
[ "https://wordpress.stackexchange.com/questions/122881", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25146/" ]
I'm using the following code to display my custom post taxonomies: ``` function display_post_taxonomies( $content ) { if( is_single() ) { $args = array( 'public' => true, '_builtin' => false ); $output = 'objects'; $operator = 'and'; $taxonomies = get_taxonomies( $args, $output, $...
What you need is set the `show_option_none` to a string easily recognizable and then add the result of `wp_list_categories` to the content only if it it does not contain that string.. So your foreach loop shoul look somethinlg like ``` foreach( $taxonomies as $taxonomy ) { $args = array( 'orderby' =>...
122,903
<p>I had a hard time finding the correct way to do this. I want to load the CDN resources here: <a href="http://www.bootstrapcdn.com/" rel="nofollow">http://www.bootstrapcdn.com/</a> but use <code>wp_enqueue_scripts</code> and have local fallback. </p> <p>This is the method I am using for local fall back now directly ...
[ { "answer_id": 122909, "author": "Ivan Hanák", "author_id": 40545, "author_profile": "https://wordpress.stackexchange.com/users/40545", "pm_score": 0, "selected": false, "text": "<p>switch your function <code>wp_register_script</code> for immediate call of <code>wp_enqueue_script</code>....
2013/11/11
[ "https://wordpress.stackexchange.com/questions/122903", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42615/" ]
I had a hard time finding the correct way to do this. I want to load the CDN resources here: <http://www.bootstrapcdn.com/> but use `wp_enqueue_scripts` and have local fallback. This is the method I am using for local fall back now directly in header.php: ``` <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1...
Since 4.5 there is a function that lets you append inline js to an enqueued js file, it is called [wp\_add\_inline\_script](https://developer.wordpress.org/reference/functions/wp_add_inline_script/). Now, this function does not let you add any js code that has a `</script>` in it for security reasons. But when you loo...
122,922
<p>Anyone knows how to achieve this?</p> <p><img src="https://i.stack.imgur.com/wN92P.png" alt="enter image description here"></p> <p>It has something to do with meta boxes, but I just can't figure out the proper syntax.</p>
[ { "answer_id": 122948, "author": "Michael Lewis", "author_id": 20149, "author_profile": "https://wordpress.stackexchange.com/users/20149", "pm_score": 0, "selected": false, "text": "<p>This isn't going to be easy to do. This is hard-coded into the core, and has nothing to do with meta b...
2013/11/11
[ "https://wordpress.stackexchange.com/questions/122922", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42622/" ]
Anyone knows how to achieve this? ![enter image description here](https://i.stack.imgur.com/wN92P.png) It has something to do with meta boxes, but I just can't figure out the proper syntax.
I remembered that once I done this, yesterday I found where, but that code was... *bad*. So today I little improved it and I'm going to share. Before I want to explain what I do. First of all, there are 3 main things to do: 1. Add the tab title beside the standard 2 2. Add something to the content of the tab 3. Make ...
122,927
<p>Is there a way I can add some kind of <code>pre_get_posts()</code> filter to strip out the "read more" link that appears at the end of <code>the_excerpt()</code> for only 1 certain custom post type that I specify?</p> <p>If so, can someone please help me out with the code? I've been working at it for a while but ha...
[ { "answer_id": 122935, "author": "Jonathan", "author_id": 17872, "author_profile": "https://wordpress.stackexchange.com/users/17872", "pm_score": 0, "selected": false, "text": "<p>What about this? Basically it's a way to customize the text by adding a callback function to the functions.p...
2013/11/11
[ "https://wordpress.stackexchange.com/questions/122927", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31828/" ]
Is there a way I can add some kind of `pre_get_posts()` filter to strip out the "read more" link that appears at the end of `the_excerpt()` for only 1 certain custom post type that I specify? If so, can someone please help me out with the code? I've been working at it for a while but haven't gotten anywhere. Any help ...
Put the following code in `functions.php` to show "read more" on all post types except `custom_post_type`. ``` function excerpt_read_more_link($output) { global $post; if ($post->post_type != 'custom_post_type') { $output .= '<p><a href="'. get_permalink($post->ID) . '">read more</a></p>'; } return $ou...
122,939
<p>Am a little new to custom post types, and maybe it's not the right solution to what I am trying to accomplish.</p> <p>What I am trying to accomplish:</p> <ol> <li>User "Add New Property". This will have option to add image and 15 custom info fields. </li> <li>All the properties that are added are displayed on a ce...
[ { "answer_id": 122940, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 3, "selected": true, "text": "<p>What you describe is the typical use case for a custom post type. When you <a href=\"http://codex.wordpress.org/Fun...
2013/11/11
[ "https://wordpress.stackexchange.com/questions/122939", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31344/" ]
Am a little new to custom post types, and maybe it's not the right solution to what I am trying to accomplish. What I am trying to accomplish: 1. User "Add New Property". This will have option to add image and 15 custom info fields. 2. All the properties that are added are displayed on a certain page. I've tried usi...
What you describe is the typical use case for a custom post type. When you [register your post type](http://codex.wordpress.org/Function_Reference/register_post_type), set the `has_archive` argument to `true` and WordPress will generate a custom post type archive page, which will be the list of all your property posts....
122,956
<p>I have a feeling that I'm on the right track, I just don't have enough solid PHP knowledge to get much further than where I'm currently at.</p> <p>I'm currently using the following code to return a list of child categories from a single category:</p> <pre><code>&lt;?php $taxonomyName = "category"; $terms =...
[ { "answer_id": 122957, "author": "Renish Khunt", "author_id": 40990, "author_profile": "https://wordpress.stackexchange.com/users/40990", "pm_score": 0, "selected": false, "text": "<p>you also used to display random sub category using shuffle function.</p>\n\n<pre><code>&lt;?php\n$term_i...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/122956", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12478/" ]
I have a feeling that I'm on the right track, I just don't have enough solid PHP knowledge to get much further than where I'm currently at. I'm currently using the following code to return a list of child categories from a single category: ``` <?php $taxonomyName = "category"; $terms = get_terms($taxonomyName...
So in order to do this, I needed to first do a for each loop, store the category slug as a variable, `JAMterm`, and then use that in a query to pull one random thumbnail from the category. Thanks to [@Renishkhunt](https://wordpress.stackexchange.com/users/40990/renishkhunt) for helping me along the way to get this ans...
122,961
<p>I have installed a third-party plugin for my wordpress site. What I want is to rename that plugin so that it matches my purpose for installing it. Is it possible?</p> <p>The plugin I'm trying to modify is CubePoints.. It's a pointing system for the users. But for the sake of better understanding, I'll be calling it...
[ { "answer_id": 122957, "author": "Renish Khunt", "author_id": 40990, "author_profile": "https://wordpress.stackexchange.com/users/40990", "pm_score": 0, "selected": false, "text": "<p>you also used to display random sub category using shuffle function.</p>\n\n<pre><code>&lt;?php\n$term_i...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/122961", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41500/" ]
I have installed a third-party plugin for my wordpress site. What I want is to rename that plugin so that it matches my purpose for installing it. Is it possible? The plugin I'm trying to modify is CubePoints.. It's a pointing system for the users. But for the sake of better understanding, I'll be calling it MyPoints ...
So in order to do this, I needed to first do a for each loop, store the category slug as a variable, `JAMterm`, and then use that in a query to pull one random thumbnail from the category. Thanks to [@Renishkhunt](https://wordpress.stackexchange.com/users/40990/renishkhunt) for helping me along the way to get this ans...
122,977
<p>I made a custom plugin for my wordpress admin for view user detail. This plugin is working fine after showing this error but the main issue is by this plugin , when i try to open some link the page went blank. I dont know why and what is this error..Searched on internet but unable to resolve this issue. Your help wo...
[ { "answer_id": 122985, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 3, "selected": true, "text": "<p>Your plugin is causing some errors, but not fatal ones, so plugin works, but as the error messages says, it ca...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/122977", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38118/" ]
I made a custom plugin for my wordpress admin for view user detail. This plugin is working fine after showing this error but the main issue is by this plugin , when i try to open some link the page went blank. I dont know why and what is this error..Searched on internet but unable to resolve this issue. Your help would...
Your plugin is causing some errors, but not fatal ones, so plugin works, but as the error messages says, it can cause some problems, i.e. the feed that can output the plugin error so not valid xml content, or when somewhere in the code there is a redirect once *"headers already sent"* it fail. If you are asking yourse...
122,993
<blockquote> <p>Public query vars are those available and usable via a direct URL query.</p> </blockquote> <p>E.g.</p> <pre class="lang-none prettyprint-override"><code>example.net/?category_name=tech&amp;tag=gadgets </code></pre> <p>But doesn't <code>example.net/?category_name=tech&amp;tag=gadgets</code> show a...
[ { "answer_id": 123020, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 3, "selected": true, "text": "<p>Try this:</p>\n\n<pre><code>add_action( 'template_redirect', 'my_test_if_archive' );\n\nfunction my_test_if_ar...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/122993", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10691/" ]
> > Public query vars are those available and usable via a direct URL > query. > > > E.g. ```none example.net/?category_name=tech&tag=gadgets ``` But doesn't `example.net/?category_name=tech&tag=gadgets` show an **archive**? It definitely uses the `archive.php` template, but for some reason, the `is_archive();...
Try this: ``` add_action( 'template_redirect', 'my_test_if_archive' ); function my_test_if_archive() { global $wp_query; $qv = array_keys( $wp_query->query ); $archives = array('year', 'monthnum', 'day', 'w', 'm', 'author', 'post_type'); $is_archive = ! empty( array_intersect( $qv, $archives ) ); $is_tax = ...
123,015
<p>What's the difference between:</p> <p><code>bloginfo('name');</code></p> <p>vs</p> <p><code>get_option('blogname');</code></p> <p>The parameter is just an example, but I see no differences in terms displaying what I want.</p> <p>Are there any particular differences? Or are they just for semantic reasons.</p> <...
[ { "answer_id": 123017, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>First of all, <code>bloginfo</code> will output value ;) If you want to get the value, you should use...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/123015", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35704/" ]
What's the difference between: `bloginfo('name');` vs `get_option('blogname');` The parameter is just an example, but I see no differences in terms displaying what I want. Are there any particular differences? Or are they just for semantic reasons. Thanks in advance.
The two functions output exactly the same thing. From the [Codex entry for `get_bloginfo()`](http://codex.wordpress.org/Function_Reference/get_bloginfo): > > 'name' - Returns the "Site Title" set in Settings > General. This data is retrieved from the "blogname" record in the wp\_options table. > > > From [source...
123,051
<p>How do I get how long since current user's last published post? For example:</p> <pre><code>It has been &lt;?php echo $days_since_last_post; ?&gt; days since your last post </code></pre> <p>I need to use that number in a variable for a plugin I am developing. </p> <p>I’m looking for a solution with performance in...
[ { "answer_id": 123058, "author": "David Kryzaniak", "author_id": 31548, "author_profile": "https://wordpress.stackexchange.com/users/31548", "pm_score": 2, "selected": false, "text": "<p>Sounds like you are looking for <code>get_most_recent_post_of_user()</code> <a href=\"http://codex.wo...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/123051", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42669/" ]
How do I get how long since current user's last published post? For example: ``` It has been <?php echo $days_since_last_post; ?> days since your last post ``` I need to use that number in a variable for a plugin I am developing.  I’m looking for a solution with performance in mind.
You can use a modified version of [this](https://wordpress.stackexchange.com/questions/122806/how-to-display-lastest-post-date-in-the-homepage/122822#122822) answer by **@s\_ha\_dum**. Where instead of an option you can setup a user meta (even if meta query is slower than option query) ``` add_action('save_post', 'us...
123,061
<p>Currently I asked my hosting provider to move my website from a windows server to a linux server. I'm trying to test if it works, but don't want to move the domain name just yet. I have to check if it works correctly. But when I try to login in wp-admin it redirects me to the old server. How can I change this?</p> ...
[ { "answer_id": 123071, "author": "pl4g4", "author_id": 38944, "author_profile": "https://wordpress.stackexchange.com/users/38944", "pm_score": 0, "selected": false, "text": "<p>In the database go to options table, and change the URLs field siteurl and home. You can use phpmyadmin or any ...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/123061", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34570/" ]
Currently I asked my hosting provider to move my website from a windows server to a linux server. I'm trying to test if it works, but don't want to move the domain name just yet. I have to check if it works correctly. But when I try to login in wp-admin it redirects me to the old server. How can I change this? The url...
I am assuming that you have both the Linux site and the (old) Windows site using the same database, and I am also assuming that the Linux server is operating currently on a numeric IP only until the migration. If that is the case, you do not want to alter the database at all-- not until you are ready for a proper migra...
123,066
<p>I have this function which outputs the last 6 posts of categories 1 and 2.</p> <pre><code>&lt;ul&gt; &lt;?php query_posts('cat=1,2&amp;showposts=6'); ?&gt; &lt;?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?&gt; &lt;li&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php the_title(); ...
[ { "answer_id": 123067, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 1, "selected": false, "text": "<p>This isn't really the most dynamic solution but you could do something like this:</p>\n\n<pre><code>&lt;ul&...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/123066", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23296/" ]
I have this function which outputs the last 6 posts of categories 1 and 2. ``` <ul> <?php query_posts('cat=1,2&showposts=6'); ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><strong><?php the_title(); ?></strong></a><br /> ...
Setting aside that you're incorrectly using `query_posts()`, the easiest solution is to add a call to [`post_class()`](http://codex.wordpress.org/Function_Reference/post_class), to output post-specific classes, including `.category-{ID}` and `.category-{slug}`: ``` <?php if ( have_posts() ) while ( have_posts() ) : th...
123,081
<p>I am currently displaying posts from a CPT. Each has a taxonomy term from a parent. I would like to create a function that would color the background of a div of particular parent terms.</p> <p>Here is my set up:</p> <p>Lets call this Cars:</p> <blockquote> <p>Domestic<br> --Dodge --Ford --Chrysler</p...
[ { "answer_id": 123067, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 1, "selected": false, "text": "<p>This isn't really the most dynamic solution but you could do something like this:</p>\n\n<pre><code>&lt;ul&...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/123081", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17612/" ]
I am currently displaying posts from a CPT. Each has a taxonomy term from a parent. I would like to create a function that would color the background of a div of particular parent terms. Here is my set up: Lets call this Cars: > > Domestic > > --Dodge > --Ford > --Chrysler > > > Import > > --Honda > --...
Setting aside that you're incorrectly using `query_posts()`, the easiest solution is to add a call to [`post_class()`](http://codex.wordpress.org/Function_Reference/post_class), to output post-specific classes, including `.category-{ID}` and `.category-{slug}`: ``` <?php if ( have_posts() ) while ( have_posts() ) : th...
123,087
<p>I have a baking blog that I run and recently I have changed the url. </p> <p>The problem I have now is when I add images to the posts or libary they are not showing/rendering. </p> <p>The uploading steps go through OK, but the image does not render. </p> <p>Can you assist, I just don't where I have gone wrong. </...
[ { "answer_id": 123067, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 1, "selected": false, "text": "<p>This isn't really the most dynamic solution but you could do something like this:</p>\n\n<pre><code>&lt;ul&...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/123087", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26170/" ]
I have a baking blog that I run and recently I have changed the url. The problem I have now is when I add images to the posts or libary they are not showing/rendering. The uploading steps go through OK, but the image does not render. Can you assist, I just don't where I have gone wrong.
Setting aside that you're incorrectly using `query_posts()`, the easiest solution is to add a call to [`post_class()`](http://codex.wordpress.org/Function_Reference/post_class), to output post-specific classes, including `.category-{ID}` and `.category-{slug}`: ``` <?php if ( have_posts() ) while ( have_posts() ) : th...
123,089
<p>Hi I want to customize the text with the arrows pointed at at the image I have uploaded. I have managed to customize some but I cannot find the file to customize the rest.<img src="https://i.stack.imgur.com/eXlKt.jpg" alt="enter image description here"> </p> <p>Many thanks</p> <p>its on local host, and it is a cus...
[ { "answer_id": 123114, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p>Presumably you've used <a href=\"http://codex.wordpress.org/Function_Reference/wp_list_comments\" rel=\"nofol...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/123089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34320/" ]
Hi I want to customize the text with the arrows pointed at at the image I have uploaded. I have managed to customize some but I cannot find the file to customize the rest.![enter image description here](https://i.stack.imgur.com/eXlKt.jpg) Many thanks its on local host, and it is a custom theme.
Presumably you've used [`wp_list_comments`](http://codex.wordpress.org/Function_Reference/wp_list_comments) to display the comments. That being the case, what you need to do is create a callback function to format your comments and pass that callback into `wp_list_comments` like so: ``` wp_list_comments(array('callbac...
123,097
<p>Having some trouble with <a href="http://wordpress.org/plugins/taxonomy-images/" rel="nofollow">taxonomy images plugin</a>.</p> <p>I am on single-post.php and I want to display my post's taxonomy terms &amp; the term's associated images. Ideally, I'd like the taxonomy description there too. No idea why this has me ...
[ { "answer_id": 144265, "author": "Andy Johnsen", "author_id": 51616, "author_profile": "https://wordpress.stackexchange.com/users/51616", "pm_score": 2, "selected": false, "text": "<p>I was having trouble with this too. Wanted to show all the term images on a single post page. I found t...
2013/11/12
[ "https://wordpress.stackexchange.com/questions/123097", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25146/" ]
Having some trouble with [taxonomy images plugin](http://wordpress.org/plugins/taxonomy-images/). I am on single-post.php and I want to display my post's taxonomy terms & the term's associated images. Ideally, I'd like the taxonomy description there too. No idea why this has me stumped because it seems like it should ...
I was having trouble with this too. Wanted to show all the term images on a single post page. I found that you need to loop through the terms first (in my case, taxonomy=st\_colors), then loop through the images associated with those terms. Here is how I solved it: ``` <?php $terms = get_the_terms( $post->ID, 'st_...
123,132
<p>I am designing a site that the client wants to only have members use their email to log in and no password. </p> <p>Here is the old site and they want something like this. Is this possible with WordPress. I'm also using WP-Members plugin. </p> <p><a href="http://waiscon.com/planRoom.htm" rel="nofollow noreferrer">...
[ { "answer_id": 123134, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>You could use <code>authenticate</code> filter for that. Below you can see how it's called:</p>\n\n<p...
2013/11/13
[ "https://wordpress.stackexchange.com/questions/123132", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42698/" ]
I am designing a site that the client wants to only have members use their email to log in and no password. Here is the old site and they want something like this. Is this possible with WordPress. I'm also using WP-Members plugin. <http://waiscon.com/planRoom.htm>
You could use `authenticate` filter for that. Below you can see how it's called: ``` $user = apply_filters('authenticate', null, $username, $password); ``` So if you write your own filter which will select user only based on login/username, then it should work (maybe some other minor tweaks would be necessary). PS....
123,141
<p><strong>Editing core files is never an option.</strong> - the question is NOT to edit core files, but rather find a way to replace certain files using a plugin or other built in function. </p> <p>I require more control over what is being displayed by a core wordpress file and the file contains no hooks I can use. <...
[ { "answer_id": 123153, "author": "user42701", "author_id": 42701, "author_profile": "https://wordpress.stackexchange.com/users/42701", "pm_score": 0, "selected": false, "text": "<p>By replacing core files if you mean you'll replace files under folder <code>WP-ADMIN</code> and <code>WP-IN...
2013/11/13
[ "https://wordpress.stackexchange.com/questions/123141", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1426/" ]
**Editing core files is never an option.** - the question is NOT to edit core files, but rather find a way to replace certain files using a plugin or other built in function. I require more control over what is being displayed by a core wordpress file and the file contains no hooks I can use. Is it possible to use ...
Yes, it is possible. You can modify that file and use it. But... It will be a lot of work to maintain those changes. You'll have to merge them after every WordPress update and check if these changes don't break anything in WP. That's why such modifications aren't very common practice and they're not recommended.
123,149
<p>I want to check if a variable contains list of post IDs, then I want to query the posts of those IDs only, but if that variable is empty then I want to display all posts.</p> <p>Problem: If I supply IDs to <code>post__in</code>, then it gets the posts with those IDs, but if it is empty then it should return <strong...
[ { "answer_id": 123155, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": true, "text": "<p>It looks like WordPress doesn't ignore empty <code>post__in</code> param. So you'll have to do this yo...
2013/11/13
[ "https://wordpress.stackexchange.com/questions/123149", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38318/" ]
I want to check if a variable contains list of post IDs, then I want to query the posts of those IDs only, but if that variable is empty then I want to display all posts. Problem: If I supply IDs to `post__in`, then it gets the posts with those IDs, but if it is empty then it should return **all posts** but it returns...
It looks like WordPress doesn't ignore empty `post__in` param. So you'll have to do this yourself like this... ``` $ids = '1,2,3'; if ( $ids ) { $arr = explode("," ,$ids); $args = array( 'posts_per_page' => $number, 'post__in' => $arr ); } else { $args = array( 'posts_per_...
123,192
<p>I have used theme twenty thirteen a my base theme and Have tried used code from <a href="https://stackoverflow.com/questions/12159486/wordpress-change-header-navigation-list-items-to-div">https://stackoverflow.com/questions/12159486/wordpress-change-header-navigation-list-items-to-div</a> when I try to validate the ...
[ { "answer_id": 123155, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": true, "text": "<p>It looks like WordPress doesn't ignore empty <code>post__in</code> param. So you'll have to do this yo...
2013/11/13
[ "https://wordpress.stackexchange.com/questions/123192", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42716/" ]
I have used theme twenty thirteen a my base theme and Have tried used code from <https://stackoverflow.com/questions/12159486/wordpress-change-header-navigation-list-items-to-div> when I try to validate the page I get an error with invalid trailing `</li>` tags I am trying to create this result from the walker class `...
It looks like WordPress doesn't ignore empty `post__in` param. So you'll have to do this yourself like this... ``` $ids = '1,2,3'; if ( $ids ) { $arr = explode("," ,$ids); $args = array( 'posts_per_page' => $number, 'post__in' => $arr ); } else { $args = array( 'posts_per_...
123,197
<p>So, I have this shortcode that produces a list of all published multisite and their pages. The network in question has about 50 sites in it. The problem is that loading the page I put the shortcode on takes an extra couple of seconds to load. So performance blows. Wondering what I can do to optimize this. Thoughts?<...
[ { "answer_id": 123223, "author": "Pat J", "author_id": 16121, "author_profile": "https://wordpress.stackexchange.com/users/16121", "pm_score": 1, "selected": false, "text": "<p>I see a few things that you might try to shortcut things:</p>\n\n<ol>\n<li><p>Currently a Multisite network onl...
2013/11/13
[ "https://wordpress.stackexchange.com/questions/123197", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20910/" ]
So, I have this shortcode that produces a list of all published multisite and their pages. The network in question has about 50 sites in it. The problem is that loading the page I put the shortcode on takes an extra couple of seconds to load. So performance blows. Wondering what I can do to optimize this. Thoughts? ``...
I see a few things that you might try to shortcut things: 1. Currently a Multisite network only allows one site ID, according to [the Codex page for `$wpdb->siteid`](http://codex.wordpress.org/Class_Reference/wpdb#Multi-Site_Variables). Also, the site ID is defined in your wp-config.php file as a constant, `BLOG_ID_CU...
123,198
<p>Im having a problem to register and load a gallery css code from my home page. Rest of the styles are loading fine, but this flexslider is not registering. Any guidance appreciated.</p> <pre><code>&lt;?php function theme_styles() { wp_enqueue_style ('normalize', get_template_directory_uri() . '/css/normalize.css...
[ { "answer_id": 123206, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": true, "text": "<p>The primary issue is an incorrect template conditional tag:</p>\n\n<pre><code>if( is_page( 'home' ) ) {}\n<...
2013/11/13
[ "https://wordpress.stackexchange.com/questions/123198", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34320/" ]
Im having a problem to register and load a gallery css code from my home page. Rest of the styles are loading fine, but this flexslider is not registering. Any guidance appreciated. ``` <?php function theme_styles() { wp_enqueue_style ('normalize', get_template_directory_uri() . '/css/normalize.css'); wp_enqueue_st...
The primary issue is an incorrect template conditional tag: ``` if( is_page( 'home' ) ) {} ``` This returns true if the current context is a *static page*, with the slug `home`. I presume that you're *actually* wanting to test for the **Site Front Page** - in which case you need to use the [`is_front_page()`](http:/...
123,205
<p>Using WordPress 3.7.1 and PHP 5.4.12, I am trying to add Custom Post Type and Taxonomy to my Theme, so far the custom post type method works but the Taxonomy is not adding to the Admin Dashboard.</p> <p>Here is the code I have:</p> <pre><code>&lt;?php function add_post_type($name, $args = array()) { add_actio...
[ { "answer_id": 123206, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": true, "text": "<p>The primary issue is an incorrect template conditional tag:</p>\n\n<pre><code>if( is_page( 'home' ) ) {}\n<...
2013/11/13
[ "https://wordpress.stackexchange.com/questions/123205", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42721/" ]
Using WordPress 3.7.1 and PHP 5.4.12, I am trying to add Custom Post Type and Taxonomy to my Theme, so far the custom post type method works but the Taxonomy is not adding to the Admin Dashboard. Here is the code I have: ``` <?php function add_post_type($name, $args = array()) { add_action('init', function() use...
The primary issue is an incorrect template conditional tag: ``` if( is_page( 'home' ) ) {} ``` This returns true if the current context is a *static page*, with the slug `home`. I presume that you're *actually* wanting to test for the **Site Front Page** - in which case you need to use the [`is_front_page()`](http:/...
123,257
<p>I need to exclude posts that have a custom field 'city' value of 'Melbourne'.</p> <p>After much searching I think the solution might consist of 2 parts.</p> <p>In functions.php : A function to get the post IDs for all posts which have a custom field 'city' value of 'Melbourne'.</p> <p>Then in my loop : Exclude th...
[ { "answer_id": 123258, "author": "Kumar", "author_id": 32466, "author_profile": "https://wordpress.stackexchange.com/users/32466", "pm_score": 3, "selected": false, "text": "<p>You can use meta query in wp query to get required posts</p>\n\n<pre><code> $args = array(\n 'meta_query' =&...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123257", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42741/" ]
I need to exclude posts that have a custom field 'city' value of 'Melbourne'. After much searching I think the solution might consist of 2 parts. In functions.php : A function to get the post IDs for all posts which have a custom field 'city' value of 'Melbourne'. Then in my loop : Exclude these posts using the post...
You can use meta query in wp query to get required posts ``` $args = array( 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'city', 'value' => 'Melbourne', 'compare' => 'NOT LIKE' ), array( 'key' => 'city', 'value' => 'Melbourne', '...
123,270
<p>I'm tryying to prevent search engines from indexing my 404 page which is in a template called 404.php. I do not create an actual page, I simply rely on the php template for my 404 errors.</p> <p>I'm using the code below and it's not working, I'm unsure what the best way to go about this is and I would appreciate h...
[ { "answer_id": 123273, "author": "kjid", "author_id": 42750, "author_profile": "https://wordpress.stackexchange.com/users/42750", "pm_score": 0, "selected": false, "text": "<p>Isn't this fixed by creating a robot.txt at the root of your ftp like so:</p>\n\n<pre><code>User-agent: *\nDisal...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123270", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5205/" ]
I'm tryying to prevent search engines from indexing my 404 page which is in a template called 404.php. I do not create an actual page, I simply rely on the php template for my 404 errors. I'm using the code below and it's not working, I'm unsure what the best way to go about this is and I would appreciate help. ``` <...
This won't ever return true: ``` if ( is_single( '404.php' ) ) {} ``` The [`is_single()`](http://codex.wordpress.org/Function_Reference/is_single) conditional only returns true in a *single blog post* context. The parameter it accepts is a post ID, slug, or title. The `404.php` file is a *template file*, not a *pos...
123,272
<p>I have a site running 3.7.1 where posts are sporadically failing to post on schedule. </p> <p>Unlike the "missed schedule" error that sometimes occurs, these misses don't generate any notification and the posts are not flagged in any way. </p> <p>In the posts that have failed to publish, reviewing the settings sh...
[ { "answer_id": 123273, "author": "kjid", "author_id": 42750, "author_profile": "https://wordpress.stackexchange.com/users/42750", "pm_score": 0, "selected": false, "text": "<p>Isn't this fixed by creating a robot.txt at the root of your ftp like so:</p>\n\n<pre><code>User-agent: *\nDisal...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123272", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40439/" ]
I have a site running 3.7.1 where posts are sporadically failing to post on schedule. Unlike the "missed schedule" error that sometimes occurs, these misses don't generate any notification and the posts are not flagged in any way. In the posts that have failed to publish, reviewing the settings shows that WordPress...
This won't ever return true: ``` if ( is_single( '404.php' ) ) {} ``` The [`is_single()`](http://codex.wordpress.org/Function_Reference/is_single) conditional only returns true in a *single blog post* context. The parameter it accepts is a post ID, slug, or title. The `404.php` file is a *template file*, not a *pos...
123,277
<p>I want to exclude Subscribers from a user list. My code is:</p> <pre><code>$users = $wpdb-&gt;get_results( "SELECT display_name FROM $wpdb-&gt;users ORDER BY display_name ASC" ); </code></pre> <p>How can I change that so subscribers are excluded from the list?</p> <p>I also looked at the get_users function in cod...
[ { "answer_id": 123273, "author": "kjid", "author_id": 42750, "author_profile": "https://wordpress.stackexchange.com/users/42750", "pm_score": 0, "selected": false, "text": "<p>Isn't this fixed by creating a robot.txt at the root of your ftp like so:</p>\n\n<pre><code>User-agent: *\nDisal...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123277", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42669/" ]
I want to exclude Subscribers from a user list. My code is: ``` $users = $wpdb->get_results( "SELECT display_name FROM $wpdb->users ORDER BY display_name ASC" ); ``` How can I change that so subscribers are excluded from the list? I also looked at the get\_users function in codex but it did not have an exclude by r...
This won't ever return true: ``` if ( is_single( '404.php' ) ) {} ``` The [`is_single()`](http://codex.wordpress.org/Function_Reference/is_single) conditional only returns true in a *single blog post* context. The parameter it accepts is a post ID, slug, or title. The `404.php` file is a *template file*, not a *pos...
123,278
<p>I have a blog with a lot (over 1000) images. Each image has a meaningful descriptive filename. Wordpress has title caption and description fields for images. What's the easiest way to batch process all images and copy the file name to the title alt description and caption fields. Also if I could update yoast seo fie...
[ { "answer_id": 123300, "author": "eskimo", "author_id": 36783, "author_profile": "https://wordpress.stackexchange.com/users/36783", "pm_score": 3, "selected": false, "text": "<p>You can make a query to loop through all the attachments, and then update the attachment info for each attachm...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123278", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34731/" ]
I have a blog with a lot (over 1000) images. Each image has a meaningful descriptive filename. Wordpress has title caption and description fields for images. What's the easiest way to batch process all images and copy the file name to the title alt description and caption fields. Also if I could update yoast seo fields...
You can make a query to loop through all the attachments, and then update the attachment info for each attachment in the while loop. Something like ``` $args = array( 'post_type' => 'attachments', 'post_status' => 'any', 'posts_per_page' => -1, ) $query = new WP_Query($args) if($query->have_posts()): whil...
123,292
<p>If trying to filter out some return results from a custom post type that has a custom field appended to it for location. I'm not too sure where I need to apply the case statement in my query. Or if I need to add it into the query when it pulls the info from the post type.</p> <p>I currently have this:</p> <pre><co...
[ { "answer_id": 123349, "author": "Laurence Tuck", "author_id": 1426, "author_profile": "https://wordpress.stackexchange.com/users/1426", "pm_score": 1, "selected": false, "text": "<p>I'm assuming this is the plugin: <a href=\"http://wordpress.org/plugins/list-category-posts/\" rel=\"nofo...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123292", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16613/" ]
If trying to filter out some return results from a custom post type that has a custom field appended to it for location. I'm not too sure where I need to apply the case statement in my query. Or if I need to add it into the query when it pulls the info from the post type. I currently have this: ``` <?php $mypost = ar...
This was implemented for version 0.36 with the `link_target` attribute: **link\_target** - Select the `target` attribute for links to posts (target=\_blank, \_self, \_parent, \_top, *framename*). Example: `[catlink id=3 link_target=_blank]` will create: `<a href="http://localhost/wordpress/?p=45" title="Test post" t...
123,298
<p>I had a template that relied on</p> <p><code>$terms = get_terms( "ingredient", array( 'name__like' =&gt; $letter ) );</code></p> <p>to return all posts where the custom taxonomy <code>ingredient</code> begins with <code>$letter</code>. </p> <p>The behaviour of <code>name__like</code> <a href="http://codex.wordpre...
[ { "answer_id": 123301, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 1, "selected": false, "text": "<p>This is a trick.</p>\n\n<p>Prepend to the letter you want to search a <em>strange</em> string:</p>\n\n<pre><c...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123298", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26135/" ]
I had a template that relied on `$terms = get_terms( "ingredient", array( 'name__like' => $letter ) );` to return all posts where the custom taxonomy `ingredient` begins with `$letter`. The behaviour of `name__like` [was changed in WP 3.7](http://codex.wordpress.org/Function_Reference/get_terms#Parameters) to a tex...
You will need to filter the query, which you can do with the `terms_clauses` hook. This is very similar to G-M's solution but does not require a prefix on your search string. ``` function old_style_name_like_wpse_123298($clauses) { remove_filter('term_clauses','old_style_name_like_wpse_123298'); $pattern = '|(name...
123,307
<p>I'm having a really hard time trying to use the <code>http_request_host_is_external</code> filter. For some background, I'm trying to set up a separate server to handle private plugin and theme updates. The problem is that it's on a separate server, so the Wordpress <code>wp_http_validate_url</code> (wp-includes/h...
[ { "answer_id": 123310, "author": "Jack Slingerland", "author_id": 796, "author_profile": "https://wordpress.stackexchange.com/users/796", "pm_score": 0, "selected": false, "text": "<p>I'm apparently a little rusty. This took care of it for me:</p>\n\n<pre><code>add_filter( 'http_request...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123307", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/796/" ]
I'm having a really hard time trying to use the `http_request_host_is_external` filter. For some background, I'm trying to set up a separate server to handle private plugin and theme updates. The problem is that it's on a separate server, so the Wordpress `wp_http_validate_url` (wp-includes/http.php) function kills the...
You can do this: ``` add_filter( 'http_request_host_is_external', '__return_true' ); ``` However, note that this disables this security feature. If you know the host or url isn't going to change and is always going to be that, you can be more secure by checking for that explicitly: ``` add_filter( 'http_request_hos...
123,311
<p>I've googled a lot, and I do have found answers at WordPress SE and at stackoverflow.com. However, the answers are somewhat incomplete or doesn't work at all. Here I'll explain my problem in detail, give my progress on the problem and the obstacles I'm facing in solving the problem.</p> <p><strong>Assumptions:-</st...
[ { "answer_id": 123315, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 3, "selected": true, "text": "<p>Once you have same db, you will have same users, so offcouse the password for the user 'admin' (please do not ...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123311", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36718/" ]
I've googled a lot, and I do have found answers at WordPress SE and at stackoverflow.com. However, the answers are somewhat incomplete or doesn't work at all. Here I'll explain my problem in detail, give my progress on the problem and the obstacles I'm facing in solving the problem. **Assumptions:-** 1. Plugins and t...
Once you have same db, you will have same users, so offcouse the password for the user 'admin' (please do not use 'admin' as username) will be the one setted in database, and of course is the same for the 2 sites, once they shared the db. However you can create users that can login only in one site and users that can ...
123,340
<p>in wordpress template sidebar and recent posts or recent comments blocks:</p> <p>when title has more than 30 characters new line created and its not good display</p> <p>you can see this image for understand what i say:</p> <p><img src="https://i.stack.imgur.com/I1ydI.png" alt=""></p> <p>style for side bar ul li ...
[ { "answer_id": 123341, "author": "Hugosolar", "author_id": 89289, "author_profile": "https://wordpress.stackexchange.com/users/89289", "pm_score": 0, "selected": false, "text": "<p>You can use the PHP <a href=\"http://www.php.net/manual/es/function.substr.php\" rel=\"nofollow\">substr fu...
2013/11/14
[ "https://wordpress.stackexchange.com/questions/123340", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42757/" ]
in wordpress template sidebar and recent posts or recent comments blocks: when title has more than 30 characters new line created and its not good display you can see this image for understand what i say: ![](https://i.stack.imgur.com/I1ydI.png) style for side bar ul li is : ``` #body-right ul li a { background:...
i change body-right css height:28px; to min-height:28px; and problem solved
123,387
<p>i have changed the wordpress custom structure permalink to <code>/%post_id%/%postname%/</code> and get this error :</p> <p><strong>404 Not Found The requested URL /mysite/blog/1/hello-world/ was not found on this server.</strong></p> <ul> <li>wordpress version <strong><em>3.1.7</em></strong> </li> <li>site ad...
[ { "answer_id": 123400, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 2, "selected": true, "text": "<p>Mehdi, it's common problem, as Apache server is not set by this way by default. Your problem can be sol...
2013/11/15
[ "https://wordpress.stackexchange.com/questions/123387", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42780/" ]
i have changed the wordpress custom structure permalink to `/%post_id%/%postname%/` and get this error : **404 Not Found The requested URL /mysite/blog/1/hello-world/ was not found on this server.** * wordpress version ***3.1.7*** * site address: **localhost/mysite/blog** i'v changed this function in **misc.php** an...
Mehdi, it's common problem, as Apache server is not set by this way by default. Your problem can be solved with some very simple steps (simply quoting Samuel B): > > If you want to use permalinks, you will need to make a change inside another file: > apache > Conf and find the file `httpd.conf`. Open that in a text ...
123,401
<p>I am having a bit of a strange issue with rewrite rules not flushing properly.</p> <p>I have tried using <code>flush_rewrite_rules();</code> and <code>flush_rewrite_rules(true);</code>.</p> <p>I have also tried globalizing <code>$wp_rewrite</code> using <code>$wp_rewrite-&gt;flush_rules();</code> and <code>$wp_rew...
[ { "answer_id": 123403, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 3, "selected": false, "text": "<p>The best place to flush rewrite rules is on plugin activation/deactivation. </p>\n\n<pre><code>function ...
2013/11/15
[ "https://wordpress.stackexchange.com/questions/123401", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9579/" ]
I am having a bit of a strange issue with rewrite rules not flushing properly. I have tried using `flush_rewrite_rules();` and `flush_rewrite_rules(true);`. I have also tried globalizing `$wp_rewrite` using `$wp_rewrite->flush_rules();` and `$wp_rewrite->flush_rules(true);` Neither of which appear to be flushing th...
The best place to flush rewrite rules is on plugin activation/deactivation. ``` function myplugin_activate() { // register taxonomies/post types here flush_rewrite_rules(); } register_activation_hook( __FILE__, 'myplugin_activate' ); function myplugin_deactivate() { flush_rewrite_rules(); } register_dea...
123,413
<p>I am using <code>get_the_title(453)</code> and while the title displays, i am unable to display the content and the excerpt for the page with the id of 453. The following is my code</p> <pre><code> get_the_title(453); $content = get_the_content(); echo $content; the_excerpt(); </code></pre> <p>...
[ { "answer_id": 123415, "author": "psorensen", "author_id": 38536, "author_profile": "https://wordpress.stackexchange.com/users/38536", "pm_score": 0, "selected": false, "text": "<p>get_the_title will only retrieve the title of the post you designate. That post data will not carry on to o...
2013/11/15
[ "https://wordpress.stackexchange.com/questions/123413", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33028/" ]
I am using `get_the_title(453)` and while the title displays, i am unable to display the content and the excerpt for the page with the id of 453. The following is my code ``` get_the_title(453); $content = get_the_content(); echo $content; the_excerpt(); ``` Is there is something i am missing or...
I figured it out myself and it worked. Here is the code if anyone need any help. ``` $the_query = new WP_Query('page_id=1') ; if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); the_title(); the_content(); the_excerpt(); } } else { // n...
123,418
<p>I know this question has been asked a thousand times, but feel like I've looked at every single article on this issue, and none of them have worked for me. </p> <p>All I want is for there to be a category page for my custom post type, products. So that I can type www.mysite.com/products and see all the products. Or...
[ { "answer_id": 123419, "author": "Por", "author_id": 31832, "author_profile": "https://wordpress.stackexchange.com/users/31832", "pm_score": 2, "selected": false, "text": "<p>If you use custom taxonomy post type, you can create <code>taxonomy-your-taxonomy-post-type.php</code>.</p>\n\n<p...
2013/11/15
[ "https://wordpress.stackexchange.com/questions/123418", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42796/" ]
I know this question has been asked a thousand times, but feel like I've looked at every single article on this issue, and none of them have worked for me. All I want is for there to be a category page for my custom post type, products. So that I can type www.mysite.com/products and see all the products. Or if it's e...
First, your taxonomy code has a missing comma before `$args` which is causing a fatal error: ``` register_taxonomy( 'product_category', 'product', $args ); ``` [Enable debugging](http://codex.wordpress.org/Debugging_in_WordPress) while working on code to see PHP errors, which would reveal the line number and error. ...
123,436
<p>I have the following lines of code in my website that will display the <strong><em>related products</em></strong> at the bottom of my single product page in WooCommerce...</p> <p><strong>functions.php:</strong></p> <pre><code>// display upsells and related products within dedicated div with different column and nu...
[ { "answer_id": 123464, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 6, "selected": true, "text": "<p><strong>Firstly</strong>, you can't immediately achieve the goal you described with the code you sho...
2013/11/16
[ "https://wordpress.stackexchange.com/questions/123436", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28275/" ]
I have the following lines of code in my website that will display the ***related products*** at the bottom of my single product page in WooCommerce... **functions.php:** ``` // display upsells and related products within dedicated div with different column and number of products remove_action( 'woocommerce_after_sin...
**Firstly**, you can't immediately achieve the goal you described with the code you show in your question. To understand why there isn't a direct approach with that code you have to take a look at what you're using - [`woocommerce_related_products()`](http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_rel...
123,439
<p>I need help figuring out how the radio button saves it's value in the theme settings.</p> <p>In my theme I added Radio buttons in the theme customizer. So far they are working great. Although I have one issue. I can't seem to set a default setting for them, so if I install my theme on a new install, or someone else...
[ { "answer_id": 225703, "author": "Sophy", "author_id": 93541, "author_profile": "https://wordpress.stackexchange.com/users/93541", "pm_score": 2, "selected": false, "text": "<p>It is a long question but it is possible for some developers I would like to give this answer.</p>\n\n<p>Exampl...
2013/11/16
[ "https://wordpress.stackexchange.com/questions/123439", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31618/" ]
I need help figuring out how the radio button saves it's value in the theme settings. In my theme I added Radio buttons in the theme customizer. So far they are working great. Although I have one issue. I can't seem to set a default setting for them, so if I install my theme on a new install, or someone else does. Tha...
It is a long question but it is possible for some developers I would like to give this answer. Example: I have two choose for my home layout `Grid` and `List` and I prefer `Grid` is default choosing. I should add default value in `add_setting` simple like this `'default' => 'grid'`. ``` $wp_customize->add_setting('yo...
123,444
<p>I have a plugin to be translated. I have done following tasks:</p> <p>1. Loaded the TextDomain</p> <pre><code>$my_td = 'mysignup'; function my_signup_textdomain_init() { load_plugin_textdomain( $my_td, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } add_action('plugins_loaded', 'my_signup_te...
[ { "answer_id": 123459, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 2, "selected": false, "text": "<p>For plugins using the directory referred to by load_plugin_textdomain, the language files should be named \"domain...
2013/11/16
[ "https://wordpress.stackexchange.com/questions/123444", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33522/" ]
I have a plugin to be translated. I have done following tasks: 1. Loaded the TextDomain ``` $my_td = 'mysignup'; function my_signup_textdomain_init() { load_plugin_textdomain( $my_td, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } add_action('plugins_loaded', 'my_signup_textdomain_init'); ```...
I got my mistakes! I done everything good except 1 thing, textdomain setup. I forgot that i have set the `$my_td` variable outside of function. For this reason, my textdomain was missing. So i made the variable **global** as following: ``` $my_td = 'mysignup'; function my_signup_textdomain_init() { global $my_td;...
123,447
<p>I need to add some scrips for Google Maps only in my contact page and I do not want to populate it on all pages. I am not willing to create a custom header as well so I was thinking is there any way to populate the js file only on contact page? currently I am using this code to add javascript to theme</p> <pre><c...
[ { "answer_id": 123459, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 2, "selected": false, "text": "<p>For plugins using the directory referred to by load_plugin_textdomain, the language files should be named \"domain...
2013/11/16
[ "https://wordpress.stackexchange.com/questions/123447", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31793/" ]
I need to add some scrips for Google Maps only in my contact page and I do not want to populate it on all pages. I am not willing to create a custom header as well so I was thinking is there any way to populate the js file only on contact page? currently I am using this code to add javascript to theme ``` //Load Scrip...
I got my mistakes! I done everything good except 1 thing, textdomain setup. I forgot that i have set the `$my_td` variable outside of function. For this reason, my textdomain was missing. So i made the variable **global** as following: ``` $my_td = 'mysignup'; function my_signup_textdomain_init() { global $my_td;...
123,453
<p>I made a simple function for post_meta, in <code>functions.php</code>:</p> <pre><code>// Top Sub Heading (top_sub) FROM CUSTOM FIELD function topSub( $Trunckvalue = null ) { global $post; $TopSub = get_post_meta( $post-&gt;ID, 'top_sub', $single=true ); $shortTopSub = trunck_string( $TopSub, $Trunckvalu...
[ { "answer_id": 123454, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 2, "selected": false, "text": "<p>Got the answer from:<br/>\n&raquo; <a href=\"http://themeforest.net/forums/thread/trying-to-get-proper...
2013/11/16
[ "https://wordpress.stackexchange.com/questions/123453", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22728/" ]
I made a simple function for post\_meta, in `functions.php`: ``` // Top Sub Heading (top_sub) FROM CUSTOM FIELD function topSub( $Trunckvalue = null ) { global $post; $TopSub = get_post_meta( $post->ID, 'top_sub', $single=true ); $shortTopSub = trunck_string( $TopSub, $Trunckvalue, true ); if ( !$TopSu...
`$post` is never set on `init` when I test this-- ``` function topSub( $Trunckvalue = null ) { global $post; var_dump($post); } add_action( 'init', 'topSub' ); ``` The earliest hook I can find (by experimentation, not a canonical statement) is `wp`. Aditionally, `$post` is set on archive pages as well as "...
123,465
<p>I'm developing a gallery plugin and I was wondering if I could add a YouTube and Vimeo "embed" option to the media uploader to be able to add YouTube and Vimeo videos as attachments to a post instead of uploading the video files directly to the server. I'm thinking along the lines of an option with a textarea where ...
[ { "answer_id": 123454, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 2, "selected": false, "text": "<p>Got the answer from:<br/>\n&raquo; <a href=\"http://themeforest.net/forums/thread/trying-to-get-proper...
2013/11/16
[ "https://wordpress.stackexchange.com/questions/123465", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33049/" ]
I'm developing a gallery plugin and I was wondering if I could add a YouTube and Vimeo "embed" option to the media uploader to be able to add YouTube and Vimeo videos as attachments to a post instead of uploading the video files directly to the server. I'm thinking along the lines of an option with a textarea where one...
`$post` is never set on `init` when I test this-- ``` function topSub( $Trunckvalue = null ) { global $post; var_dump($post); } add_action( 'init', 'topSub' ); ``` The earliest hook I can find (by experimentation, not a canonical statement) is `wp`. Aditionally, `$post` is set on archive pages as well as "...
123,496
<p>I would like use two loops in the results after a search.</p> <p>First of all, I begin the loop if there is result </p> <pre><code>&lt;?php if (have_posts()) : ?&gt; &lt;?php while (have_posts()) : the_post(); ?&gt; </code></pre> <p>and after a loop to display the articles belonging a category</p> <pre><code>&l...
[ { "answer_id": 123454, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 2, "selected": false, "text": "<p>Got the answer from:<br/>\n&raquo; <a href=\"http://themeforest.net/forums/thread/trying-to-get-proper...
2013/11/16
[ "https://wordpress.stackexchange.com/questions/123496", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42755/" ]
I would like use two loops in the results after a search. First of all, I begin the loop if there is result ``` <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> ``` and after a loop to display the articles belonging a category ``` <?php $cats = get_categories(); foreach ($cats as $cat...
`$post` is never set on `init` when I test this-- ``` function topSub( $Trunckvalue = null ) { global $post; var_dump($post); } add_action( 'init', 'topSub' ); ``` The earliest hook I can find (by experimentation, not a canonical statement) is `wp`. Aditionally, `$post` is set on archive pages as well as "...
123,526
<p>I am trying to load JS files in my theme's to footer.All my custom JS files are being added to WordPress using <code>wp_enqueue_script</code>, but i am unable to find any way which will help me to load them in footer.</p> <p>one possible way is to</p> <pre><code>remove_action('wp_head', 'wp_print_scripts'); remove...
[ { "answer_id": 123545, "author": "AurelienT", "author_id": 42833, "author_profile": "https://wordpress.stackexchange.com/users/42833", "pm_score": 0, "selected": false, "text": "<p>From the <a href=\"http://codex.wordpress.org/Function_Reference/wp_enqueue_script\" rel=\"nofollow\">Codex...
2013/11/17
[ "https://wordpress.stackexchange.com/questions/123526", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9415/" ]
I am trying to load JS files in my theme's to footer.All my custom JS files are being added to WordPress using `wp_enqueue_script`, but i am unable to find any way which will help me to load them in footer. one possible way is to ``` remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_hea...
Check out [this tutorial](http://unserkaiser.com/blog/2013/10/08/how-to-move-wordpress-core-javascript-to-the-footer/) by [kaiser](https://wordpress.stackexchange.com/users/385/kaiser) and go step by step: > > Every time I register a script and add jquery as dependency, it gets > added to the `<head>` in the finally...
123,538
<p>I am making a simple sidebar functionality to display embed video in the sidebar. I've created a meta field where admin should paste the embed video. It works as it should on posts, but on pages, <code>get_the_ID()</code> is always returning the same ID, 145, ID of one of the posts.</p> <p>Here is the code I am usi...
[ { "answer_id": 123539, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 1, "selected": false, "text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/get_the_ID\" rel=\"nofollow\"><code>get_the_ID</code>...
2013/11/17
[ "https://wordpress.stackexchange.com/questions/123538", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34571/" ]
I am making a simple sidebar functionality to display embed video in the sidebar. I've created a meta field where admin should paste the embed video. It works as it should on posts, but on pages, `get_the_ID()` is always returning the same ID, 145, ID of one of the posts. Here is the code I am using: ``` <?php $...
There is some other query which replaces the main post ID. Might be another widget, some strange plugin code or something else If you have no control over the context, collect the post ID earlier: ``` add_action( 'template_redirect', 'collect_post_id' ); function collect_post_id() { static $id = 0; if ( 'tem...
123,542
<p>I want include function to resize featured image to 80x80, im add this code in my function.php</p> <pre><code>add_theme_support('post-thumbnails'); set_post_thumbnail_size(80, 80); </code></pre> <p>But is not work very good, images is not resized, looks like scaled to 80x65 or something.. i need exactly 80x80 on ...
[ { "answer_id": 123543, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>I believe you need to pass the third <code>$crop</code> parameter to <code>set_post_thumbnail_size</code>. I...
2013/11/17
[ "https://wordpress.stackexchange.com/questions/123542", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40855/" ]
I want include function to resize featured image to 80x80, im add this code in my function.php ``` add_theme_support('post-thumbnails'); set_post_thumbnail_size(80, 80); ``` But is not work very good, images is not resized, looks like scaled to 80x65 or something.. i need exactly 80x80 on every images uploaded...
I believe you need to pass the third `$crop` parameter to `set_post_thumbnail_size`. In other words... ``` set_post_thumbnail_size(80, 80, true); ``` That third parameter enables a "hard-crop" mode. [From the Codex](http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size): > > Set the default Post T...
123,547
<p>I want to include a script in a shortcode output, so I am trying this:</p> <pre><code>function my_shortcode( $atts, $content = null ) { extract(shortcode_atts(array( 'title' =&gt; '', ), $atts)); wp_enqueue_script('custom-script'); } </code></pre> <p>I have registered the script ...
[ { "answer_id": 123548, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 3, "selected": false, "text": "<p>You can use <a href=\"http://codex.wordpress.org/Function_Reference/wp_script_is\" rel=\"noreferrer...
2013/11/17
[ "https://wordpress.stackexchange.com/questions/123547", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41290/" ]
I want to include a script in a shortcode output, so I am trying this: ``` function my_shortcode( $atts, $content = null ) { extract(shortcode_atts(array( 'title' => '', ), $atts)); wp_enqueue_script('custom-script'); } ``` I have registered the script already and enqueue it if the...
The WordPress enqueue system should prevent the inclusion of the same script multiple times, and does when I test it. For example, the following enqueues a Core script and `echo`s a counter. If I put this shortcode into a post 4 times, I get "0123" but the media script only loads one time. The same test works with seve...
123,551
<p>When <a href="http://wordpress.org/plugins/mp6/">MP6 was a plugin</a> in WordPress 3.6+ it changes the body class of the admin and added an "admin-mp6" class which helps me to style my plugin accordingly.</p> <p>Now with the latest Alpha of WordPress 3.8 the class was removed. I know since it's an alpha version the...
[ { "answer_id": 123552, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>While it's not <em>specific</em> to MP6 (I am not following its development) and its CSS, to me your question sound...
2013/11/17
[ "https://wordpress.stackexchange.com/questions/123551", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18981/" ]
When [MP6 was a plugin](http://wordpress.org/plugins/mp6/) in WordPress 3.6+ it changes the body class of the admin and added an "admin-mp6" class which helps me to style my plugin accordingly. Now with the latest Alpha of WordPress 3.8 the class was removed. I know since it's an alpha version the class may come back ...
[Andrew Nacin](http://make.wordpress.org/ui/author/nacin/) posted some "offical" approach to this topic [here](http://make.wordpress.org/ui/2013/11/19/targeting-the-new-dashboard-design-in-a-post-mp6-world/) The CSS only variant should use the branch-3-x class to target the versions **before** 3.8 and the defaults sho...
123,565
<p>I made few thumbs size. But some of them make total resize of original pict or make new with specified sizes from right bottom corner. Is this posible to centrilize thumbs? I meen to make new thumb with specified size but with offset to center / centilize them?</p> <pre><code>add_theme_support( 'post-thumbnails' );...
[ { "answer_id": 123848, "author": "stemie", "author_id": 22502, "author_profile": "https://wordpress.stackexchange.com/users/22502", "pm_score": 0, "selected": false, "text": "<p>Have you looked at the Tim Thumb script. It might help you with this. <a href=\"http://www.binarymoon.co.uk/20...
2013/11/17
[ "https://wordpress.stackexchange.com/questions/123565", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42837/" ]
I made few thumbs size. But some of them make total resize of original pict or make new with specified sizes from right bottom corner. Is this posible to centrilize thumbs? I meen to make new thumb with specified size but with offset to center / centilize them? ``` add_theme_support( 'post-thumbnails' ); if ( functi...
I tried and use successfully this [code](http://bradt.ca/blog/image-crop-position-in-wordpress/) which allow to define image size using specific cropping position for this image size : `bt_add_image_size( 'product-screenshot', 300, 300, array( 'left', 'top' ) );` It allow centering option so it looks like matching you...
123,575
<p>I have a custom post type of 'gigs' and a metabox (using <a href="http://wordpress.org/plugins/meta-box/" rel="nofollow noreferrer">meta-box</a> plugin ) with event start date and time saved like: 2013-11-29 20:30. </p> <p>If I save a draft with no time/date set then it shows up in the published or draft posts admi...
[ { "answer_id": 123597, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 0, "selected": false, "text": "<p>Most likely the meta key is not set for the posts which don't have time/date set. The meta_key 'startdate...
2013/11/17
[ "https://wordpress.stackexchange.com/questions/123575", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7401/" ]
I have a custom post type of 'gigs' and a metabox (using [meta-box](http://wordpress.org/plugins/meta-box/) plugin ) with event start date and time saved like: 2013-11-29 20:30. If I save a draft with no time/date set then it shows up in the published or draft posts admin column as expected. However when I try to or...
I too was struggling with this (only I was sorting by a text-based meta value). Here's what seems to have fixed the problem: ``` $meta_query = array( 'relation' => 'OR', array( 'key' => 'property_reference', 'value' => false, 'type' => 'BOOLEAN', ), array( 'key' => 'property_r...
123,586
<p><strong>Story:</strong></p> <p>I have custom role <code>Staff</code> for my WooCommerce shop,</p> <p>When a Customer create an Order, the Order is assigned a custom meta name <code>handle_by</code> where the value is a random value of user where role is Staff.</p> <p>When Staff is login and click <code>WooCoomerc...
[ { "answer_id": 123601, "author": "Permana", "author_id": 4322, "author_profile": "https://wordpress.stackexchange.com/users/4322", "pm_score": 4, "selected": true, "text": "<p>Solved it, using <code>pre_get_posts</code> filter and <code>WP_Query-&gt;set()</code> method</p>\n<pre><code>fu...
2013/11/18
[ "https://wordpress.stackexchange.com/questions/123586", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4322/" ]
**Story:** I have custom role `Staff` for my WooCommerce shop, When a Customer create an Order, the Order is assigned a custom meta name `handle_by` where the value is a random value of user where role is Staff. When Staff is login and click `WooCoomerce > Orders`, He/She will only see Orders where `handle_by` is ma...
Solved it, using `pre_get_posts` filter and `WP_Query->set()` method ``` function foo_filter_orders($query) { global $pagenow; $qv = &$query->query_vars; $currentUserRoles = wp_get_current_user()->roles; if (in_array('shop_manager', $currentUserRoles)) { if ( $pagenow == 'edit.php' && ...
123,641
<p>I've seen plenty of tutorials on how to get the ID of the upper-most parent, but I can't seem to find anything on how to get the ID from the direct parent.</p> <p>Eg;</p> <pre><code>- Big John - Little John - Baby John </code></pre> <p>How, if I'm on the Baby John page, can I get the ID of Little John and n...
[ { "answer_id": 123643, "author": "Lucio Coire Galibone", "author_id": 42731, "author_profile": "https://wordpress.stackexchange.com/users/42731", "pm_score": 2, "selected": false, "text": "<p><code>$post-&gt;post_parent</code> ?</p>\n\n<p><a href=\"http://codex.wordpress.org/Function_Ref...
2013/11/18
[ "https://wordpress.stackexchange.com/questions/123641", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33310/" ]
I've seen plenty of tutorials on how to get the ID of the upper-most parent, but I can't seem to find anything on how to get the ID from the direct parent. Eg; ``` - Big John - Little John - Baby John ``` How, if I'm on the Baby John page, can I get the ID of Little John and not of Big John?
I'm assuming that you're asking how to do it with code? (Doing it in backend is pretty easy - just try to edit parent page and see the ID in URL). So how to check post parent in code? It's also very easy - direct parent is stored in `post_parent` property. If post has no parent, it will be `0`. So all you have to do ...
123,674
<p>I've had a problem with this for quite some time now and cannot for the life of me figure it out. I am using Multi-site and not sure if that has anything to do with it or not, so keep that in mind.</p> <h1>Problem:</h1> <p>When clicking on tags on a post or custom post type, I only get the default post count set by ...
[ { "answer_id": 123677, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>The problem is <code>query_posts()</code>. It is stomping on the default query, and killing your paginatio...
2013/11/18
[ "https://wordpress.stackexchange.com/questions/123674", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13169/" ]
I've had a problem with this for quite some time now and cannot for the life of me figure it out. I am using Multi-site and not sure if that has anything to do with it or not, so keep that in mind. Problem: ======== When clicking on tags on a post or custom post type, I only get the default post count set by WP which...
The problem is `query_posts()`. It is stomping on the default query, and killing your pagination. Don't use `query_posts()`. Filter `$wp_query` at `pre_get_posts` instead: ``` function wpse123674_pre_get_posts( $query ) { // Only modify the main query on the tag archive index if ( $query->is_main_query && $que...
123,675
<p>Would this be a bad idea for any reason? - installing Wordpress in a sub-directory (ie: http:// example.com/wordpress) alongside the current website (ie: http:// example.com) that is not using Wordpress...and still running Wordpress from the root by <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Direct...
[ { "answer_id": 123677, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>The problem is <code>query_posts()</code>. It is stomping on the default query, and killing your paginatio...
2013/11/18
[ "https://wordpress.stackexchange.com/questions/123675", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40679/" ]
Would this be a bad idea for any reason? - installing Wordpress in a sub-directory (ie: http:// example.com/wordpress) alongside the current website (ie: http:// example.com) that is not using Wordpress...and still running Wordpress from the root by [Giving Wordpress It's Own Directory](http://codex.wordpress.org/Givin...
The problem is `query_posts()`. It is stomping on the default query, and killing your pagination. Don't use `query_posts()`. Filter `$wp_query` at `pre_get_posts` instead: ``` function wpse123674_pre_get_posts( $query ) { // Only modify the main query on the tag archive index if ( $query->is_main_query && $que...
123,681
<p>I have no idea what I'm doing wrong, but I can't get the wp_redirect to actually redirect the page. I enabled the wp_debug to check for "header already sent" errors, but nothing. I installed the "Better HTTP Redirects" plugin to check the response, but it says 302 found. </p> <p>If I check the wp_redirect response ...
[ { "answer_id": 123709, "author": "user42826", "author_id": 42826, "author_profile": "https://wordpress.stackexchange.com/users/42826", "pm_score": 1, "selected": false, "text": "<p>wp_redirect() does not exit automatically and should almost always be followed by exit.</p>\n\n<p>Have you ...
2013/11/18
[ "https://wordpress.stackexchange.com/questions/123681", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27925/" ]
I have no idea what I'm doing wrong, but I can't get the wp\_redirect to actually redirect the page. I enabled the wp\_debug to check for "header already sent" errors, but nothing. I installed the "Better HTTP Redirects" plugin to check the response, but it says 302 found. If I check the wp\_redirect response like th...
wp\_redirect() does not exit automatically and should almost always be followed by exit. Have you tried adding an exit after wp\_redirect? It could be as simple as that
123,690
<p>I want to use the header, top menu and footer from my website on my Wordpress blog. The website itself is not a Wordpress site but the blog is and resides in a 'blog' folder on my server.</p> <p>So I guess what I need to do is edit the blog's 'header.php' file to use my website header for starters (then the same fo...
[ { "answer_id": 123693, "author": "Joey Yax", "author_id": 6148, "author_profile": "https://wordpress.stackexchange.com/users/6148", "pm_score": 1, "selected": false, "text": "<p>Include <strong>wp-load.php</strong> in the non-wordpress site to get WordPress functions.</p>\n\n<pre><code>d...
2013/11/18
[ "https://wordpress.stackexchange.com/questions/123690", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38611/" ]
I want to use the header, top menu and footer from my website on my Wordpress blog. The website itself is not a Wordpress site but the blog is and resides in a 'blog' folder on my server. So I guess what I need to do is edit the blog's 'header.php' file to use my website header for starters (then the same for menu and...
Include **wp-load.php** in the non-wordpress site to get WordPress functions. ``` define( 'WP_USE_THEMES', false ); require( '/path/to/wp-load.php' ); ``` Then you should be able to make the appropriate calls to `get_header()`, `get_footer()`, and `wp_nav_menu()` as you would within your WordPress theme.