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
147,718
<p>I do have a custom taxonomy called "countries". How do I get each term (country) with the number of its published posts in brackets, like the following:</p> <ul> <li>Uruguay (3)</li> <li>Chile (5)</li> <li>Thailand (2)</li> <li>etc.</li> </ul> <p>With following code the number of all terms in the "countries" taxon...
[ { "answer_id": 147721, "author": "Alex Dumitru", "author_id": 5810, "author_profile": "https://wordpress.stackexchange.com/users/5810", "pm_score": 0, "selected": false, "text": "<p>You can try it with WP Query. I haven't tested it yet, so please let me know if it works.</p>\n\n<pre><cod...
2014/06/05
[ "https://wordpress.stackexchange.com/questions/147718", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51307/" ]
I do have a custom taxonomy called "countries". How do I get each term (country) with the number of its published posts in brackets, like the following: * Uruguay (3) * Chile (5) * Thailand (2) * etc. With following code the number of all terms in the "countries" taxonomy is displayed: ``` $countries_count = wp_coun...
You can use [`get_terms`](http://codex.wordpress.org/Function_Reference/get_terms) to get the list of all terms associated with a taxonomy. Once you have all the separate terms, you can use `$term->name` to display the name of the term and `$term->count` to retrieve the amount of posts inside that specific term. Here...
147,723
<p>I would like to get post with an API method using a kind of meta query. I have 2 custom fields "place" and "dayoweek" and I want to retrieve via API call all the post that have some values for this 2 fields. It would more or less like this if you use php</p> <pre><code>$args = array( 'numberposts' =&gt; -1, ...
[ { "answer_id": 147799, "author": "Dan Phiffer", "author_id": 52821, "author_profile": "https://wordpress.stackexchange.com/users/52821", "pm_score": 3, "selected": true, "text": "<p>There are two parts to the solution here.</p>\n\n<ol>\n<li>You need to use a <a href=\"http://wordpress.or...
2014/06/05
[ "https://wordpress.stackexchange.com/questions/147723", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52775/" ]
I would like to get post with an API method using a kind of meta query. I have 2 custom fields "place" and "dayoweek" and I want to retrieve via API call all the post that have some values for this 2 fields. It would more or less like this if you use php ``` $args = array( 'numberposts' => -1, 'post_type' => '...
There are two parts to the solution here. 1. You need to use a [JSON API custom controller](http://wordpress.org/plugins/json-api/other_notes/#5.2.-Developing-JSON-API-controllers) 2. In your custom controller, you'll need to decide how to pass the `meta_query` data structure Depending on how robust you need this to ...
147,753
<p>I’m looking a way to get embedded video in PHP from WordPress post on a single.php page. I’ve implemented a slider that pulls post attachment images and would like to do the same for video. As the media upload limit in WordPress and practicality of uploading video to CMS are leading me away from using similar method...
[ { "answer_id": 160964, "author": "newpxsn", "author_id": 18406, "author_profile": "https://wordpress.stackexchange.com/users/18406", "pm_score": 0, "selected": false, "text": "<p><a href=\"https://wordpress.stackexchange.com/a/14853\">This finally helped me.</a></p>\n\n<p>Using <code>get...
2014/06/06
[ "https://wordpress.stackexchange.com/questions/147753", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52798/" ]
I’m looking a way to get embedded video in PHP from WordPress post on a single.php page. I’ve implemented a slider that pulls post attachment images and would like to do the same for video. As the media upload limit in WordPress and practicality of uploading video to CMS are leading me away from using similar method, I...
I was able to get [all the embedded media content](https://wordpress.stackexchange.com/questions/190349/set-first-oembed-in-post-to-a-global-variable-or-function/190401) within a post using a new WordPress hook (3.6+). ``` get_media_embedded_in_content(); ```
147,767
<p>I have a custom post type called freebies. I want to use the archive-freebies.php for the child categories also. I have added in my functions.php the following:</p> <pre><code>function inherit_template() { if (is_category()) { $catid = get_query_var('cat'); $cat = &amp;get_category($catid); ...
[ { "answer_id": 160964, "author": "newpxsn", "author_id": 18406, "author_profile": "https://wordpress.stackexchange.com/users/18406", "pm_score": 0, "selected": false, "text": "<p><a href=\"https://wordpress.stackexchange.com/a/14853\">This finally helped me.</a></p>\n\n<p>Using <code>get...
2014/06/06
[ "https://wordpress.stackexchange.com/questions/147767", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47810/" ]
I have a custom post type called freebies. I want to use the archive-freebies.php for the child categories also. I have added in my functions.php the following: ``` function inherit_template() { if (is_category()) { $catid = get_query_var('cat'); $cat = &get_category($catid); $parent = $cat...
I was able to get [all the embedded media content](https://wordpress.stackexchange.com/questions/190349/set-first-oembed-in-post-to-a-global-variable-or-function/190401) within a post using a new WordPress hook (3.6+). ``` get_media_embedded_in_content(); ```
147,785
<p>I cannot get a Wordpress cron to trigger. I am trying to run this code to see if I can get an email sent to me hourly.</p> <p>It's taken directly from the Wordpress examples here: <a href="http://codex.wordpress.org/Function_Reference/wp_schedule_event" rel="nofollow">http://codex.wordpress.org/Function_Reference/w...
[ { "answer_id": 149147, "author": "benedict_w", "author_id": 19475, "author_profile": "https://wordpress.stackexchange.com/users/19475", "pm_score": 4, "selected": true, "text": "<p>Turns out I had to set the ALTERNATE_WP_CRON flag in wp-config.php to make this work:</p>\n\n<pre><code>def...
2014/06/06
[ "https://wordpress.stackexchange.com/questions/147785", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19475/" ]
I cannot get a Wordpress cron to trigger. I am trying to run this code to see if I can get an email sent to me hourly. It's taken directly from the Wordpress examples here: <http://codex.wordpress.org/Function_Reference/wp_schedule_event>. Except I removed underscores (see caveat in documentation). The code is runnin...
Turns out I had to set the ALTERNATE\_WP\_CRON flag in wp-config.php to make this work: ``` define('ALTERNATE_WP_CRON', true); ```
147,789
<p>I need to retain tag taxonomy for a single custom post type, but am struggling with it.</p> <p>Is there a way to remove this meta box for everything BUT?</p> <hr> <p><code>remove_meta_box('tagsdiv-post_tag', 'post', 'normal');</code></p> <p>Will remove the tags from normal posts (desired), but it means they're a...
[ { "answer_id": 147793, "author": "тнє Sufi", "author_id": 28744, "author_profile": "https://wordpress.stackexchange.com/users/28744", "pm_score": 0, "selected": false, "text": "<p>You need to check either the current post is <code>airports</code> or not.</p>\n\n<p>This can be done like t...
2014/06/06
[ "https://wordpress.stackexchange.com/questions/147789", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51906/" ]
I need to retain tag taxonomy for a single custom post type, but am struggling with it. Is there a way to remove this meta box for everything BUT? --- `remove_meta_box('tagsdiv-post_tag', 'post', 'normal');` Will remove the tags from normal posts (desired), but it means they're also removed from ALL custom post typ...
Why not just turn off the default tags capability then register a tags taxonomy specific to the custom post type? <http://codex.wordpress.org/Function_Reference/register_taxonomy> ``` register_taxonomy( 'my_custom_post_type_tags', 'my_custom_post_type', array( 'label' => __( 'Tags' ), 'rewrite' ...
147,812
<pre><code>&lt;ul class="footer_banner_box_container clearfix"&gt; &lt;div id="text-4" class="widget widget_text"&gt; &lt;h3 class="box_header"&gt;Our Doctors&lt;/h3&gt; &lt;div class="textwidget"&gt; &lt;h3 id="our-docs" style="margin: 10px 20px; padding: 20px; color: #002664;"&gt;Our t...
[ { "answer_id": 147793, "author": "тнє Sufi", "author_id": 28744, "author_profile": "https://wordpress.stackexchange.com/users/28744", "pm_score": 0, "selected": false, "text": "<p>You need to check either the current post is <code>airports</code> or not.</p>\n\n<p>This can be done like t...
2014/06/06
[ "https://wordpress.stackexchange.com/questions/147812", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27887/" ]
``` <ul class="footer_banner_box_container clearfix"> <div id="text-4" class="widget widget_text"> <h3 class="box_header">Our Doctors</h3> <div class="textwidget"> <h3 id="our-docs" style="margin: 10px 20px; padding: 20px; color: #002664;">Our team includes an array of trained experts, w...
Why not just turn off the default tags capability then register a tags taxonomy specific to the custom post type? <http://codex.wordpress.org/Function_Reference/register_taxonomy> ``` register_taxonomy( 'my_custom_post_type_tags', 'my_custom_post_type', array( 'label' => __( 'Tags' ), 'rewrite' ...
147,820
<p>I have a custom post type called freebies. This custom post type has its own taxonomy with the "normal" categories from wordpress, (which are child-categories from freebies) and own custom taxonomy used as tags (called freebie-tags)</p> <p>I have managed to have own templates for the freebies: <strong>archive-freeb...
[ { "answer_id": 147793, "author": "тнє Sufi", "author_id": 28744, "author_profile": "https://wordpress.stackexchange.com/users/28744", "pm_score": 0, "selected": false, "text": "<p>You need to check either the current post is <code>airports</code> or not.</p>\n\n<p>This can be done like t...
2014/06/06
[ "https://wordpress.stackexchange.com/questions/147820", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47810/" ]
I have a custom post type called freebies. This custom post type has its own taxonomy with the "normal" categories from wordpress, (which are child-categories from freebies) and own custom taxonomy used as tags (called freebie-tags) I have managed to have own templates for the freebies: **archive-freebies.php** and th...
Why not just turn off the default tags capability then register a tags taxonomy specific to the custom post type? <http://codex.wordpress.org/Function_Reference/register_taxonomy> ``` register_taxonomy( 'my_custom_post_type_tags', 'my_custom_post_type', array( 'label' => __( 'Tags' ), 'rewrite' ...
147,832
<p>I wrote this function with a foreach and I'm not able to figure out how to hide the section title if there are no custom fields in $lista. Where should I place the section title? </p> <pre><code>function opening_hours_custom_fields() { /*Define custom fields in this case with Genesis*/ $lista = genesis_get_custom_...
[ { "answer_id": 147793, "author": "тнє Sufi", "author_id": 28744, "author_profile": "https://wordpress.stackexchange.com/users/28744", "pm_score": 0, "selected": false, "text": "<p>You need to check either the current post is <code>airports</code> or not.</p>\n\n<p>This can be done like t...
2014/06/06
[ "https://wordpress.stackexchange.com/questions/147832", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50518/" ]
I wrote this function with a foreach and I'm not able to figure out how to hide the section title if there are no custom fields in $lista. Where should I place the section title? ``` function opening_hours_custom_fields() { /*Define custom fields in this case with Genesis*/ $lista = genesis_get_custom_field('_happy_...
Why not just turn off the default tags capability then register a tags taxonomy specific to the custom post type? <http://codex.wordpress.org/Function_Reference/register_taxonomy> ``` register_taxonomy( 'my_custom_post_type_tags', 'my_custom_post_type', array( 'label' => __( 'Tags' ), 'rewrite' ...
147,845
<p>How to closed my class in multiple of 3. i don't want to use this </p> <pre><code>if ( $counter == 3 || $counter == 6 || $counter == 9 || $counter == 12) { $output.=' &lt;/div&gt;'; } </code></pre> <p>but i want multiple of 3. like </p> <pre><code>if($counter == 3 || $counter == 3n) </cod...
[ { "answer_id": 147793, "author": "тнє Sufi", "author_id": 28744, "author_profile": "https://wordpress.stackexchange.com/users/28744", "pm_score": 0, "selected": false, "text": "<p>You need to check either the current post is <code>airports</code> or not.</p>\n\n<p>This can be done like t...
2014/06/07
[ "https://wordpress.stackexchange.com/questions/147845", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52854/" ]
How to closed my class in multiple of 3. i don't want to use this ``` if ( $counter == 3 || $counter == 6 || $counter == 9 || $counter == 12) { $output.=' </div>'; } ``` but i want multiple of 3. like ``` if($counter == 3 || $counter == 3n) ```
Why not just turn off the default tags capability then register a tags taxonomy specific to the custom post type? <http://codex.wordpress.org/Function_Reference/register_taxonomy> ``` register_taxonomy( 'my_custom_post_type_tags', 'my_custom_post_type', array( 'label' => __( 'Tags' ), 'rewrite' ...
147,898
<p>I'm attempting to store an array that looks like the one below, into a cell in a database using the code below the sample array. Unfortunately, WordPress doesn't seem to want to save it, and continually throws a database error (like the one on the bottom). Changing the order of the data in the array changes the loca...
[ { "answer_id": 147900, "author": "Chris", "author_id": 16178, "author_profile": "https://wordpress.stackexchange.com/users/16178", "pm_score": 0, "selected": false, "text": "<p>This seems to work for some reason using data that a prepared query doesn't like:</p>\n\n<pre><code>$wpdb-&gt;u...
2014/06/07
[ "https://wordpress.stackexchange.com/questions/147898", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16178/" ]
I'm attempting to store an array that looks like the one below, into a cell in a database using the code below the sample array. Unfortunately, WordPress doesn't seem to want to save it, and continually throws a database error (like the one on the bottom). Changing the order of the data in the array changes the locatio...
Don't store serialised PHP data in the database! It can be a major security risk! When the contents of the value are deserialised, any objects get recreated and their constructors and wakeup methods run, this can be used to launch an attack. Additionally, that data can't be search replaced, because PHP serialised str...
147,899
<p>I searched a lot on this but I can't figure out why my code is not working.</p> <p>I published a page with slug &quot;blog&quot; that uses a custom built template &quot;page-blog.php&quot; that I build from editing the original &quot;page.php&quot;. I want to loop latest posts, with pagination.</p> <p>For numbered p...
[ { "answer_id": 147909, "author": "sultan", "author_id": 52854, "author_profile": "https://wordpress.stackexchange.com/users/52854", "pm_score": 0, "selected": false, "text": "<p>Have you set the blog page in reading as post page, if yes then please make a template with name home and put ...
2014/06/07
[ "https://wordpress.stackexchange.com/questions/147899", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4155/" ]
I searched a lot on this but I can't figure out why my code is not working. I published a page with slug "blog" that uses a custom built template "page-blog.php" that I build from editing the original "page.php". I want to loop latest posts, with pagination. For numbered pagination I tried several plugins. They all w...
**MOST IMPORTANT EDIT** When I tested your code, I always added the page header name, and never realized that this was one thing that you didn't add. You should always name a custom page template so that wordpress knows it's a page template. So you need to edit your custom page template and add the header as follows ...
147,922
<p>I would like to show <code>categories</code> in the front page with different behavior:</p> <ul> <li>categories to show <code>posts</code> in two styles [Three <code>posts</code> having the same style and then another two with the same style]</li> </ul> <p><img src="https://i.stack.imgur.com/ekUm7.jpg" alt="Three po...
[ { "answer_id": 147927, "author": "Anju Aravind", "author_id": 52694, "author_profile": "https://wordpress.stackexchange.com/users/52694", "pm_score": -1, "selected": false, "text": "<p>from what i understand,you need to use custom codes for this. use this code to get the posts from a par...
2014/06/08
[ "https://wordpress.stackexchange.com/questions/147922", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51229/" ]
I would like to show `categories` in the front page with different behavior: * categories to show `posts` in two styles [Three `posts` having the same style and then another two with the same style] ![Three posts having the same style and then another two with the same style](https://i.stack.imgur.com/ekUm7.jpg) * a...
Recently I have developed a theme almost identical to yours. This is how you can achieve this: Basic idea is, create two different layouts: `layout-three.php` and `layout-two.php` We will call them based on requirement. I have used an array to achieve this. Below is the sample code for the template file (assuming yo...
147,933
<p>I need to order my posts by alphabetical for each letter. I mean:</p> <p>When people enter to www.xxx.com/a, they will just see posts by starting A.</p> <p>ABC XYZ</p> <p>ADE KLM</p> <p>ARE UYZ</p> <p>When people enter to www.xxx.com/b, they will just see posts by starting B.</p> <p>BCK OIO</p> <p>BHJ PEP</p>...
[ { "answer_id": 147937, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 0, "selected": false, "text": "<p>This code uses the last letter in the URL to search for all posts that starts with that specific letter...
2014/06/08
[ "https://wordpress.stackexchange.com/questions/147933", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51315/" ]
I need to order my posts by alphabetical for each letter. I mean: When people enter to www.xxx.com/a, they will just see posts by starting A. ABC XYZ ADE KLM ARE UYZ When people enter to www.xxx.com/b, they will just see posts by starting B. BCK OIO BHJ PEP I hope you will understand what I want. I have founded...
This is what I find for this question. Two codes I found were coded by MichaelH from wordpress.org. Even he won't probably see this post, I want to thank him. Now, I just need to sort these posts from specified one category. If anyone knows how to sort them with specified category, please help me. Thanks. ``` <?ph...
147,934
<p>Is possible to use a subdomain, for example: media.mydomain.com pointed to /var/www/mediauploads, for two different domains?</p> <p>Since I have mydomain.com and mydomain.it blogs, would be nice to upload files directly in one folder instead of duplicating the images when I write new articles in english and italian...
[ { "answer_id": 148996, "author": "Matt Royal", "author_id": 51860, "author_profile": "https://wordpress.stackexchange.com/users/51860", "pm_score": 2, "selected": false, "text": "<p>First, create the folder/directory or the subdomain you want to use for your WordPress uploads, make sure ...
2014/06/08
[ "https://wordpress.stackexchange.com/questions/147934", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52889/" ]
Is possible to use a subdomain, for example: media.mydomain.com pointed to /var/www/mediauploads, for two different domains? Since I have mydomain.com and mydomain.it blogs, would be nice to upload files directly in one folder instead of duplicating the images when I write new articles in english and italian. Hope so...
First, create the folder/directory or the subdomain you want to use for your WordPress uploads, make sure it has the correct permissions and is writable. In your wp-config.php file which is in the root of your WordPress installations, you can add the code below. Do this on both your WordPress installations and modify ...
147,943
<p>I'm trying to de-register a CSS file that it is systematically add from a plugin. The CSS file it is useless in all pages. </p> <p>So I have added a simple <code>wp_deregister_style</code> passing the name of the CSS class used for the registration purpose. As a matter of fact, the CSS file is no longer print, but ...
[ { "answer_id": 147945, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>Most certainly! You can use <a href=\"http://codex.wordpress.org/Function_Reference/wp_dequeue_style\" rel=\"...
2014/06/08
[ "https://wordpress.stackexchange.com/questions/147943", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26216/" ]
I'm trying to de-register a CSS file that it is systematically add from a plugin. The CSS file it is useless in all pages. So I have added a simple `wp_deregister_style` passing the name of the CSS class used for the registration purpose. As a matter of fact, the CSS file is no longer print, but looking at the `$wp_s...
To properly and completely remove a style, you need to deregister([`wp_deregister_style()`](http://codex.wordpress.org/Function_Reference/wp_deregister_style)) and dequeue([`wp_dequeue_style()`](http://codex.wordpress.org/Function_Reference/wp_dequeue_style)) it. Dequeueing will remove the style from the array in the `...
147,953
<p>My ISP changed the hosting for my Wordpress blog and everything stopped working. There was a DNS issue but they resolved that, but then every page apart from the home page returned a 404 error.</p> <p>When I checked the permalinks page (<code>/wp-admin/options-permalinks.php</code>) in wp-admin I saw the following:...
[ { "answer_id": 147945, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>Most certainly! You can use <a href=\"http://codex.wordpress.org/Function_Reference/wp_dequeue_style\" rel=\"...
2014/06/08
[ "https://wordpress.stackexchange.com/questions/147953", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/220/" ]
My ISP changed the hosting for my Wordpress blog and everything stopped working. There was a DNS issue but they resolved that, but then every page apart from the home page returned a 404 error. When I checked the permalinks page (`/wp-admin/options-permalinks.php`) in wp-admin I saw the following: > > If your .htacc...
To properly and completely remove a style, you need to deregister([`wp_deregister_style()`](http://codex.wordpress.org/Function_Reference/wp_deregister_style)) and dequeue([`wp_dequeue_style()`](http://codex.wordpress.org/Function_Reference/wp_dequeue_style)) it. Dequeueing will remove the style from the array in the `...
148,955
<p>I want to create a new way to Login. </p> <p>What I got to do now: </p> <ol> <li>Edit the user form, adding a new field that is saved in user_meta</li> <li>Edit the Login form, adding a new input;</li> <li>Build a (safe) query that selects the user_id in usermeta table;</li> </ol> <p>What I still need: </p> <ol>...
[ { "answer_id": 151715, "author": "TBI Infotech", "author_id": 52417, "author_profile": "https://wordpress.stackexchange.com/users/52417", "pm_score": 2, "selected": true, "text": "<p>You can use this function in <code>functions.php</code> of your current theme \nIt will show an extra fie...
2014/06/08
[ "https://wordpress.stackexchange.com/questions/148955", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28742/" ]
I want to create a new way to Login. What I got to do now: 1. Edit the user form, adding a new field that is saved in user\_meta 2. Edit the Login form, adding a new input; 3. Build a (safe) query that selects the user\_id in usermeta table; What I still need: 1. Catch the post to login, run my query (3) and acc...
You can use this function in `functions.php` of your current theme It will show an extra field on login form ``` ###################Code starts here ################### <?php add_action('login_form', 'add_login_field'); function add_login_field() { ?> <p> <label for="user_pass">My Input<br> <input...
148,963
<p>I have an <code>archive-regularproducts.php</code> set up that looks like so:<br> PHP:</p> <pre><code> &lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt; //content goes here &lt;?php endwhile; endif; ?&gt; &lt;?php wp_reset_query(); ?&gt; &lt;?php query_posts( 'post_type=...
[ { "answer_id": 148990, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>Automatic pagination is only applied to the main query by default. Thus, the pagination is already working as...
2014/06/08
[ "https://wordpress.stackexchange.com/questions/148963", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28065/" ]
I have an `archive-regularproducts.php` set up that looks like so: PHP: ``` <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> //content goes here <?php endwhile; endif; ?> <?php wp_reset_query(); ?> <?php query_posts( 'post_type=wpsc-product'); ?> <?php if ( have_post...
[`query_posts`](http://codex.wordpress.org/Function_Reference/query_posts) should be avoided at all costs. This is not just my emphasis, but the codex's as well > > **Note:** This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main quer...
148,968
<p>My home page is a dynamic page and on my navbar I have different static pages I want to add one to link to the homepage as if I clicked the logo.</p>
[ { "answer_id": 148990, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>Automatic pagination is only applied to the main query by default. Thus, the pagination is already working as...
2014/06/09
[ "https://wordpress.stackexchange.com/questions/148968", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50830/" ]
My home page is a dynamic page and on my navbar I have different static pages I want to add one to link to the homepage as if I clicked the logo.
[`query_posts`](http://codex.wordpress.org/Function_Reference/query_posts) should be avoided at all costs. This is not just my emphasis, but the codex's as well > > **Note:** This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main quer...
148,973
<p>I would like to somehow retrieve a list of all current admin menu items, even the ones created by themes/plugins. Is it possible?</p>
[ { "answer_id": 148976, "author": "bryceadams", "author_id": 14895, "author_profile": "https://wordpress.stackexchange.com/users/14895", "pm_score": 2, "selected": false, "text": "<p>This <a href=\"https://wordpress.stackexchange.com/a/136064/14895\">great answer</a> helped me get there. ...
2014/06/09
[ "https://wordpress.stackexchange.com/questions/148973", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14895/" ]
I would like to somehow retrieve a list of all current admin menu items, even the ones created by themes/plugins. Is it possible?
``` <?php if (!function_exists('debug_admin_menus')): function debug_admin_menus() { global $submenu, $menu, $pagenow; if ( current_user_can('manage_options') ) { // ONLY DO THIS FOR ADMIN if( $pagenow == 'index.php' ) { // PRINTS ON DASHBOARD echo '<pre>'; print_r( $menu ); echo '</pre>'; ...
149,013
<p>I have this code:</p> <pre><code>&lt;?php // List subcategories of category '4' $subcategories = get_categories('&amp;child_of=4'); foreach ($subcategories as $subcategory) { echo sprintf(' &lt;a href="%s"&gt;%s&lt;/a&gt; &lt;span class="sep"&gt;•&lt;/span&gt;', get_category_link($subcategory-&gt;term_id), apply...
[ { "answer_id": 149014, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>To do so, you should remove the ampersand (which is used to concatenate multiple arguments) and use <code>par...
2014/06/09
[ "https://wordpress.stackexchange.com/questions/149013", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/53932/" ]
I have this code: ``` <?php // List subcategories of category '4' $subcategories = get_categories('&child_of=4'); foreach ($subcategories as $subcategory) { echo sprintf(' <a href="%s">%s</a> <span class="sep">•</span>', get_category_link($subcategory->term_id), apply_filters('get_term', $subcategory->name)); } ?> ...
Here is a function I've recently used (modified version of the code found in the codex) to display a list of the categories a post is attached to. This function first gets the parent category to which the post belong, and that info is then fed back into [`wp_list_categories`](http://codex.wordpress.org/Template_Tags/...
149,031
<h2>The Goal</h2> <p>I would like to format my permalinks as follows:</p> <ul> <li>for posts: <em>somePrefix/%category%/%postname%</em></li> <li>for categories: <em>somePrefix/%category%</em></li> </ul> <p>Where <em>somePrefix</em> is the same in both cases.</p> <p>I know that there is no big upside to this - it ju...
[ { "answer_id": 149014, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>To do so, you should remove the ampersand (which is used to concatenate multiple arguments) and use <code>par...
2014/06/09
[ "https://wordpress.stackexchange.com/questions/149031", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47746/" ]
The Goal -------- I would like to format my permalinks as follows: * for posts: *somePrefix/%category%/%postname%* * for categories: *somePrefix/%category%* Where *somePrefix* is the same in both cases. I know that there is no big upside to this - it just seems "clean" to me :) . And it comes in handy if you want t...
Here is a function I've recently used (modified version of the code found in the codex) to display a list of the categories a post is attached to. This function first gets the parent category to which the post belong, and that info is then fed back into [`wp_list_categories`](http://codex.wordpress.org/Template_Tags/...
149,065
<p>I'm trying with no luck to change the background color of just one page. I've tried adding > and then using the selector</p> <pre><code>body.page-id-15 #content { background-color:#000000; } </code></pre> <p>This doesn't work. Seems the only way I can change the background to that page is changing the background ...
[ { "answer_id": 149014, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>To do so, you should remove the ampersand (which is used to concatenate multiple arguments) and use <code>par...
2014/06/09
[ "https://wordpress.stackexchange.com/questions/149065", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51991/" ]
I'm trying with no luck to change the background color of just one page. I've tried adding > and then using the selector ``` body.page-id-15 #content { background-color:#000000; } ``` This doesn't work. Seems the only way I can change the background to that page is changing the background of #content. But...that cha...
Here is a function I've recently used (modified version of the code found in the codex) to display a list of the categories a post is attached to. This function first gets the parent category to which the post belong, and that info is then fed back into [`wp_list_categories`](http://codex.wordpress.org/Template_Tags/...
149,072
<p>I have a Wordpress website, due to some limits i need to have originals of the photo at the serverside, but watermarked ones on a frontend and with direct opening of the photos. I'm using Frontend content creation plugin and (as i understand) not all the plugins will fork with custom file input fields (wp_handle_upl...
[ { "answer_id": 149014, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>To do so, you should remove the ampersand (which is used to concatenate multiple arguments) and use <code>par...
2014/06/09
[ "https://wordpress.stackexchange.com/questions/149072", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/53951/" ]
I have a Wordpress website, due to some limits i need to have originals of the photo at the serverside, but watermarked ones on a frontend and with direct opening of the photos. I'm using Frontend content creation plugin and (as i understand) not all the plugins will fork with custom file input fields (wp\_handle\_uplo...
Here is a function I've recently used (modified version of the code found in the codex) to display a list of the categories a post is attached to. This function first gets the parent category to which the post belong, and that info is then fed back into [`wp_list_categories`](http://codex.wordpress.org/Template_Tags/...
149,076
<p>I'm looking to replace an events plugin that i have on my website currently. We realize we don't need a full blown calendar and things like that, we just need to be able to enter in Events with a start and end date and also custom times. I made custom fields for start date and end date using the Advanced Custom Fi...
[ { "answer_id": 149080, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p>The Codex lists all of the comparison options on the <a href=\"http://codex.wordpress.org/Class_Reference/WP_Query...
2014/06/09
[ "https://wordpress.stackexchange.com/questions/149076", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18119/" ]
I'm looking to replace an events plugin that i have on my website currently. We realize we don't need a full blown calendar and things like that, we just need to be able to enter in Events with a start and end date and also custom times. I made custom fields for start date and end date using the Advanced Custom Fields ...
100% of the credit goes to "keesiemeijer" over at wordpress.org for coming up with a working solution. Here is the answer in case others are struggling with this. Here is the scenario. You have events that have a start and end date using Advanced Custom Fields Date Picker field type. You are trying to query the events...
149,077
<p>The basic issue is that every paginated page for my blog is going to a 404 page. /page/2/, /page/3/, etc. It used to be working fine, but is not now. I think maybe the change to 3.9 did it. </p> <p>Here are some of the many things I have tried in an effort to fix this. The end result of all of these were the same. ...
[ { "answer_id": 149122, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 3, "selected": true, "text": "<p>There are a couple of things I don't understand here, but I'll try answering them as I go along.</p>\n<p...
2014/06/09
[ "https://wordpress.stackexchange.com/questions/149077", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34879/" ]
The basic issue is that every paginated page for my blog is going to a 404 page. /page/2/, /page/3/, etc. It used to be working fine, but is not now. I think maybe the change to 3.9 did it. Here are some of the many things I have tried in an effort to fix this. The end result of all of these were the same. The pagina...
There are a couple of things I don't understand here, but I'll try answering them as I go along. You have a home.php, which I assume is your default homepage. You have one line of code in there, and that is to call a another page template. Here is you code ``` <?php require dirname( __FILE__ ) . '/blog-page.php'; ...
149,091
<p>I haven't used WP since 3.5 so forgive my rustiness. I am trying to customize a child theme of twenty fourteen for WP 3.9.1 to make it more like a corporate site rather than a magazine site. </p> <p><strong>My goal:</strong> For the marketing department to simply login, add a product (post) and select the matchin...
[ { "answer_id": 149092, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>You don't.</p>\n\n<blockquote>\n <p>New formats cannot be introduced by themes or even plugins. The standardizati...
2014/06/10
[ "https://wordpress.stackexchange.com/questions/149091", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11137/" ]
I haven't used WP since 3.5 so forgive my rustiness. I am trying to customize a child theme of twenty fourteen for WP 3.9.1 to make it more like a corporate site rather than a magazine site. **My goal:** For the marketing department to simply login, add a product (post) and select the matching post format. In SLT3,...
I would suggest that you have a look at [custom post types](http://codex.wordpress.org/Post_Types). You have more flexibility and much more options working with custom post types than with post formats.
149,093
<p>I need to check if a uploaded file has <code>.csv</code> or <code>.txt</code> as extension and I'm doing as follow:</p> <pre><code>$uploadfiles = $_FILES['uploadfiles']; echo '&lt;pre&gt;'; var_dump($uploadfiles); echo '&lt;/pre&gt;'; if (is_array($uploadfiles)) { foreach ($uploadfiles['name'] as $key =&gt; $...
[ { "answer_id": 149095, "author": "Eric Mayfield", "author_id": 53952, "author_profile": "https://wordpress.stackexchange.com/users/53952", "pm_score": 1, "selected": false, "text": "<p>This is just an idea and not something guaranteed to work, but I have in my experience in the past ran ...
2014/06/10
[ "https://wordpress.stackexchange.com/questions/149093", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16412/" ]
I need to check if a uploaded file has `.csv` or `.txt` as extension and I'm doing as follow: ``` $uploadfiles = $_FILES['uploadfiles']; echo '<pre>'; var_dump($uploadfiles); echo '</pre>'; if (is_array($uploadfiles)) { foreach ($uploadfiles['name'] as $key => $value) { if ($uploadfiles['error'][$key] ==...
Found where I made the error, on the condition, my code was: ``` if ($filetype['type'] != $fileCSV || $filetype['type'] != $fileText) { echo "Error, the file $filename has not a valid extension: " . $filetype["ext"]; continue; } ``` And the right is this one: ``` if (!in_array($filetype['type'], array($file...
149,099
<p>I am using the Siren Template. In homepage.php this code is used to display the portfolio content</p> <pre><code>print_excerpt(200); </code></pre> <p>But I to need show the content only before <code>&lt;!--more--&gt;</code></p> <p>I have used this:</p> <pre><code>the_content( $more_link_text, FALSE); </code></pr...
[ { "answer_id": 149130, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 6, "selected": true, "text": "<p>You can use the WordPress function <a href=\"http://codex.wordpress.org/Function_Reference/get_extended\"><cod...
2014/06/10
[ "https://wordpress.stackexchange.com/questions/149099", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37427/" ]
I am using the Siren Template. In homepage.php this code is used to display the portfolio content ``` print_excerpt(200); ``` But I to need show the content only before `<!--more-->` I have used this: ``` the_content( $more_link_text, FALSE); ``` but it is not working. It shows all the content
You can use the WordPress function [`get_extended`](http://codex.wordpress.org/Function_Reference/get_extended) to fetch the different parts of a string (the part before and the part after the `<!--more-->` tag). `get_extended` returns an array with three keys, of which the keys `main` and `extended` are important: `$a...
149,110
<p>I am trying to get comments from another post. I am getting the post_id and doing a check to see if it has comments</p> <p>I can get the comments for the current post every time but for the other post I am getting mixed results (I did get it working but am unable to reproduce the results)</p> <p>This is the code I...
[ { "answer_id": 149154, "author": "Totoro", "author_id": 51521, "author_profile": "https://wordpress.stackexchange.com/users/51521", "pm_score": 2, "selected": true, "text": "<p>Turns out it was my use of the language plugin (polylang)... When I call the comments it adds a language filter...
2014/06/10
[ "https://wordpress.stackexchange.com/questions/149110", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51521/" ]
I am trying to get comments from another post. I am getting the post\_id and doing a check to see if it has comments I can get the comments for the current post every time but for the other post I am getting mixed results (I did get it working but am unable to reproduce the results) This is the code I'm working on wi...
Turns out it was my use of the language plugin (polylang)... When I call the comments it adds a language filter: ``` 'lang' => $currentLang ``` So I had to explicitly override that: ``` get_comments(array('post_id'=>31, 'lang' => $targetLang)); ``` I still don't know why I was sometimes able to get the other comm...
149,143
<p>I need to hide/remove the numbers behind the Edit screen in the backend. </p> <p>All (30) | Published (22) | Draft (5) | Pending (2) | Trash (1)</p> <p>As I am running a multi author blog and each author has just access to its own posts, I dont want to publish the cumulated information of all authors.</p> <p>With...
[ { "answer_id": 149144, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 4, "selected": true, "text": "<p>There is, unfortunately, no \"pretty\" way to do this (i.e. without using string replacing or rewriting a big ...
2014/06/10
[ "https://wordpress.stackexchange.com/questions/149143", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51307/" ]
I need to hide/remove the numbers behind the Edit screen in the backend. All (30) | Published (22) | Draft (5) | Pending (2) | Trash (1) As I am running a multi author blog and each author has just access to its own posts, I dont want to publish the cumulated information of all authors. With the following code the ...
There is, unfortunately, no "pretty" way to do this (i.e. without using string replacing or rewriting a big chunck of functionality). So, resorting to [`preg_replace`](http://us3.php.net//manual/en/function.preg-replace.php)... We'll need to filter the links, and it's good to see that you've already found the proper f...
149,173
<p>I'm trying to schedule a post that is currently a draft:</p> <pre><code>function schedule() { $postdate = date('2014-06-11 00:30:00'); $post = array( 'ID' =&gt; 11, 'post_status' =&gt; 'future', 'post_type' =&gt; 'post', 'post_author' =&gt; '1', 'ping_status' =&gt; 'closed', 'to_ping' ...
[ { "answer_id": 149179, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>You shouldn't be using <code>wp_insert_post()</code> to manipulate <em>existing</em> post. That's what <code>wp_upd...
2014/06/10
[ "https://wordpress.stackexchange.com/questions/149173", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47978/" ]
I'm trying to schedule a post that is currently a draft: ``` function schedule() { $postdate = date('2014-06-11 00:30:00'); $post = array( 'ID' => 11, 'post_status' => 'future', 'post_type' => 'post', 'post_author' => '1', 'ping_status' => 'closed', 'to_ping' => 'http://rpc.pingomat...
As Rarst mentioned I had to use `wp_update_post()`, but then there is a little trick - one must also set `edit_date = true` otherwise it has funny behavior. The final code looks like this: ``` function schedule() { $postdate = date('2014-06-11 01:00:00'); $postdate_gmt = date('2014-06-11 05:00:00'); $post = array( ...
149,196
<p>I have a plugin that allows the user to dynamically add sections that need to have the tinyMCE editor in them. The jQuery clones a <code>div</code> and places it into a container. One of the input boxes is a textarea set up like so:</p> <p><code>&lt;textarea name="sectionContent_1" id="sectionContent_1"&gt;&lt;/tex...
[ { "answer_id": 149200, "author": "dcp3450", "author_id": 8278, "author_profile": "https://wordpress.stackexchange.com/users/8278", "pm_score": 0, "selected": false, "text": "<p>This did the trick:</p>\n\n<pre><code>var textAreaID = 'sectionContent_' + sectionID;\n$(this).parent()\n .f...
2014/06/10
[ "https://wordpress.stackexchange.com/questions/149196", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8278/" ]
I have a plugin that allows the user to dynamically add sections that need to have the tinyMCE editor in them. The jQuery clones a `div` and places it into a container. One of the input boxes is a textarea set up like so: `<textarea name="sectionContent_1" id="sectionContent_1"></textarea>` I need to replace the text...
``` tinymce.remove(); tinymce.init(); ``` This works well!
149,210
<p>I am using customized theme for my development. The site was working fine and in last few days started seeing this error</p> <blockquote> <p>Fatal error: Call to a member function is_singular() on a non-object in /home/content/29/11116929/html/studyus/wp-includes/comment.php on line 2399</p> </blockquote> <p>The...
[ { "answer_id": 149235, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>The error originates from the function <code>_close_comments_for_old_posts</code>, which accepts two argument...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149210", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1253/" ]
I am using customized theme for my development. The site was working fine and in last few days started seeing this error > > Fatal error: Call to a member function is\_singular() on a non-object in /home/content/29/11116929/html/studyus/wp-includes/comment.php on line 2399 > > > The error is on line 2399 which is...
As strange as it may sound, but the error was because in one of the posts I had published , there was - at end!! So I deleted the posts as that looked like the problem. Then I restored them one of one and tried to find out what was the problem. Not sure why that caused the exception to be thrown. Maybe because I was ...
149,236
<p>I am developing a new theme and I am using several sidebars in this theme. All works fine, but the widgets are not showing up in the theme customizer section. All widgets are working fine under "appearance -> widgets" section but not in "appearance -> customize". I am using wordpress 3.9.1.</p> <p>This is how I dec...
[ { "answer_id": 149237, "author": "Ariful Islam Shaon", "author_id": 48534, "author_profile": "https://wordpress.stackexchange.com/users/48534", "pm_score": 0, "selected": false, "text": "<p>Widget will never showing up calling by its name instead or call by ID.</p>\n\n<p>Please check sid...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149236", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54030/" ]
I am developing a new theme and I am using several sidebars in this theme. All works fine, but the widgets are not showing up in the theme customizer section. All widgets are working fine under "appearance -> widgets" section but not in "appearance -> customize". I am using wordpress 3.9.1. This is how I declared them...
Widgets DO appear in the Customizer, but only if you are on the page that they are used on. For example, I have a sidebar for the Archive page. When I'm in the Customizer and on the homepage, that sidebar doesn't appear. But if I navigate to an archive page while in the Customizer, it then appears in the widget area.
149,264
<p>I have this code</p> <pre><code>$return = include(TEMPLATEPATH . '/apex.php' ); $html .= $return; </code></pre> <p>I using the above code to get a php for from a plugin from theme dir. but it returns 1 with the other wanted outputs. how to solve this</p> <p>I have seen the other question on stackoverflow but tho...
[ { "answer_id": 149258, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 0, "selected": false, "text": "<p>Omitting the text domain from localization functions such as <code>__</code> and <code>_e</code> will result ...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149264", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/53932/" ]
I have this code ``` $return = include(TEMPLATEPATH . '/apex.php' ); $html .= $return; ``` I using the above code to get a php for from a plugin from theme dir. but it returns 1 with the other wanted outputs. how to solve this I have seen the other question on stackoverflow but those hasn't work thanks in advance
Turns out that wordpress uses context strings for this piece of text: \_x('Add New', 'post') and \_x('Add New', 'page') This is because the string 'Add New' is different depending on the following noun in some languages. i.e in Danish: 'Add New Post' => 'Tilføj Nyt Indløg' 'Add New Page' => 'Tilføj Ny Side'. Notice t...
149,271
<p>I like to get the ID of the selected front page. My page uses an Template for that page. I've read about <code>get_option('page_on_front')</code>, but this didn't work for me.</p> <p>Is there any function to get this ID?</p>
[ { "answer_id": 149272, "author": "Matt Royal", "author_id": 51860, "author_profile": "https://wordpress.stackexchange.com/users/51860", "pm_score": 0, "selected": false, "text": "<p>You could either go into your Dashboard > 'Pages' and then hover over the page that is using the front pag...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149271", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54051/" ]
I like to get the ID of the selected front page. My page uses an Template for that page. I've read about `get_option('page_on_front')`, but this didn't work for me. Is there any function to get this ID?
This should do the trick. ``` global $wp_query; $post = $wp_query->get_queried_object(); $post->ID; ``` This'll give you the ID for each page you're on. `get_option( 'page_on_front' )` should've worked though.
149,290
<p>my script is</p> <pre><code>function($) { var google_map_address = $('#address').text(); $(function () { $('#gmap').gmap3({ marker: { address: google_map_address }, map: { options: { zoom: 14 } } }); });})(jQuery); </code></pre> <p>and my php code is </p> <p...
[ { "answer_id": 149304, "author": "Matt Royal", "author_id": 51860, "author_profile": "https://wordpress.stackexchange.com/users/51860", "pm_score": 0, "selected": false, "text": "<p>Try using <code>html()</code> instead if <code>text()</code> function.</p>\n\n<p>Try:</p>\n\n<pre><code>va...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149290", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52854/" ]
my script is ``` function($) { var google_map_address = $('#address').text(); $(function () { $('#gmap').gmap3({ marker: { address: google_map_address }, map: { options: { zoom: 14 } } }); });})(jQuery); ``` and my php code is ``` init_shortcode(); fu...
Hey Guys i got the solution. just include my script in footer instead of header. ``` add_action('wp_footer', 'spyrowebs_gmap_enqueue_scripts'); ```
149,313
<p>I have made a series of posts and pages password protected on my website using the built-in Visibility setting. They all use the same password, so the user can view all of them after entering the password once. </p> <p><strong>The problem:</strong> I need the session to time out after an hour. I have tried using th...
[ { "answer_id": 164100, "author": "pltc", "author_id": 60962, "author_profile": "https://wordpress.stackexchange.com/users/60962", "pm_score": 2, "selected": false, "text": "<p>The reason is when you execute this code </p>\n\n<pre><code>setcookie('wp-postpass_' . COOKIEHASH, '', 0, COOKIE...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149313", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11369/" ]
I have made a series of posts and pages password protected on my website using the built-in Visibility setting. They all use the same password, so the user can view all of them after entering the password once. **The problem:** I need the session to time out after an hour. I have tried using this code in my functions...
The reason is when you execute this code ``` setcookie('wp-postpass_' . COOKIEHASH, '', 0, COOKIEPATH); ``` It will reset your post password cookie to blank '', so it just work once To solve this you need to assign the original cookie and extend the timeout, like this ``` setcookie('wp-postpass_' . COOKIEHASH, $_C...
149,322
<p>I want to remove the <em>header text</em> option from WordPress backend, under the <em>Appearance->Header page</em> at the bottom.</p> <p><img src="https://i.gyazo.com/0ab128502a675c3f7eee13db0cfedefe.png" alt="Screen Dump"></p> <p>Is there any hook or filter to remove this option from the backend?</p> <p>Thanks!...
[ { "answer_id": 149324, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": true, "text": "<p>This is controlled by theme as part of <a href=\"http://codex.wordpress.org/Function_Reference/add_theme_support#Cus...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149322", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13622/" ]
I want to remove the *header text* option from WordPress backend, under the *Appearance->Header page* at the bottom. ![Screen Dump](https://i.gyazo.com/0ab128502a675c3f7eee13db0cfedefe.png) Is there any hook or filter to remove this option from the backend? Thanks!
This is controlled by theme as part of [custom header feature declaration](http://codex.wordpress.org/Function_Reference/add_theme_support#Custom_Header). Something like this should disable that part of the feature (you might need to adjust, depending on specific theme used): ``` add_action( 'after_setup_theme', func...
149,333
<p>I've defined a variable - let's call it <code>$header_var</code>, which is placed in the header.php file. I would like this variable to be passed onto my template file (in this case taxonomy.php). </p> <p>Also I would like to be able to do the same the other way around, like passing a <code>$template_var</code> fro...
[ { "answer_id": 149350, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 5, "selected": false, "text": "<blockquote>\n <p>I've defined a variable - let's call it\n $header_var, which is placed in the header.php fil...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149333", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54079/" ]
I've defined a variable - let's call it `$header_var`, which is placed in the header.php file. I would like this variable to be passed onto my template file (in this case taxonomy.php). Also I would like to be able to do the same the other way around, like passing a `$template_var` from my taxonomy.php to header.php....
> > I've defined a variable - let's call it > $header\_var, which is placed in the header.php file. I would like this > variable to be passed onto my template file (in this case > taxonomy.php). > > > `global` is not a very recommended way to do the trick, but it works if you use it properly: put it before to d...
149,342
<p>I'm having problems using <code>WP_User_Query</code> to sort users by a meta value number, I would of thought this would be simple by it just displays results as descending alphabetically.</p> <pre><code> &lt;?php $args = array( 'orderby' =&gt; 'meta_value_num', 'meta_key ' =&gt; 'epicredvote', 'order' ...
[ { "answer_id": 149344, "author": "vancoder", "author_id": 26778, "author_profile": "https://wordpress.stackexchange.com/users/26778", "pm_score": 0, "selected": false, "text": "<p>Although <code>meta_value_num</code> would be valid for <code>WP_Query</code>, I don't see any mention of it...
2014/06/11
[ "https://wordpress.stackexchange.com/questions/149342", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22450/" ]
I'm having problems using `WP_User_Query` to sort users by a meta value number, I would of thought this would be simple by it just displays results as descending alphabetically. ``` <?php $args = array( 'orderby' => 'meta_value_num', 'meta_key ' => 'epicredvote', 'order' => 'DESC', ); // The Query $user_...
Add this code in `functions.php`. Use `orderby` with `meta_value_num` and define `meta_key` in argument array. ``` add_action( 'pre_user_query', 'wps_pre_user_query' ); function wps_pre_user_query( &$query ) { global $wpdb; if ( isset( $query->query_vars['orderby'] ) && 'meta_value_num' == $query->query_var...
149,373
<p><code>get_category</code> is returning <strong>null</strong> but using <code>get term_by</code> or <code>get_categories()</code> is not. Why?</p> <p>I have created term called categorycourses. I have a post related to coursecategory Lidköping (vardump1), </p> <p><strong>vardump1</strong></p> <pre><code>object(st...
[ { "answer_id": 149344, "author": "vancoder", "author_id": 26778, "author_profile": "https://wordpress.stackexchange.com/users/26778", "pm_score": 0, "selected": false, "text": "<p>Although <code>meta_value_num</code> would be valid for <code>WP_Query</code>, I don't see any mention of it...
2014/06/12
[ "https://wordpress.stackexchange.com/questions/149373", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38848/" ]
`get_category` is returning **null** but using `get term_by` or `get_categories()` is not. Why? I have created term called categorycourses. I have a post related to coursecategory Lidköping (vardump1), **vardump1** ``` object(stdClass)[2525] public 'term_id' => &int 5 public 'name' => &string 'Lidköping' (lengt...
Add this code in `functions.php`. Use `orderby` with `meta_value_num` and define `meta_key` in argument array. ``` add_action( 'pre_user_query', 'wps_pre_user_query' ); function wps_pre_user_query( &$query ) { global $wpdb; if ( isset( $query->query_vars['orderby'] ) && 'meta_value_num' == $query->query_var...
149,411
<p>My theme allows me to create a front-end login form in a normal blog page. Now, I wish to redirect all the users to that page and not to <strong>wp-login.php</strong>. I have used the below code snippet. </p> <pre><code>function redirect_login_page(){ $page_viewed = basename($_SERVER['REQUEST_URI']); // Where...
[ { "answer_id": 149412, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 1, "selected": false, "text": "<p>A good solution for this is to hook into <code>login_init</code>, which is fired before anything is outputted...
2014/06/12
[ "https://wordpress.stackexchange.com/questions/149411", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52146/" ]
My theme allows me to create a front-end login form in a normal blog page. Now, I wish to redirect all the users to that page and not to **wp-login.php**. I have used the below code snippet. ``` function redirect_login_page(){ $page_viewed = basename($_SERVER['REQUEST_URI']); // Where we want them to go $log...
I do this the same, but a little differently, and handle the case of logging in regular users or admins. I will assume you know to put these sorts of things in your "functions.php" or equivalent. ``` add_filter('login_url', 'your_login_url', 10, 2 ); add_action('login_init', 'your_login_page'); add_action('wp_login', ...
149,424
<p>I'm completely new to custom post types and custom taxonomies, so bear with me. I'm trying to create a breadcrumb navigation for the custom taxonomy <code>project-category</code> within the custom post type <code>projects</code>. Essentially, I need it to work like this:</p> <p>Custom Post Type &gt; Custom Taxonomy...
[ { "answer_id": 149438, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 4, "selected": true, "text": "<p>Using your method, I've edited it a bit to make it more viable. Here's the code, below I'll explain.</p>\n\n...
2014/06/12
[ "https://wordpress.stackexchange.com/questions/149424", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24566/" ]
I'm completely new to custom post types and custom taxonomies, so bear with me. I'm trying to create a breadcrumb navigation for the custom taxonomy `project-category` within the custom post type `projects`. Essentially, I need it to work like this: Custom Post Type > Custom Taxonomy Level 1 > Custom Taxonomy Level 2 ...
Using your method, I've edited it a bit to make it more viable. Here's the code, below I'll explain. ``` <ul> <li><a href="<?php echo home_url(); ?>/projects">Projects</a></li> <?php $term = get_term_by("slug", get_query_var("term"), get_query_var("taxonomy") ); $tmpTerm = $term; $tmpC...
149,427
<p>I am currently creating a plugin and need one of the fields to be a drop down calendar picker. Will I have to build this as well or is there a hook I can use to use something already produced by WordPress?</p>
[ { "answer_id": 149430, "author": "Jonathan Lafleur", "author_id": 10501, "author_profile": "https://wordpress.stackexchange.com/users/10501", "pm_score": 3, "selected": false, "text": "<p>jQuery Datepicker is included in WP Core, you can add it to your functions.php (for themes) or index...
2014/06/12
[ "https://wordpress.stackexchange.com/questions/149427", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24934/" ]
I am currently creating a plugin and need one of the fields to be a drop down calendar picker. Will I have to build this as well or is there a hook I can use to use something already produced by WordPress?
jQuery Datepicker is included in WP Core, you can add it to your functions.php (for themes) or index.php (for plugins) ``` function styles_scripts() { wp_enqueue_script('jquery-ui-datepicker'); // Enqueue some theme-roller or default style... wp_enqueue_style('jquery-style','http://ajax.googleapis.com/ajax...
149,456
<p>Setup a basic WPAlchemy repeater field with a TinyMCE textbox inside. If repeated I am unable to select the new textbox and add text.</p> <p>If I remove TinyMCE it works fine however. Please help.</p> <p>functions.php:</p> <pre><code>// Tiny mce metaboxes add_action('admin_print_footer_scripts','admin_print_foote...
[ { "answer_id": 149548, "author": "Bryan Willis", "author_id": 38123, "author_profile": "https://wordpress.stackexchange.com/users/38123", "pm_score": 1, "selected": true, "text": "<p>While it's hard to give answers without knowing version numbers of plugin/theme/tinymce/wp/etc, my best g...
2014/06/12
[ "https://wordpress.stackexchange.com/questions/149456", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37441/" ]
Setup a basic WPAlchemy repeater field with a TinyMCE textbox inside. If repeated I am unable to select the new textbox and add text. If I remove TinyMCE it works fine however. Please help. functions.php: ``` // Tiny mce metaboxes add_action('admin_print_footer_scripts','admin_print_footer_scripts',99); function adm...
While it's hard to give answers without knowing version numbers of plugin/theme/tinymce/wp/etc, my best guess is that it's issues from the new tinymce4. I dealt with this a few months ago, [here's a github repo](https://github.com/helgatheviking/WP-Alchemy-Holy-Grail-Theme) with an example on how to use with the new ...
149,489
<p>In version 3.6.1 and below this worked. After updating WordPress to version 3.9.1, my category list is broken</p> <p>In version 3.6.1, my category list looked like this</p> <pre><code>A|B|C (A) (B) (C) Apple Bat Cat </code></pre> <p>After upgrading to version 3.9.1, it looks like this</p> <pre><code>A...
[ { "answer_id": 149495, "author": "cybmeta", "author_id": 37428, "author_profile": "https://wordpress.stackexchange.com/users/37428", "pm_score": 1, "selected": false, "text": "<p>You are using <code>wp_list_categories()</code> function with the parameter <code>name__like</code> but this ...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149489", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54153/" ]
In version 3.6.1 and below this worked. After updating WordPress to version 3.9.1, my category list is broken In version 3.6.1, my category list looked like this ``` A|B|C (A) (B) (C) Apple Bat Cat ``` After upgrading to version 3.9.1, it looks like this ``` A|B|C (A) (B) (C) Apple Apple Apple ...
**ANSWER REVISITED** -------------------- I have just done the same type of answer on SO and took another route that is way faster than my original answer. I thought it would be nice to revisit this answer and post my new approach for benefit of this site. The `name__like` parameter of [`get_terms`](http://codex.wor...
149,498
<p>The <a href="http://wordpress.org/plugins/image-widget/" rel="nofollow">Image Widget</a> includes <code>width</code> and <code>height</code> on the images which I've unsuccessfully have been trying to filter out so I can have fluid width. </p> <p>I've tried the following, which seems to be the most common solutions...
[ { "answer_id": 149509, "author": "Nilambar Sharma", "author_id": 27998, "author_profile": "https://wordpress.stackexchange.com/users/27998", "pm_score": 1, "selected": false, "text": "<p>It is not possible to remove it from attribute filter. When rendering image, plugin is doing as below...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149498", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2937/" ]
The [Image Widget](http://wordpress.org/plugins/image-widget/) includes `width` and `height` on the images which I've unsuccessfully have been trying to filter out so I can have fluid width. I've tried the following, which seems to be the most common solutions for similar problems, in `functions.php`, but without suc...
It is not possible to remove it from attribute filter. When rendering image, plugin is doing as below. ``` $output .= rtrim("<img $hwstring"); foreach ( $attr as $name => $value ) { $output .= sprintf( ' %s="%s"', $name, $value ); } $output .= ' />'; ``` It is attaching width and height string beforehand and only ...
149,500
<p>My goal is a redirect to a custom template based on some new rewrite rule, but without having wordpress to make unusefull queries.</p> <p>my code:</p> <pre><code>function add_rewrite_rules() { add_rewrite_rule( '^settore/([^/]*)/?$', 'index.php?settore=$matches[1]', 'top' ); add...
[ { "answer_id": 149507, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 4, "selected": true, "text": "<p>Stop WordPress to run main query is hard: you have to dig inside the deep heart of WordPress.</p>\n\n<p>WordPr...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149500", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10381/" ]
My goal is a redirect to a custom template based on some new rewrite rule, but without having wordpress to make unusefull queries. my code: ``` function add_rewrite_rules() { add_rewrite_rule( '^settore/([^/]*)/?$', 'index.php?settore=$matches[1]', 'top' ); add_rewrite_tag('%settor...
Stop WordPress to run main query is hard: you have to dig inside the deep heart of WordPress. WordPress frontend workflow: 1. [`wp-blog-header.php`](https://github.com/WordPress/WordPress/blob/master/wp-blog-header.php) call the function `wp()` 2. [`wp()`](https://github.com/WordPress/WordPress/blob/master/wp-include...
149,501
<p>I'm doing a typical custom post type query with args like this:</p> <pre><code>array (size=4) 'post_type' =&gt; string 'custom_post_type' (length=15) 'post_status' =&gt; string 'publish' (length=7) 'posts_per_page' =&gt; int 5 'p' =&gt; string '2943' (length=4) </code></pre> <p>Yet amazingly, despite the f...
[ { "answer_id": 149503, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 3, "selected": true, "text": "<p>T a look at how to properly construct a query with <a href=\"http://codex.wordpress.org/Class_Reference/...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149501", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/29565/" ]
I'm doing a typical custom post type query with args like this: ``` array (size=4) 'post_type' => string 'custom_post_type' (length=15) 'post_status' => string 'publish' (length=7) 'posts_per_page' => int 5 'p' => string '2943' (length=4) ``` Yet amazingly, despite the fact that there IS one post being queri...
T a look at how to properly construct a query with [`WP_Query`](http://codex.wordpress.org/Class_Reference/WP_Query). ``` $args = array( 'post_type' => 'cameras', 'posts_per_page' => 5, ); $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { echo '<ul>'; while ( $the_quer...
149,528
<p>I have a custom table called wpgrating</p> <p>I have a column there called "ip" </p> <p>Now what I want to do is search for "ip" column and see if there is an entry already there?</p> <p>How can I achieve this?</p>
[ { "answer_id": 149557, "author": "Schism", "author_id": 52243, "author_profile": "https://wordpress.stackexchange.com/users/52243", "pm_score": 1, "selected": false, "text": "<p>What you are asking for should be straight SQL.</p>\n\n<p>Try adapting the following:</p>\n\n<pre><code>functi...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149528", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54176/" ]
I have a custom table called wpgrating I have a column there called "ip" Now what I want to do is search for "ip" column and see if there is an entry already there? How can I achieve this?
What you are asking for should be straight SQL. Try adapting the following: ``` function check_for_ip($ip) { global $wpdb; $sql = <<<SQL SELECT true FROM `wpgrating` WHERE `ip` = %s SQL; return (bool) $wpdb->get_var($wpdb->prepare($sql, $ip)); } ``` In essence, we do a simple `SE...
149,540
<p>Is it possible to have something like <code>name__in</code> <code>array()</code> for <code>WP_Query</code>?</p> <p>I am trying to get a list of custom posts from an array of the post's slugs.</p> <p>Looking at the <a href="http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters" rel="nofollow"...
[ { "answer_id": 149547, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 3, "selected": true, "text": "<p>The parameter is not supported by WordPress core, but you can implement it using a filter on <code>'posts_wher...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149540", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54182/" ]
Is it possible to have something like `name__in` `array()` for `WP_Query`? I am trying to get a list of custom posts from an array of the post's slugs. Looking at the [codex](http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters), there doesn't seem to be a way.
The parameter is not supported by WordPress core, but you can implement it using a filter on `'posts_where'`: ``` // require PHP 5.3+ add_action( 'posts_where', function( $where, $query ) { if ( isset( $query->query['name__in'] ) && is_array( $query->query['name__in'] ) ) { global $wpdb; $names = array_filt...
149,559
<p>I am writing a shortcode plugin that displays posts according to some parameters passed into the shortcode. I have the <code>wp_query</code> to get the posts and now I am trying to get the markup for the posts according to the theme's template files. </p> <p>In essence, <a href="http://codex.wordpress.org/Function_...
[ { "answer_id": 149567, "author": "Caspar", "author_id": 27191, "author_profile": "https://wordpress.stackexchange.com/users/27191", "pm_score": 0, "selected": false, "text": "<p>If you're looking for just the content from a post before it gets loaded into a template, then you're probably...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149559", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27667/" ]
I am writing a shortcode plugin that displays posts according to some parameters passed into the shortcode. I have the `wp_query` to get the posts and now I am trying to get the markup for the posts according to the theme's template files. In essence, [get\_template\_part](http://codex.wordpress.org/Function_Referenc...
I couldn't figure out a WordPress way to do this and looking at the WP source, it looks like this probably will never really be possible. However, I was able to get a solution using vanilla PHP by redirecting standard output into a buffer and loading the buffer into a variable. ``` $listings = new WP_Query(...); ob_st...
149,560
<p>I have a function working on 'create_term' hook, I'm trying to prevent <br> the term from being created on certain situations, I've tried</p> <pre><code>return false; </code></pre> <p>But that didn't do much, how do I prevent the term from being created?</p>
[ { "answer_id": 149562, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 3, "selected": true, "text": "<p><code>create_term</code> as you can see in <a href=\"https://github.com/WordPress/WordPress/blob/17b17d1c78bc2...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149560", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3642/" ]
I have a function working on 'create\_term' hook, I'm trying to prevent the term from being created on certain situations, I've tried ``` return false; ``` But that didn't do much, how do I prevent the term from being created?
`create_term` as you can see in [inline docs in code](https://github.com/WordPress/WordPress/blob/17b17d1c78bc2617ee31de6f9ef962c2eacbb716/wp-includes/taxonomy.php#L2547) > > Fires immediately after a new term is created, before the term cache > is cleaned > > > So you can't prevent an event after that event alr...
149,571
<p>customize_register only works with the customize_register hook, and regardless of what hook I use to add the custom taxonomy, it always happens after customize_register.</p> <p>(I want to loop through the list of terms from my custom taxonomy to create categories and custom options for each term)</p> <p>EDIT:</p> ...
[ { "answer_id": 149766, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 2, "selected": false, "text": "<p>AFAIK it shouldn't be a problem to get taxonomy data at the <code>customizer_register</code> hook s...
2014/06/13
[ "https://wordpress.stackexchange.com/questions/149571", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54192/" ]
customize\_register only works with the customize\_register hook, and regardless of what hook I use to add the custom taxonomy, it always happens after customize\_register. (I want to loop through the list of terms from my custom taxonomy to create categories and custom options for each term) EDIT: This is the water...
AFAIK it shouldn't be a problem to get taxonomy data at the `customizer_register` hook state. So that problem might have different reasons, but they aren't apparent from your question. Besides I'm not sure what you are trying to achieve, so you might want to fill the information gaps according to @Rarst's questions. As...
149,593
<p>I have a multisite network. The main site displays news. The sub directory sites have administrators and I call them subsite admin. If the subsite admin wants to post to the main site, I want them to log in only as a contributor for the main admin to review their news before publishing.</p> <p>Is it possible to cus...
[ { "answer_id": 149766, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 2, "selected": false, "text": "<p>AFAIK it shouldn't be a problem to get taxonomy data at the <code>customizer_register</code> hook s...
2014/06/14
[ "https://wordpress.stackexchange.com/questions/149593", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50619/" ]
I have a multisite network. The main site displays news. The sub directory sites have administrators and I call them subsite admin. If the subsite admin wants to post to the main site, I want them to log in only as a contributor for the main admin to review their news before publishing. Is it possible to customize the...
AFAIK it shouldn't be a problem to get taxonomy data at the `customizer_register` hook state. So that problem might have different reasons, but they aren't apparent from your question. Besides I'm not sure what you are trying to achieve, so you might want to fill the information gaps according to @Rarst's questions. As...
149,594
<p>I recently paid a freelancer to install a "hide WP" effect, which hides the fact that I am using WordPress. I specifically asked to install something with this effect: <a href="http://codecanyon.net/item/hide-my-wp-no-one-can-know-you-use-wordpress/4177158" rel="nofollow">http://codecanyon.net/item/hide-my-wp-no-one...
[ { "answer_id": 149766, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 2, "selected": false, "text": "<p>AFAIK it shouldn't be a problem to get taxonomy data at the <code>customizer_register</code> hook s...
2014/06/14
[ "https://wordpress.stackexchange.com/questions/149594", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54200/" ]
I recently paid a freelancer to install a "hide WP" effect, which hides the fact that I am using WordPress. I specifically asked to install something with this effect: <http://codecanyon.net/item/hide-my-wp-no-one-can-know-you-use-wordpress/4177158> My domain is <http://www.catsbuzz.com>. The freelancer did the instal...
AFAIK it shouldn't be a problem to get taxonomy data at the `customizer_register` hook state. So that problem might have different reasons, but they aren't apparent from your question. Besides I'm not sure what you are trying to achieve, so you might want to fill the information gaps according to @Rarst's questions. As...
149,601
<p>I'm using this function in functions.php to auto log in users after the sign up in the front-end</p> <pre><code>function auto_login_new_user( $user_id ) { wp_set_current_user($user_id); wp_set_auth_cookie($user_id); wp_redirect('http://mydomain.com/confirmation/'); exit; } add_action( 'user_register', ...
[ { "answer_id": 149603, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": true, "text": "<p>You're short-circuiting the registration process when you redirect and exit script execution, the <code>user_regist...
2014/06/14
[ "https://wordpress.stackexchange.com/questions/149601", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54163/" ]
I'm using this function in functions.php to auto log in users after the sign up in the front-end ``` function auto_login_new_user( $user_id ) { wp_set_current_user($user_id); wp_set_auth_cookie($user_id); wp_redirect('http://mydomain.com/confirmation/'); exit; } add_action( 'user_register', 'auto_login_ne...
You're short-circuiting the registration process when you redirect and exit script execution, the `user_register` action isn't the last step of the process. You can try to call [`wp_new_user_notification`](http://codex.wordpress.org/Function_Reference/wp_new_user_notification) manually, but I'm not sure what other side...
149,613
<p>I have a page template having a form which further have 3 input fields and and a submit button. I have a written a function in a plugin which inserts the retrieved values in database. I am trying to figure out what to write in action attribute of the form, so that when user clicks the submit button, the function get...
[ { "answer_id": 149616, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 4, "selected": true, "text": "<h2>Output The Form</h2>\n\n<p>Can be done via <a href=\"http://codex.wordpress.org/Shortcode_API\" rel=\"noreferrer\...
2014/06/14
[ "https://wordpress.stackexchange.com/questions/149613", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48415/" ]
I have a page template having a form which further have 3 input fields and and a submit button. I have a written a function in a plugin which inserts the retrieved values in database. I am trying to figure out what to write in action attribute of the form, so that when user clicks the submit button, the function gets e...
Output The Form --------------- Can be done via [Shortcode API](http://codex.wordpress.org/Shortcode_API). What Should Be Set on Form Action --------------------------------- Leave it blank `<form action="">`. Make sure you avoid using reserved name as form field name like `name` or `p`. Otherwise your form submissi...
149,647
<p>I'm having trouble getting this to work. I've created a custom taxonomy named article_subjects and am looping thru, displaying each term; but am trying to get the newest post for each term</p> <pre><code> &lt;section&gt; &lt;?php $args = array ( 'orderby' =&gt; 'name', 'or...
[ { "answer_id": 149616, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 4, "selected": true, "text": "<h2>Output The Form</h2>\n\n<p>Can be done via <a href=\"http://codex.wordpress.org/Shortcode_API\" rel=\"noreferrer\...
2014/06/14
[ "https://wordpress.stackexchange.com/questions/149647", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45362/" ]
I'm having trouble getting this to work. I've created a custom taxonomy named article\_subjects and am looping thru, displaying each term; but am trying to get the newest post for each term ``` <section> <?php $args = array ( 'orderby' => 'name', 'order' => 'ASC', ...
Output The Form --------------- Can be done via [Shortcode API](http://codex.wordpress.org/Shortcode_API). What Should Be Set on Form Action --------------------------------- Leave it blank `<form action="">`. Make sure you avoid using reserved name as form field name like `name` or `p`. Otherwise your form submissi...
149,667
<p>I am trying to make a shortcode to print a list of post titles. This is what I have so far:</p> <pre><code>function test( $atts , $content = null ){ $args = array( 'posts_per_page' =&gt; 3 ); $lastposts = get_posts( $args ); foreach ( $lastposts as $post ) { setup_postdata( $post ); ...
[ { "answer_id": 149669, "author": "Matt Royal", "author_id": 51860, "author_profile": "https://wordpress.stackexchange.com/users/51860", "pm_score": -1, "selected": false, "text": "<p>Try like this:</p>\n\n<pre><code>function test( $atts , $content = null ){\n\n $args = array( 'posts_p...
2014/06/15
[ "https://wordpress.stackexchange.com/questions/149667", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54231/" ]
I am trying to make a shortcode to print a list of post titles. This is what I have so far: ``` function test( $atts , $content = null ){ $args = array( 'posts_per_page' => 3 ); $lastposts = get_posts( $args ); foreach ( $lastposts as $post ) { setup_postdata( $post ); echo the_title()...
I know this has been answered and the answer solved the issue but I found it very poor for any newbie that want to learn WordPress so I give mine in the hope it will be better: 1. While `get_posts()` can do the job I would have used a simple query, for a secondary loop I prefer creating my own separate instance of th...
149,688
<p>I have a built a plugin which creates a custom menu like this:</p> <pre><code> add_menu_page( 'Wholesale Pricing', 'Wholesale', 'manage_options', 'woo-wholesale', 'woo_wholesale_page_call'); </code></pre> <p>I am now trying to add a subpage item underneath this. I have read the codex and came up with:</p> <pr...
[ { "answer_id": 149689, "author": "Abhineet Verma", "author_id": 35229, "author_profile": "https://wordpress.stackexchange.com/users/35229", "pm_score": 3, "selected": false, "text": "<p>Make sure that your <code>add_action</code> hook is set to <em>admin_menu</em>.</p>\n\n<p>Here's a sam...
2014/06/15
[ "https://wordpress.stackexchange.com/questions/149688", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13213/" ]
I have a built a plugin which creates a custom menu like this: ``` add_menu_page( 'Wholesale Pricing', 'Wholesale', 'manage_options', 'woo-wholesale', 'woo_wholesale_page_call'); ``` I am now trying to add a subpage item underneath this. I have read the codex and came up with: ``` add_submenu_page( 'woo-wholes...
Make sure that your `add_action` hook is set to *admin\_menu*. Here's a sample code: ``` add_action('admin_menu', 'wpse149688'); function wpse149688(){ add_menu_page( 'Wholesale Pricing', 'Wholesale', 'manage_options', 'woo-wholesale', 'woo_wholesale_page_call'); add_submenu_page( 'woo-wholesale', 'Registrati...
149,730
<p>I have homepage which needs to redirect to another page. For this to accomplish, I used the <code>meta fresh</code> tag </p> <pre><code>&lt;meta http-equiiv=refresh content="6; url=/home/"&gt; </code></pre> <p>And, it works perfectly. Later I found on Internet that this <code>meta fresh</code> code tag has been de...
[ { "answer_id": 149743, "author": "Kate Mag", "author_id": 14871, "author_profile": "https://wordpress.stackexchange.com/users/14871", "pm_score": 2, "selected": false, "text": "<p>There are two ways to do this:</p>\n\n<p>1 Using <a href=\"http://codex.wordpress.org/Function_Reference/wp_...
2014/06/16
[ "https://wordpress.stackexchange.com/questions/149730", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52146/" ]
I have homepage which needs to redirect to another page. For this to accomplish, I used the `meta fresh` tag ``` <meta http-equiiv=refresh content="6; url=/home/"> ``` And, it works perfectly. Later I found on Internet that this `meta fresh` code tag has been deprecated and is not at all SEO friendly. Then I used...
Though `wp_redirect()` doesn't allow a delay, PHP's `header()` ( which is what wp\_redirect [uses](https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L1168) ) does via [refresh](http://php.net/manual/en/function.header.php#97114). This may work for you. ``` <?php header( "refresh:5;url=...
149,733
<h2>Scenario</h2> <p>I have a following customized format for the website with Woocommerce.</p> <ol> <li><strong><code>&lt;?php if(is_shop()) {?&gt;</code></strong> There are certain css styles, JS options used for this particular page</li> <li><strong><code>&lt;?php } if(is_front_page()) { ?&gt;</code></strong> Same...
[ { "answer_id": 149743, "author": "Kate Mag", "author_id": 14871, "author_profile": "https://wordpress.stackexchange.com/users/14871", "pm_score": 2, "selected": false, "text": "<p>There are two ways to do this:</p>\n\n<p>1 Using <a href=\"http://codex.wordpress.org/Function_Reference/wp_...
2014/06/16
[ "https://wordpress.stackexchange.com/questions/149733", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15946/" ]
Scenario -------- I have a following customized format for the website with Woocommerce. 1. **`<?php if(is_shop()) {?>`** There are certain css styles, JS options used for this particular page 2. **`<?php } if(is_front_page()) { ?>`** Same as above with different css animations used or certain classes when on home pa...
Though `wp_redirect()` doesn't allow a delay, PHP's `header()` ( which is what wp\_redirect [uses](https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L1168) ) does via [refresh](http://php.net/manual/en/function.header.php#97114). This may work for you. ``` <?php header( "refresh:5;url=...
149,746
<p>I have added a post with the post format of video and I am trying to get to video so I can display the video in one div and the text in another like</p> <pre><code>&lt;div&gt;the embedded video&lt;/div&gt; &lt;div&gt;the content&lt;/div&gt; </code></pre> <p>Is there a way in wordpress to do this?</p>
[ { "answer_id": 149757, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Embeds are cached in hidden post meta fields with <code>_oembed_*</code> keys. You could retrieve all of meta (with...
2014/06/16
[ "https://wordpress.stackexchange.com/questions/149746", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54219/" ]
I have added a post with the post format of video and I am trying to get to video so I can display the video in one div and the text in another like ``` <div>the embedded video</div> <div>the content</div> ``` Is there a way in wordpress to do this?
Embeds are cached in hidden post meta fields with `_oembed_*` keys. You could retrieve all of meta (with [`get_post_custom()`](http://queryposts.com/function/get_post_custom/) for example) and try to get info from it. However, from quick look at my test data it seems that duplicates are not uncommon there (might have ...
149,763
<p>I'm at the final debugging stages for a major web design project I've been working on for the last 6 months.</p> <p>The site itself is based on the has become a bit of a behemoth (merging 4 existing sites into 1 massive one!) with various custom post types etc...</p> <p>Getting to the point - my Category and Tag a...
[ { "answer_id": 149764, "author": "TomHarrigan", "author_id": 4968, "author_profile": "https://wordpress.stackexchange.com/users/4968", "pm_score": 0, "selected": false, "text": "<p>You should use the <code>register_taxonomy_for_object_type()</code> to register the pre-existing taxonomies...
2014/06/16
[ "https://wordpress.stackexchange.com/questions/149763", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54280/" ]
I'm at the final debugging stages for a major web design project I've been working on for the last 6 months. The site itself is based on the has become a bit of a behemoth (merging 4 existing sites into 1 massive one!) with various custom post types etc... Getting to the point - my Category and Tag archives are no lo...
Category and Tag archive pages only query for the `post` post type. If you want custom post types to appear on those pages, you need to modify the query via [`pre_get_posts`](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) to add additional types. ``` function wpd_womens_blog_taxonomy_queries( $q...
149,789
<p>I decided to delete a custom post type and change them to pages instead. The pages display properly but anything in the directory that the custom post type used is returning a 404 even though the pages display normally.</p> <p>Here is an <a href="http://www.justiceforyou.com/accidents" rel="nofollow">example</a></p...
[ { "answer_id": 149764, "author": "TomHarrigan", "author_id": 4968, "author_profile": "https://wordpress.stackexchange.com/users/4968", "pm_score": 0, "selected": false, "text": "<p>You should use the <code>register_taxonomy_for_object_type()</code> to register the pre-existing taxonomies...
2014/06/16
[ "https://wordpress.stackexchange.com/questions/149789", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54297/" ]
I decided to delete a custom post type and change them to pages instead. The pages display properly but anything in the directory that the custom post type used is returning a 404 even though the pages display normally. Here is an [example](http://www.justiceforyou.com/accidents) Every page in the /accidents/ subdire...
Category and Tag archive pages only query for the `post` post type. If you want custom post types to appear on those pages, you need to modify the query via [`pre_get_posts`](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) to add additional types. ``` function wpd_womens_blog_taxonomy_queries( $q...
149,791
<p>I have some code that runs on the client that checks every 30 seconds or so for new comments, and if a new comment is found the user is alerted.</p> <p>The check count the comments on a page, and returns the count. The code that checks for comments is:</p> <pre><code>check_for_new_comments() { $sitewide = get_opti...
[ { "answer_id": 149764, "author": "TomHarrigan", "author_id": 4968, "author_profile": "https://wordpress.stackexchange.com/users/4968", "pm_score": 0, "selected": false, "text": "<p>You should use the <code>register_taxonomy_for_object_type()</code> to register the pre-existing taxonomies...
2014/06/16
[ "https://wordpress.stackexchange.com/questions/149791", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54299/" ]
I have some code that runs on the client that checks every 30 seconds or so for new comments, and if a new comment is found the user is alerted. The check count the comments on a page, and returns the count. The code that checks for comments is: ``` check_for_new_comments() { $sitewide = get_option( 'sitewide_mode', ...
Category and Tag archive pages only query for the `post` post type. If you want custom post types to appear on those pages, you need to modify the query via [`pre_get_posts`](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) to add additional types. ``` function wpd_womens_blog_taxonomy_queries( $q...
149,803
<p>I'm trying to check whether the page.php template is being used or not. I've tried <code>is_page_template( 'page.php' )</code> but it doesn't work. </p> <p>I also can't use <code>is_page()</code> because I only want to do something when <code>page.php</code> is used, and not when some other custom Page template is ...
[ { "answer_id": 239950, "author": "intagli", "author_id": 103228, "author_profile": "https://wordpress.stackexchange.com/users/103228", "pm_score": 4, "selected": false, "text": "<p>I actually ran into the same problem myself and my solution was this code:</p>\n\n<pre><code>if(basename(ge...
2014/06/16
[ "https://wordpress.stackexchange.com/questions/149803", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43834/" ]
I'm trying to check whether the page.php template is being used or not. I've tried `is_page_template( 'page.php' )` but it doesn't work. I also can't use `is_page()` because I only want to do something when `page.php` is used, and not when some other custom Page template is used. Please let me know about this and th...
I actually ran into the same problem myself and my solution was this code: ``` if(basename(get_page_template()) === 'page.php'){ } ``` `basename(get_page_template())` gets the filename of the page template (according to <https://codex.wordpress.org/Function_Reference/get_page_template>) and we then check if it is e...
149,825
<p>I've created a shortcode using my limited knowledge, google, and stackexchange to do so.</p> <p>But when I load the page, it loads above the page contents and appears as html text. </p> <pre><code>(shortocode text) ------- page contents appearing normally </code></pre> <p>As I've said, I have limited (Zero) knowl...
[ { "answer_id": 149827, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 2, "selected": true, "text": "<p>You're using your shortcode function to directly output something (using <code>echo</code>). Shortcodes are su...
2014/06/17
[ "https://wordpress.stackexchange.com/questions/149825", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51030/" ]
I've created a shortcode using my limited knowledge, google, and stackexchange to do so. But when I load the page, it loads above the page contents and appears as html text. ``` (shortocode text) ------- page contents appearing normally ``` As I've said, I have limited (Zero) knowledge of this type of coding and I...
You're using your shortcode function to directly output something (using `echo`). Shortcodes are supposed to *return* the desired output rather than echo it directly. You could use [output buffering](http://www.php.net//manual/en/function.ob-start.php) to "catch" anything that's outputted (for example, via `echo`) in a...
149,826
<p>I am using this code, but once I click on the next post/previous post link, I am redirected to the next post/previous post of a different category.</p> <pre><code> previous_post_link( '%link', 'Prev post in category', $in_same_term = true ); next_post_link( '%link', 'Next post in category', $in_same_term = true );...
[ { "answer_id": 149828, "author": "engelen", "author_id": 40403, "author_profile": "https://wordpress.stackexchange.com/users/40403", "pm_score": 2, "selected": false, "text": "<p>The <a href=\"http://codex.wordpress.org/Function_Reference/previous_post_link\" rel=\"nofollow\"><code>previ...
2014/06/17
[ "https://wordpress.stackexchange.com/questions/149826", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54318/" ]
I am using this code, but once I click on the next post/previous post link, I am redirected to the next post/previous post of a different category. ``` previous_post_link( '%link', 'Prev post in category', $in_same_term = true ); next_post_link( '%link', 'Next post in category', $in_same_term = true ); ``` I am tr...
Here is the code to get category based previous and next links on posts: ``` <?php $post_id = $post->ID; // current post ID $cat = get_the_category(); $current_cat_id = $cat[0]->cat_ID; // current category ID $args = array( 'category' => $current_cat_id, 'orderby' => 'post_date', 'order' => 'DESC' ...
149,841
<p>After enqueing scripts as per WP codex and WP Beginner tutorial the site has a Javascript error: Uncaught ReferenceError: imagesLoaded is not defined</p> <p>Many others also have this problem.</p> <p>Link: <a href="http://www.wpbeginner.com/wp-themes/how-to-use-masonry-to-add-pinterest-style-post-grid-in-wordpres...
[ { "answer_id": 149842, "author": "mitesh", "author_id": 25056, "author_profile": "https://wordpress.stackexchange.com/users/25056", "pm_score": 0, "selected": false, "text": "<p>If you used code from above link then replace <code>wp_enqueue_script('masonry')</code> with <code>wp_enqueue_...
2014/06/17
[ "https://wordpress.stackexchange.com/questions/149841", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38077/" ]
After enqueing scripts as per WP codex and WP Beginner tutorial the site has a Javascript error: Uncaught ReferenceError: imagesLoaded is not defined Many others also have this problem. Link: <http://www.wpbeginner.com/wp-themes/how-to-use-masonry-to-add-pinterest-style-post-grid-in-wordpress/>
Followed the same article and ran into the same issue; the author (Josh Pollock) posted a [followup](http://joshpress.net/blog/using-masonry-2-3-wordpress-3-9/) on his blog. Essentially from WP 3.9, Masonry is there for you to use so all you need in functions.php is: ``` add_action( 'wp_enqueue_scripts', 'slug_masonr...
149,850
<p>For my website, I am using a static home page page Home (template front-page.php) and for posts- page News (template home.php)</p> <p>I need to show all the post titles and exceprts on that page News (templ. home.php), but also show the original title and the_content from that page News itself.</p> <p>This code be...
[ { "answer_id": 149856, "author": "user2573869", "author_id": 35489, "author_profile": "https://wordpress.stackexchange.com/users/35489", "pm_score": 0, "selected": false, "text": "<pre><code> &lt;?php get_header(); ?&gt;\n\n &lt;?php\n the_title();\n the_content();\n ?...
2014/06/17
[ "https://wordpress.stackexchange.com/questions/149850", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5878/" ]
For my website, I am using a static home page page Home (template front-page.php) and for posts- page News (template home.php) I need to show all the post titles and exceprts on that page News (templ. home.php), but also show the original title and the\_content from that page News itself. This code below while statem...
`get_queried_object()` stores the original object that was found as a match for the permalink. It's the WP\_Post object of your News Page ``` $news_page = get_queried_object(); echo $news_page->post_title; ```
149,855
<p>This is a strange behavior I can't come up with a good explanation for:</p> <p><strong>If you append <code>/?name</code> to a WordPress URL, it is loading the blog page.</strong></p> <p>I came up with it by creating a custom Aweber "thank you" page, which is supposed to load at <a href="http://mydomain.com/thank-y...
[ { "answer_id": 149857, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>Those are reserved keywords</p>\n\n<p>When you visit a WordPress blog you have:</p>\n\n<pre><code>blogindexpa...
2014/06/17
[ "https://wordpress.stackexchange.com/questions/149855", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32610/" ]
This is a strange behavior I can't come up with a good explanation for: **If you append `/?name` to a WordPress URL, it is loading the blog page.** I came up with it by creating a custom Aweber "thank you" page, which is supposed to load at <http://mydomain.com/thank-you>. However Aweber appends a lot of information ...
Those are reserved keywords When you visit a WordPress blog you have: ``` blogindexpage/?queryvariables=queryvalues ``` So for a search request: ``` example.com/?s=searchterm ``` For a post/page of ID 12: ``` example.com/?p=12 ``` etc etc Pretty permalinks hides all this by using regular expressions to map n...
149,866
<p>I have CPT 'movie', with the following taxonomies: genre, director, and actor.</p> <p>The code used to register these is this: <a href="http://pastebin.com/yJ9XHCDk" rel="nofollow">http://pastebin.com/yJ9XHCDk</a></p> <p>I have an archive movie page working using the following code in archie-movie.php:</p> <pre><...
[ { "answer_id": 149873, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 0, "selected": false, "text": "<p>I'm going to start by switching your loop to check if it has any posts and if not returning a notice tha...
2014/06/17
[ "https://wordpress.stackexchange.com/questions/149866", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54333/" ]
I have CPT 'movie', with the following taxonomies: genre, director, and actor. The code used to register these is this: <http://pastebin.com/yJ9XHCDk> I have an archive movie page working using the following code in archie-movie.php: ``` <?php get_header(); ?> <div id="middle" class="clearfix"> <d...
I think you may need to filter the query for that taxonomy so it displays your movie custom post type. Try adding this to your theme's `functions.php` file: ``` function custom_post_archive($query) { if (!is_admin() && is_tax('genre') && $query->is_tax) $query->set( 'post_type', array('movie', 'nav_menu_i...
149,882
<p>Is it possible to have a section on a page that shows 2 excerpts from 4 different category posts, including their featured images?</p> <p>All I have so far is something like: </p> <pre><code> &lt;?php query_posts("showposts=2&amp;cat=11,12,13,14"); ?&gt; &lt;?php if ( have_posts() ) : while ...
[ { "answer_id": 149895, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 2, "selected": true, "text": "<p>I first want to jump in and say this, you should not be using <a href=\"http://codex.wordpress.org/Funct...
2014/06/17
[ "https://wordpress.stackexchange.com/questions/149882", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6787/" ]
Is it possible to have a section on a page that shows 2 excerpts from 4 different category posts, including their featured images? All I have so far is something like: ``` <?php query_posts("showposts=2&cat=11,12,13,14"); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> ...
I first want to jump in and say this, you should not be using [`query_posts`](http://codex.wordpress.org/Function_Reference/query_posts), my emphasis, and stated in the codex as well, and I quote > > **Note:** This function isn't meant to be used by plugins or themes. As explained later, there are better, more perfor...
149,925
<p>How do I count only the post that have a specific custom meta field value?</p> <pre><code>$productCount = wp_count_posts('product'); echo $productCount-&gt;publish; </code></pre> <p>That gives me all the total of all the post. </p> <p>How do I find out how many of those post have say a custom meta value of <code>...
[ { "answer_id": 149935, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 4, "selected": true, "text": "<p>There is no default/native function in wordpress to count posts from a specific meta value. <a href=\"ht...
2014/06/18
[ "https://wordpress.stackexchange.com/questions/149925", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47366/" ]
How do I count only the post that have a specific custom meta field value? ``` $productCount = wp_count_posts('product'); echo $productCount->publish; ``` That gives me all the total of all the post. How do I find out how many of those post have say a custom meta value of `cat`?
There is no default/native function in wordpress to count posts from a specific meta value. [`wp_count_posts`](http://codex.wordpress.org/Function_Reference/wp_count_posts) only counts the amount of posts according to post type It might be useful here to use [`WP_Query`](http://codex.wordpress.org/Class_Reference/WP_Q...
149,951
<p>I have menu like this:</p> <pre><code>&lt;ul&gt; &lt;li&gt; &lt;div class="buttons-4" title="some_title"&gt; &lt;a href="[some_url]"&gt;[something]&lt;/a&gt; &lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="buttons-5" title="some_title"&g...
[ { "answer_id": 149935, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 4, "selected": true, "text": "<p>There is no default/native function in wordpress to count posts from a specific meta value. <a href=\"ht...
2014/06/18
[ "https://wordpress.stackexchange.com/questions/149951", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52716/" ]
I have menu like this: ``` <ul> <li> <div class="buttons-4" title="some_title"> <a href="[some_url]">[something]</a> </div> </li> <li> <div class="buttons-5" title="some_title"> <a href="[some_url]">[something]</a> ...
There is no default/native function in wordpress to count posts from a specific meta value. [`wp_count_posts`](http://codex.wordpress.org/Function_Reference/wp_count_posts) only counts the amount of posts according to post type It might be useful here to use [`WP_Query`](http://codex.wordpress.org/Class_Reference/WP_Q...
150,029
<p>I have to display three videos (custom post type) on my first page. When clicking on the link, the post is displayed and video should be in default width.</p> <p>Can you help to find out how to change width of videos (like youtube)?</p> <p>This is how I display info now, and this displays all content (including vi...
[ { "answer_id": 151557, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 4, "selected": true, "text": "<p>I'm assuming you are using WordPress' <a href=\"http://codex.wordpress.org/Embeds\" rel=\"nofollow n...
2014/06/18
[ "https://wordpress.stackexchange.com/questions/150029", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35268/" ]
I have to display three videos (custom post type) on my first page. When clicking on the link, the post is displayed and video should be in default width. Can you help to find out how to change width of videos (like youtube)? This is how I display info now, and this displays all content (including video). I need some...
I'm assuming you are using WordPress' [Embeds](http://codex.wordpress.org/Embeds) feature. Generally speaking [`wp_embed_defaults()`](http://codex.wordpress.org/Function_Reference/wp_embed_defaults) gives you the information you need. A look at the [source](https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-inc...
150,053
<p>Below is a page template where I'm trying to retrieve active members metadata (of Restrict Content Pro). Displaying users' meta is working just fine; but I can't get ONLY active members to display, rather than everyone. I wondered if perhaps there a simple error in the syntax below that might correct this. </p> <p>...
[ { "answer_id": 150058, "author": "Nilambar Sharma", "author_id": 27998, "author_profile": "https://wordpress.stackexchange.com/users/27998", "pm_score": 1, "selected": false, "text": "<p>Curly braces for <code>foreach</code> is missing. Try this:\n \n\n<pre><code>/*\nTemplate Name: Di...
2014/06/19
[ "https://wordpress.stackexchange.com/questions/150053", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8822/" ]
Below is a page template where I'm trying to retrieve active members metadata (of Restrict Content Pro). Displaying users' meta is working just fine; but I can't get ONLY active members to display, rather than everyone. I wondered if perhaps there a simple error in the syntax below that might correct this. I need to ...
Curly braces for `foreach` is missing. Try this: ``` /* Template Name: Directory */ add_action( 'genesis_entry_content', 'ogs_directory', 5 ); function ogs_directory() { $args = array( 'blog_id' => 1, // unless yours is a multisite install, you shouldn't need to change this 'excl...
150,055
<p>I can manage to show one checkbox using <a href="http://www.remicorson.com/mastering-woocommerce-products-custom-fields/" rel="nofollow">woocommerce products custom fields</a></p> <p>However, I need to show multiple values from multiple checkboxes in my admin area. I have the following code:</p> <pre><code> &lt;in...
[ { "answer_id": 150096, "author": "sander", "author_id": 50518, "author_profile": "https://wordpress.stackexchange.com/users/50518", "pm_score": 2, "selected": false, "text": "<p>I ended up using Advanced Custom Fields Plugin with get_field( \"facilities\" ) in my template. </p>\n\n<p>I c...
2014/06/19
[ "https://wordpress.stackexchange.com/questions/150055", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50518/" ]
I can manage to show one checkbox using [woocommerce products custom fields](http://www.remicorson.com/mastering-woocommerce-products-custom-fields/) However, I need to show multiple values from multiple checkboxes in my admin area. I have the following code: ``` <input type="checkbox" name="myoption[option_one]" va...
I ended up using Advanced Custom Fields Plugin with get\_field( "facilities" ) in my template. I created a Field Group and added facilities as checkboxes. Much faster than checking my code. I would've liked to add the checkboxes straight into WooCommerce but this was a time saver and no more time is needed to fix the...
150,115
<p>In writing my plugin, I have added my menus and submenus to the admin page. The pages load and function as intended. What I am trying to do is create some links inside of these pages that will pass a parameter to a new page. I am close to accomplishing this but <em>the page always opens up outside of the admin sc...
[ { "answer_id": 230119, "author": "Ludo", "author_id": 96937, "author_profile": "https://wordpress.stackexchange.com/users/96937", "pm_score": 1, "selected": false, "text": "<p>Call the same page with a parameter and include the content depending on the parameter:</p>\n\n<pre><code>if ( !...
2014/06/19
[ "https://wordpress.stackexchange.com/questions/150115", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54443/" ]
In writing my plugin, I have added my menus and submenus to the admin page. The pages load and function as intended. What I am trying to do is create some links inside of these pages that will pass a parameter to a new page. I am close to accomplishing this but *the page always opens up outside of the admin screen*. I ...
Call the same page with a parameter and include the content depending on the parameter: ``` if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define(PLUG_NAME, "my_admin"); //hook to add an item in the menu admin add_action('admin_menu', 'my_admin_setup_menu'); function my_admin_setup_menu(...
150,116
<p>In my "About" page I list all WP users of the site. Then in author.php I display the description of the selected user with this code: <code>&lt;?php the_author_meta( 'description' );?&gt;</code>.</p> <p>Problem: this code only display user description if this user is logged, otherwise it displays nothing. Why?</p> ...
[ { "answer_id": 151479, "author": "shahpranaf", "author_id": 42962, "author_profile": "https://wordpress.stackexchange.com/users/42962", "pm_score": 1, "selected": false, "text": "<p>You are using \"<strong>the_author_meta( 'description' )</strong>\" inside loop or outside loop ?\nIf you ...
2014/06/19
[ "https://wordpress.stackexchange.com/questions/150116", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11634/" ]
In my "About" page I list all WP users of the site. Then in author.php I display the description of the selected user with this code: `<?php the_author_meta( 'description' );?>`. Problem: this code only display user description if this user is logged, otherwise it displays nothing. Why? Code of the "About" page: ```...
I have tested your code on my side, and it works perfectly. The relevant info displays, whether I'm logged in or not. This is definitely not a problem with your code, but more an external problem. You will need to look for any type of code that might restrict this code from showing if a user is logged out, something ...
150,125
<p>I am trying to disable comment notifications for post authors (or anyone else besides the site's admin) for a client's site. I've attempted to create a plugin that uses the pluggable function <code>wp_notify_postauthor</code>, but it does not seem to have an effect.</p> <p>Here's the plugin code:</p> <pre><code>&l...
[ { "answer_id": 150141, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 4, "selected": true, "text": "<p>I skimmed through the source of the <code>wp_notify_postauthor()</code> function and noticed the <a href=\"htt...
2014/06/19
[ "https://wordpress.stackexchange.com/questions/150125", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36167/" ]
I am trying to disable comment notifications for post authors (or anyone else besides the site's admin) for a client's site. I've attempted to create a plugin that uses the pluggable function `wp_notify_postauthor`, but it does not seem to have an effect. Here's the plugin code: ``` <?php /** * * * @package Disa...
I skimmed through the source of the `wp_notify_postauthor()` function and noticed the [`comment_notification_recipients`](https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/pluggable.php#L1261) filter. I wonder if you could simplify your plugin to the following code snippet: ``` <?php /** * Plugin...
150,133
<p>Is there a way to change the date and time in WordPress, not the timezone, but the date and time all together, like make it 03-21-85 11:11 PM. I want all dates and times to be changed, not just to one post or page, but to the whole WordPress site it's self.</p>
[ { "answer_id": 150141, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 4, "selected": true, "text": "<p>I skimmed through the source of the <code>wp_notify_postauthor()</code> function and noticed the <a href=\"htt...
2014/06/19
[ "https://wordpress.stackexchange.com/questions/150133", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42899/" ]
Is there a way to change the date and time in WordPress, not the timezone, but the date and time all together, like make it 03-21-85 11:11 PM. I want all dates and times to be changed, not just to one post or page, but to the whole WordPress site it's self.
I skimmed through the source of the `wp_notify_postauthor()` function and noticed the [`comment_notification_recipients`](https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/pluggable.php#L1261) filter. I wonder if you could simplify your plugin to the following code snippet: ``` <?php /** * Plugin...
150,138
<p>How can I make widget titles allow HTML? I want to add icons from an iconfont to the titles like </p> <pre><code>&lt;span class="icon-someicon"&gt;Widget Title Here&lt;/span&gt; </code></pre> <p>I tried the following but it does not work at all...</p> <pre><code>function html_widget_title( $title ) { $title ...
[ { "answer_id": 150143, "author": "Nilambar Sharma", "author_id": 27998, "author_profile": "https://wordpress.stackexchange.com/users/27998", "pm_score": 1, "selected": false, "text": "<p>I did not understand what you are doing in the function. See below example how title can be wrapped i...
2014/06/19
[ "https://wordpress.stackexchange.com/questions/150138", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52621/" ]
How can I make widget titles allow HTML? I want to add icons from an iconfont to the titles like ``` <span class="icon-someicon">Widget Title Here</span> ``` I tried the following but it does not work at all... ``` function html_widget_title( $title ) { $title = str_replace( '[', '<', $title ); $title = s...
Whoopsie, I found out how to do it - could not be any simpler. For additional information: I used fontello to create my own iconfont and added it to my WordPress Theme. That's why `font-family` is fontello in my snippet below. I looked up the CSS Path to my widget titles (i.e. `.widget-3 > h3.widget-title`), added `:b...
150,188
<p>I create a new style.css and use it in child theme. And I create a new folder in wp-content and name it as themename-child and upload the style.css that I created. Now, I go to wp dashboard -> Appearance -> Themes and I look the child theme that I create. And I found this error:</p> <pre><code>Broken Themes The fo...
[ { "answer_id": 150189, "author": "Hoang An", "author_id": 51947, "author_profile": "https://wordpress.stackexchange.com/users/51947", "pm_score": -1, "selected": false, "text": "<p>add in themename-child style.css:</p>\n\n<pre><code>/*\nTheme Name: Your Theme\nVersion: 1.0\nAuthor: Your ...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150188", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54473/" ]
I create a new style.css and use it in child theme. And I create a new folder in wp-content and name it as themename-child and upload the style.css that I created. Now, I go to wp dashboard -> Appearance -> Themes and I look the child theme that I create. And I found this error: ``` Broken Themes The following themes...
This should help you out and clear up a few things. This was done for another theme, you should just change the parent theme paths accordingly For the sake of creating a child theme and understanding what is what, I will help you here. This is how the child theme stylesheet header should look like (*or any parent them...
150,207
<p>I have installed and activated the Wordpress JSON API (<a href="http://wordpress.org/plugins/json-api" rel="nofollow">http://wordpress.org/plugins/json-api</a>) in my self hosted WP site. Now my site content is open to the world via this API in JSON format.</p> <p>But, I want to restrict the access of this JSON API...
[ { "answer_id": 150222, "author": "zipzit", "author_id": 45680, "author_profile": "https://wordpress.stackexchange.com/users/45680", "pm_score": 0, "selected": false, "text": "<p>The software provided has tools to utilize the WordPress Nonce system. As now written, the nonce is only used ...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150207", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54485/" ]
I have installed and activated the Wordpress JSON API (<http://wordpress.org/plugins/json-api>) in my self hosted WP site. Now my site content is open to the world via this API in JSON format. But, I want to restrict the access of this JSON API only to the requests that are coming from specific domain. Even though som...
[More reliable](https://stackoverflow.com/a/4773981/550907) will be allowing specific IP instead of domain using `REMOTE_ADDR` header. You can use `HTTP_REFERRER` header but [it is not reliable](https://stackoverflow.com/questions/6023941/how-reliable-is-http-referer). You can do it via using `rest_authentication_err...
150,209
<p>Instead of using sidebar widgets to tell on what page they should be visible, I like to choose at the menu settings to appear on specific pages.</p> <p>Default Wordpress way:</p> <p><img src="https://i.stack.imgur.com/lu5Bo.png" alt="How it looks default"></p> <p>So projects is a page and has some subpages. But w...
[ { "answer_id": 150240, "author": "Susan", "author_id": 54470, "author_profile": "https://wordpress.stackexchange.com/users/54470", "pm_score": 0, "selected": false, "text": "<p>If you are willing to re-engage your widgets and want a simple solution, you can use a plugin called Display Wi...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150209", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Instead of using sidebar widgets to tell on what page they should be visible, I like to choose at the menu settings to appear on specific pages. Default Wordpress way: ![How it looks default](https://i.stack.imgur.com/lu5Bo.png) So projects is a page and has some subpages. But what if I have like 10 more of these pa...
That's a nice option, but I agree with sri, right now it really depends on your theme. You can do a work-around through [is\_page()](http://codex.wordpress.org/Function_Reference/is_page). You need to write something like this on your **page.php** theme file: ``` <?php if (is_page('projects')) { if ( is_ac...
150,228
<p>I'm not sure if this is a WordPress specific issue but when I create a simple form as a widget in my sidebar the checkbox won't check when I click on the label. Strangely though, it does work when I've pulled the same form via get_template_part into my navigation. I want to use the 'checkbox hack' which relies upon ...
[ { "answer_id": 150230, "author": "LeMike", "author_id": 42974, "author_profile": "https://wordpress.stackexchange.com/users/42974", "pm_score": 0, "selected": false, "text": "<p>Reload the page, click two and remember them. Then disable any CSS. You will see that they are checked. So som...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150228", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45504/" ]
I'm not sure if this is a WordPress specific issue but when I create a simple form as a widget in my sidebar the checkbox won't check when I click on the label. Strangely though, it does work when I've pulled the same form via get\_template\_part into my navigation. I want to use the 'checkbox hack' which relies upon t...
Okay, so in case this is of use to anyone else. The original checkbox hack tut that I was following came from [here](http://webdesign.tutsplus.com/tutorials/quick-tip-easy-css3-checkboxes-and-radio-buttons--webdesign-8953). I've got around the issue that I was having in WordPress by wrapping my checkboxes in the labe...
150,247
<p>i want to retrieve custom posts using using custom query . my taxonomy is recipe_tx and terms (Beef) , (Chicken) etc in it .</p> <p>i have tried using </p> <pre><code>SELECT p.* FROM wp_posts p, wp_term_taxonomy tt, wp_term_relationships tr WHERE p.ID=tr.`object_id` AND tt.`term_id`=tr.`term_taxonomy_id` AND ...
[ { "answer_id": 150251, "author": "jdm2112", "author_id": 45202, "author_profile": "https://wordpress.stackexchange.com/users/45202", "pm_score": 7, "selected": true, "text": "<p>Have you tried using the WP_Query class? You might find it's easier to use the built-in tools for this instea...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150247", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52335/" ]
i want to retrieve custom posts using using custom query . my taxonomy is recipe\_tx and terms (Beef) , (Chicken) etc in it . i have tried using ``` SELECT p.* FROM wp_posts p, wp_term_taxonomy tt, wp_term_relationships tr WHERE p.ID=tr.`object_id` AND tt.`term_id`=tr.`term_taxonomy_id` AND (p.post_type = 'reci...
Have you tried using the WP\_Query class? You might find it's easier to use the built-in tools for this instead of a custom query from scratch. Something similar to the following should work for you: ``` <?php $args = array( 'post_type' => 'recipe_cpt', 'tax_query' => array( array( 'taxonomy' => 'recipe_tx', ...
150,258
<p>Someone moved a very important page on my website into the trash, and I do not know who did it! It was not deleted permanently so I don't need to worry, in that sense.</p> <p>The revisions, when I restored it, show that someone edited it 3 days prior to today, so it could have been them, but I can't be sure.</p> ...
[ { "answer_id": 150273, "author": "Will", "author_id": 17940, "author_profile": "https://wordpress.stackexchange.com/users/17940", "pm_score": 4, "selected": true, "text": "<p>By default, no, WordPress doesn't keep track of who changes post statuses (at least that I can see).</p>\n\n<p>yo...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150258", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15209/" ]
Someone moved a very important page on my website into the trash, and I do not know who did it! It was not deleted permanently so I don't need to worry, in that sense. The revisions, when I restored it, show that someone edited it 3 days prior to today, so it could have been them, but I can't be sure. Does WP keep tr...
By default, no, WordPress doesn't keep track of who changes post statuses (at least that I can see). you can hook into `transition_post_status` and log the user id. ``` add_action( 'transition_post_status', 'wwm_transition_post_status', 10, 3 ); function wwm_transition_post_status( $new_status, $old_status, ...
150,270
<p>I try to use <strong>wp_editor()</strong> in content that was loaded with ajax, but none of the required files and some other configuration script not loaded :</p> <p>The structure of ajax is something like this:</p> <pre><code>function get_test_page(){ include( TEMPLATEPATH . '/page.php' ); die( main() ); }...
[ { "answer_id": 160915, "author": "Александр Виткалов", "author_id": 59494, "author_profile": "https://wordpress.stackexchange.com/users/59494", "pm_score": -1, "selected": false, "text": "<p>Try add\n</p>\n\n<pre><code>do_action('admin_print_footer_scripts');\n</code></pre>\n\n<p>after\n...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150270", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54523/" ]
I try to use **wp\_editor()** in content that was loaded with ajax, but none of the required files and some other configuration script not loaded : The structure of ajax is something like this: ``` function get_test_page(){ include( TEMPLATEPATH . '/page.php' ); die( main() ); } add_action( 'wp_ajax_nopriv_get_...
**Solution**: Add `wp_editor()` in somewhere that works perfectly and hide it. ``` <div class="hidden-editor-container" style="display:none;"> <?php wp_editor( '', 'editor' ); ?> </div> ``` after that assign editor contents to the global JS variable. ``` EDITOR = $('.hidden-editor-container').contents(); ``` ...
150,272
<p>I want to set a custom post-title with a custom-field meta in my Wordpress Theme.</p> <p>The user will add a new post to the post-type. When they do they will only see the "Title", "URL", and "Publish" metas. I want to eliminate the "Title" and only show the "URL" and "Publish" meta. When the user pastes the URL I...
[ { "answer_id": 150280, "author": "hjahan", "author_id": 45983, "author_profile": "https://wordpress.stackexchange.com/users/45983", "pm_score": 1, "selected": false, "text": "<p>For hiding Title in admin panel the easiest way is using CSS. Another better way is using front-end submitting...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150272", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52719/" ]
I want to set a custom post-title with a custom-field meta in my Wordpress Theme. The user will add a new post to the post-type. When they do they will only see the "Title", "URL", and "Publish" metas. I want to eliminate the "Title" and only show the "URL" and "Publish" meta. When the user pastes the URL I have a va...
For hiding Title in admin panel the easiest way is using CSS. Another better way is using front-end submitting plugins. Follwoing code help you to change post title. ``` add_filter( 'the_title', 'replacePostTitle', 100, 2); function replacePostTitle($title, $id){ if (is_feed()) $return $title; //do som...
150,287
<p><img src="https://i.stack.imgur.com/x2y9n.png" alt="enter image description here"></p> <p>I need to create a table like this image and I want a specific term in particular DIV but with my code appear all together.</p> <p><strong>Example</strong>: One div brown with the 5 products.</p> <p>The effect I want is like...
[ { "answer_id": 150289, "author": "jdm2112", "author_id": 45202, "author_profile": "https://wordpress.stackexchange.com/users/45202", "pm_score": 0, "selected": false, "text": "<p>It's possible (and fairly common) to run multiple loops in the same template, pulling different groups of con...
2014/06/20
[ "https://wordpress.stackexchange.com/questions/150287", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54528/" ]
![enter image description here](https://i.stack.imgur.com/x2y9n.png) I need to create a table like this image and I want a specific term in particular DIV but with my code appear all together. **Example**: One div brown with the 5 products. The effect I want is like an accordion "Hide and Show". So if I do not ha...
The easiest way is to just create [conditional statements](http://www.php.net//manual/en/control-structures.if.php) checking for the term and wrapping it in a div of your choice. After you loop starts you could do something like: ``` while ($list_query->have_posts()) : $list_query->the_post(); if( has_term( 'casegoo...
151,319
<p>I am new to PHP and am building a WordPress theme. I would like to add a variable in the functions.php and use it in single.php as an if statement. At present, my single.php has the following code - </p> <pre><code>&lt;?php $prevPost = get_previous_post(); $prevthumbnail = get_the_post_thumbnail($prevPost-&gt;...
[ { "answer_id": 151321, "author": "Vasu Chawla", "author_id": 40625, "author_profile": "https://wordpress.stackexchange.com/users/40625", "pm_score": 2, "selected": false, "text": "<p>either use global variable\nin functions.php:</p>\n\n<pre><code> global $prevPost;\n $prevPost = 10...
2014/06/21
[ "https://wordpress.stackexchange.com/questions/151319", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54543/" ]
I am new to PHP and am building a WordPress theme. I would like to add a variable in the functions.php and use it in single.php as an if statement. At present, my single.php has the following code - ``` <?php $prevPost = get_previous_post(); $prevthumbnail = get_the_post_thumbnail($prevPost->ID, 'keepreading-thu...
either use global variable in functions.php: ``` global $prevPost; $prevPost = 10; ``` in single.php : ``` global $prevPost; if($prevPost) .. . . . Your code continues. . ``` Second method: define a function in functions.php and call that in single.php in functions.php : ``` function fu...
151,323
<p>I wrote this shortcode to take a filename I specify and output it as an image with title and alt tags:</p> <pre><code>function cwc_pkmn($atts) { extract(shortcode_atts(array( "name" =&gt; 'http://', ), $atts)); return '&lt;img src="/path/to/file/'.$name.'.png" alt="'.$name.'" title="'.$name.'" /...
[ { "answer_id": 151321, "author": "Vasu Chawla", "author_id": 40625, "author_profile": "https://wordpress.stackexchange.com/users/40625", "pm_score": 2, "selected": false, "text": "<p>either use global variable\nin functions.php:</p>\n\n<pre><code> global $prevPost;\n $prevPost = 10...
2014/06/21
[ "https://wordpress.stackexchange.com/questions/151323", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34465/" ]
I wrote this shortcode to take a filename I specify and output it as an image with title and alt tags: ``` function cwc_pkmn($atts) { extract(shortcode_atts(array( "name" => 'http://', ), $atts)); return '<img src="/path/to/file/'.$name.'.png" alt="'.$name.'" title="'.$name.'" />'; } add_shortcode(...
either use global variable in functions.php: ``` global $prevPost; $prevPost = 10; ``` in single.php : ``` global $prevPost; if($prevPost) .. . . . Your code continues. . ``` Second method: define a function in functions.php and call that in single.php in functions.php : ``` function fu...
151,336
<p>Working on real estate project.Here i am facing a problem with new email registration when user register with site admin getting some fields blank.i am using Group but plugin and also in back end under Group Buying Plugin > Account tab getting warning to city ,state colum like:</p> <pre><code>Warning: Illegal strin...
[ { "answer_id": 151340, "author": "Mike_Piercy", "author_id": 54338, "author_profile": "https://wordpress.stackexchange.com/users/54338", "pm_score": 0, "selected": false, "text": "<p>Try creating a variable for the parameter</p>\n\n<pre><code>user-edit.php?user_id=\".$user\n</code></pre>...
2014/06/21
[ "https://wordpress.stackexchange.com/questions/151336", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/39122/" ]
Working on real estate project.Here i am facing a problem with new email registration when user register with site admin getting some fields blank.i am using Group but plugin and also in back end under Group Buying Plugin > Account tab getting warning to city ,state colum like: ``` Warning: Illegal string offset 'city...
I have updated wordpress 3.4.1 to wordpress 3.9.1 also i have updated all plugin version now code is working without any warning and error.