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
134,482
<p>I'm using a modified version of the code from a question (<a href="https://stackoverflow.com/questions/19050288/get-wordpress-posts-grouped-by-month">Get WordPress Posts Grouped by Month</a>) to group my posts by year.</p> <p>Everything is working fine, but I'm having trouble getting the post excerpt to display for...
[ { "answer_id": 134490, "author": "tfrommen", "author_id": 27722, "author_profile": "https://wordpress.stackexchange.com/users/27722", "pm_score": 0, "selected": false, "text": "<p>You really should use native WordPress functions (<code>WP_Query</code>, <code>have_posts</code>, <code>the_...
2014/02/13
[ "https://wordpress.stackexchange.com/questions/134482", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5935/" ]
I'm using a modified version of the code from a question ([Get WordPress Posts Grouped by Month](https://stackoverflow.com/questions/19050288/get-wordpress-posts-grouped-by-month)) to group my posts by year. Everything is working fine, but I'm having trouble getting the post excerpt to display for the posts. Here is m...
I guess your `post_excerpt` field is empty and you need to generate an excerpt from the `post_content`. I agree with @t f using the general `WP_Query(), have_post(), the_post(), the_excerpt()` method of looping. I just want to mention that WordPress comes with the handy [`wp_trim_words()`](http://codex.wordpress.org/...
134,504
<p>I've created a child theme of TwentyTwelve.</p> <p>On the front end, the <code>&lt;head&gt;</code> section contains the line:</p> <blockquote> <p><a href="http://example.com/wp-content/themes/childtheme/style.css" rel="nofollow">http://example.com/wp-content/themes/childtheme/style.css</a><strong>?ver=3.8.1</str...
[ { "answer_id": 134505, "author": "Jorge Y. C. Rodriguez", "author_id": 35073, "author_profile": "https://wordpress.stackexchange.com/users/35073", "pm_score": 2, "selected": true, "text": "<p>well that depends on what you want to do, but if it is easier for you to edit that template it w...
2014/02/13
[ "https://wordpress.stackexchange.com/questions/134504", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3206/" ]
I've created a child theme of TwentyTwelve. On the front end, the `<head>` section contains the line: > > <http://example.com/wp-content/themes/childtheme/style.css>**?ver=3.8.1** > > > Any changes I make to `childtheme/style.css` are not reflected in <http://example.com/wp-content/themes/childtheme/style.css?ve...
well that depends on what you want to do, but if it is easier for you to edit that template it will be better that you can control all the output of it.. fx like this ``` function add_require_scripts_files() { wp_enqueue_style('layout', get_template_directory_uri().'/style.css', array(), '1.0.0', "all"); } a...
134,511
<p>I have a plugin which adds the method to "the_content" filter.</p> <p><code>add_filter('the_content', 'myFilteringFunction', 10000);</code></p> <p>Within that function I want to add some links on the beginning and the end of the content. But I only need to do it for the "main" content of the displayed page so - no...
[ { "answer_id": 134513, "author": "iyrin", "author_id": 33393, "author_profile": "https://wordpress.stackexchange.com/users/33393", "pm_score": 3, "selected": true, "text": "<p>Try adding a condition to your filtering function that checks your post type against <a href=\"http://codex.word...
2014/02/13
[ "https://wordpress.stackexchange.com/questions/134511", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47562/" ]
I have a plugin which adds the method to "the\_content" filter. `add_filter('the_content', 'myFilteringFunction', 10000);` Within that function I want to add some links on the beginning and the end of the content. But I only need to do it for the "main" content of the displayed page so - not in the any of the widgets...
Try adding a condition to your filtering function that checks your post type against [get\_post\_type](http://codex.wordpress.org/Function_Reference/get_post_type). `if ( 'book' == get_post_type() )` If you wish to apply this filter to pages as well, try [is\_singular()](http://codex.wordpress.org/Function_Reference/...
134,537
<p>I've registered a custom post type called "node".</p> <p>When I create a basic WP_Query to get posts of that type, it works just fine. Example:</p> <pre><code>$args = array( 'post_status' =&gt; 'publish', 'post_type' =&gt; 'node'); $query = new WP_Query($args); </code></pre> <p>This will get all publish...
[ { "answer_id": 134920, "author": "Sebastian", "author_id": 47572, "author_profile": "https://wordpress.stackexchange.com/users/47572", "pm_score": 4, "selected": true, "text": "<p>You are right, I tried it in a clean Wordpress install and it works. </p>\n\n<p>Seems like one of the plugin...
2014/02/13
[ "https://wordpress.stackexchange.com/questions/134537", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47572/" ]
I've registered a custom post type called "node". When I create a basic WP\_Query to get posts of that type, it works just fine. Example: ``` $args = array( 'post_status' => 'publish', 'post_type' => 'node'); $query = new WP_Query($args); ``` This will get all published posts of type "node". However, as ...
You are right, I tried it in a clean Wordpress install and it works. Seems like one of the plugins I use in my environment is hooking itself in one of the pre-query events. Thanks!
134,541
<p>can we activate same comment widget on woo-commerce product page which WordPress gives on post or pages. actually i want other users should be able to comment on others comment which is not allowed in review.</p>
[ { "answer_id": 134553, "author": "tfrommen", "author_id": 27722, "author_profile": "https://wordpress.stackexchange.com/users/27722", "pm_score": 0, "selected": false, "text": "<p>WooCommerce already comes with Product Reviews, which basically <strong>are</strong> WordPress comments.</p>...
2014/02/13
[ "https://wordpress.stackexchange.com/questions/134541", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35187/" ]
can we activate same comment widget on woo-commerce product page which WordPress gives on post or pages. actually i want other users should be able to comment on others comment which is not allowed in review.
Replies aren't disabled for reviews in woocommerce, but there is no output of a reply button. If you add one to the [`review.php`](https://github.com/woothemes/woocommerce/blob/master/templates/single-product/review.php) template via [`comment_reply_link()`](http://codex.wordpress.org/Function_Reference/comment_reply_l...
134,542
<p>I have a custom post type called "cif-events" and I want to sort by the value in wpcf-start-time. I added the following to my functions.php:</p> <pre><code>add_filter('pre_get_posts', 'set_order_for_archives'); function set_order_for_archives($q) { if ($q-&gt;is_post_type_archive('cif-groups')) { $q-&gt;set(...
[ { "answer_id": 134544, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p>Have a look at the <a href=\"http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters\" re...
2014/02/13
[ "https://wordpress.stackexchange.com/questions/134542", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35692/" ]
I have a custom post type called "cif-events" and I want to sort by the value in wpcf-start-time. I added the following to my functions.php: ``` add_filter('pre_get_posts', 'set_order_for_archives'); function set_order_for_archives($q) { if ($q->is_post_type_archive('cif-groups')) { $q->set('orderby', 'title');...
Have a look at the [`orderby` parameters for `WP_Query`](http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters) to see all of the valid values that can be. If `wpcf-start-time` is a meta key, then `orderby` should be `meta_value`, which will also require you set a `meta_key` argument to tell...
134,547
<p>I know that <code>&lt;input name="name"&gt;</code> will cause wp to bork and throw a 404. It seems that 'year' is the same. Does there exist a list of input names that wp doesnt like?</p>
[ { "answer_id": 134549, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 3, "selected": true, "text": "<p>You should definitely avoid the <a href=\"http://codex.wordpress.org/WordPress_Query_Vars#Query_variables\" rel=\"n...
2014/02/13
[ "https://wordpress.stackexchange.com/questions/134547", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17881/" ]
I know that `<input name="name">` will cause wp to bork and throw a 404. It seems that 'year' is the same. Does there exist a list of input names that wp doesnt like?
You should definitely avoid the [public WordPress query vars](http://codex.wordpress.org/WordPress_Query_Vars#Query_variables): ``` attachment attachment_id author author_name cat category_name comments_popup day error feed hour hour m minute monthnum name p page_id paged pagename post_parent post_type preview second ...
134,594
<p>I am currently working on a small task that store a plugin information into database, but I have problem regarding to include the file that has the functions to run the query.</p> <p>Here is the line that includes the file:</p> <p><code>require_once(ABSPATH . 'wp-admin/includes/upgrade.php');</code></p> <p>but I got...
[ { "answer_id": 134597, "author": "LPH", "author_id": 47326, "author_profile": "https://wordpress.stackexchange.com/users/47326", "pm_score": 0, "selected": false, "text": "<p>You should not need the / but try a slash at the start of the /wp-admin</p>\n\n<pre><code>require_once( ABSPATH ....
2014/02/14
[ "https://wordpress.stackexchange.com/questions/134594", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47271/" ]
I am currently working on a small task that store a plugin information into database, but I have problem regarding to include the file that has the functions to run the query. Here is the line that includes the file: `require_once(ABSPATH . 'wp-admin/includes/upgrade.php');` but I got the following when I run the co...
> > `insert.php` file that I made myself, actually I am new to wordpress, > I want to that is there any mistake that i am making? Actually I want > to store a plugin form information in the database. > > > Your question is very light on detail but I suspect that the mistake you are making is loading a file in su...
134,637
<p>I want to assign a new CSS class to default widget <code>&lt;ul&gt;</code> in Page/Post creating page in WordPress. How can I do this?</p> <p>See the image below.</p> <p><img src="https://i.stack.imgur.com/J1XTy.png" alt="enter image description here"></p>
[ { "answer_id": 134643, "author": "Erdal Bakkal", "author_id": 47537, "author_profile": "https://wordpress.stackexchange.com/users/47537", "pm_score": 2, "selected": false, "text": "<p>Go to your <code>function.php</code> and find your widget code</p>\n\n<p>You must add or edit that <code...
2014/02/14
[ "https://wordpress.stackexchange.com/questions/134637", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42983/" ]
I want to assign a new CSS class to default widget `<ul>` in Page/Post creating page in WordPress. How can I do this? See the image below. ![enter image description here](https://i.stack.imgur.com/J1XTy.png)
Don't edit your parent theme's `functions.php` file. ``` register_sidebar( array( 'name' => __( 'Sidebar name', 'theme_text_domain' ), 'id' => 'unique-sidebar-id', 'description' => '', 'class' => 'add class here', 'before_widget' => '<li id="%1$s" class="widget %2$s">...
134,641
<p>Is it possible to add tags to a post, prior to its creation?</p> <p>Say if I have a link "/wp-admin/new-post.php?tags=a,b,c,d" and by clicking it, I want to enter the new-post page with the tags already associated with it.</p>
[ { "answer_id": 134643, "author": "Erdal Bakkal", "author_id": 47537, "author_profile": "https://wordpress.stackexchange.com/users/47537", "pm_score": 2, "selected": false, "text": "<p>Go to your <code>function.php</code> and find your widget code</p>\n\n<p>You must add or edit that <code...
2014/02/14
[ "https://wordpress.stackexchange.com/questions/134641", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47528/" ]
Is it possible to add tags to a post, prior to its creation? Say if I have a link "/wp-admin/new-post.php?tags=a,b,c,d" and by clicking it, I want to enter the new-post page with the tags already associated with it.
Don't edit your parent theme's `functions.php` file. ``` register_sidebar( array( 'name' => __( 'Sidebar name', 'theme_text_domain' ), 'id' => 'unique-sidebar-id', 'description' => '', 'class' => 'add class here', 'before_widget' => '<li id="%1$s" class="widget %2$s">...
134,664
<p>i try to hook when post is updated but all hook i try never executed except <code>updated_post_meta</code></p> <pre><code>add_action('updated_post_meta', 'my_function'); function my_function($post_id) { echo 'This is my post ID : '.$post_id; } </code></pre> <p>I've tried this <code>add_action('save_post',...
[ { "answer_id": 134665, "author": "Jacob Rambo", "author_id": 20227, "author_profile": "https://wordpress.stackexchange.com/users/20227", "pm_score": 2, "selected": false, "text": "<p>Why not hook in <code>post_updated_messages</code>. That way you can show this message just like the defa...
2014/02/14
[ "https://wordpress.stackexchange.com/questions/134664", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47621/" ]
i try to hook when post is updated but all hook i try never executed except `updated_post_meta` ``` add_action('updated_post_meta', 'my_function'); function my_function($post_id) { echo 'This is my post ID : '.$post_id; } ``` I've tried this `add_action('save_post', 'my_function');` but no id was echo out, ...
When a post is updated there are some hooks that are fired: * **`'pre_post_update'`** is an action fired just **before** the post is updated, the argument passed are 2: `$post_ID` and `$data` that is an array of **all** the other database colums of the post table * **`'transition_post_status'`** is an hook fired on up...
134,666
<p>I was trying to make a navigation menu of all the anchor links on a page (similar to wikipedia) but couldn't find out how. I tried to find a plugin that could do it, but they only listed the anchors of a single post.</p> <p>I made a custom page with the following code:</p> <pre><code>get_header(); ?&gt; &lt;main ...
[ { "answer_id": 134691, "author": "Seamus Leahy", "author_id": 33106, "author_profile": "https://wordpress.stackexchange.com/users/33106", "pm_score": 2, "selected": true, "text": "<p>In short, you'll run the loop twice. The first time creating the links. The second time creating the post...
2014/02/14
[ "https://wordpress.stackexchange.com/questions/134666", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47627/" ]
I was trying to make a navigation menu of all the anchor links on a page (similar to wikipedia) but couldn't find out how. I tried to find a plugin that could do it, but they only listed the anchors of a single post. I made a custom page with the following code: ``` get_header(); ?> <main id="content" class="site-co...
In short, you'll run the loop twice. The first time creating the links. The second time creating the posts. The trick is to figure out what the ID will be for the post. It needs to be something unique: We could use the slug or the post ID. ``` <?php // I'm going to get the posts only once, but then loop throug...
134,678
<p>I have a bilingual site working no problem that tests for cookies before setting WPLANG in wp-config.php, with all the text internationalised etc.</p> <p>My one problem is that notification emails are being sent in the language of the current user, not the language of the recipient. So if user1 comments in English,...
[ { "answer_id": 135006, "author": "oferwald", "author_id": 2599, "author_profile": "https://wordpress.stackexchange.com/users/2599", "pm_score": 1, "selected": false, "text": "<p>Add a locale filter</p>\n\n<pre><code>add_filter('locale', 'locale_filter');\n</code></pre>\n\n<p>and in the f...
2014/02/14
[ "https://wordpress.stackexchange.com/questions/134678", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35739/" ]
I have a bilingual site working no problem that tests for cookies before setting WPLANG in wp-config.php, with all the text internationalised etc. My one problem is that notification emails are being sent in the language of the current user, not the language of the recipient. So if user1 comments in English, and user2...
Add a locale filter ``` add_filter('locale', 'locale_filter'); ``` and in the filter return the locale of your choice, ``` function locale_filter($locale) { return "whatever"; } ``` however, this needs to be done in context, your mail sending trigger will need to know the target user and get the locale from t...
134,695
<p>For the twentythirteen, twentyfourteen or any theme made by Wordpress, editing <code>ie.css</code> which is in <code>themefolder\css\ie.css</code> doesn't result in any changes in Internet Explorer. I'm actually using IE11, but whatever I change the document mode or the user agent to, it's still not resulting to any...
[ { "answer_id": 134698, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 2, "selected": false, "text": "<p>The conditional stylesheet for IE is only loaded for IE6, 7 and 8 in the wordpress default themes. For ...
2014/02/14
[ "https://wordpress.stackexchange.com/questions/134695", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37529/" ]
For the twentythirteen, twentyfourteen or any theme made by Wordpress, editing `ie.css` which is in `themefolder\css\ie.css` doesn't result in any changes in Internet Explorer. I'm actually using IE11, but whatever I change the document mode or the user agent to, it's still not resulting to any changes. I also noticed...
Looks like TwentyFourteen includes the ie.css stylesheet within a '**less than IE 9**' conditional tag, which would explain why it's not working for IE11. ``` <!--[if lt IE 9]> <link rel='stylesheet' id='twentyfourteen-ie-css' href='http://localhost/wordpress_answers/wp-content/themes/twentyfourteen/css/ie.css' ty...
134,718
<p>I have read on <a href="http://codex.wordpress.org/Child_Themes" rel="nofollow">codewordpress</a> about this issue. In the article "A WordPress child theme is a theme that inherits the functionality of another theme". And then on stylesheet use import style from parent style <code>@import url("../twentythirteen/styl...
[ { "answer_id": 134698, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 2, "selected": false, "text": "<p>The conditional stylesheet for IE is only loaded for IE6, 7 and 8 in the wordpress default themes. For ...
2014/02/15
[ "https://wordpress.stackexchange.com/questions/134718", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27234/" ]
I have read on [codewordpress](http://codex.wordpress.org/Child_Themes) about this issue. In the article "A WordPress child theme is a theme that inherits the functionality of another theme". And then on stylesheet use import style from parent style `@import url("../twentythirteen/style.css");` Lets take example with t...
Looks like TwentyFourteen includes the ie.css stylesheet within a '**less than IE 9**' conditional tag, which would explain why it's not working for IE11. ``` <!--[if lt IE 9]> <link rel='stylesheet' id='twentyfourteen-ie-css' href='http://localhost/wordpress_answers/wp-content/themes/twentyfourteen/css/ie.css' ty...
134,740
<p>i want to add small effect (UI-jquery-draggable) to the navigation buttons in one of the WP slider plugins.</p> <p>what i did:</p> <p>1 I have installed the slider plugin</p> <p>2 know that UI is allredy registerd in wordpress but i have to call it (am i right?) so in my child theme functions.php,i added this:</p...
[ { "answer_id": 134755, "author": "offroff", "author_id": 13073, "author_profile": "https://wordpress.stackexchange.com/users/13073", "pm_score": 0, "selected": false, "text": "<p>When you use <a href=\"http://codex.wordpress.org/Function_Reference/wp_enqueue_script\" rel=\"nofollow\">wp_...
2014/02/15
[ "https://wordpress.stackexchange.com/questions/134740", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44632/" ]
i want to add small effect (UI-jquery-draggable) to the navigation buttons in one of the WP slider plugins. what i did: 1 I have installed the slider plugin 2 know that UI is allredy registerd in wordpress but i have to call it (am i right?) so in my child theme functions.php,i added this: ``` function my_enqueu...
Enqueue your script instead of putting it in your template, you can enqueue your code as is, or put your code in an actual file. The benefit of doing this is you gain control over output, as you can see there is a `$priority` parameter for `add_action`. ``` add_action( $hook, $function_to_add, $priority, $accepted_ar...
134,748
<p>For whatever reason <code>wp_insert_post</code> doesn't work for a custom post type.</p> <p>Here's the code snippet I'm using.</p> <pre><code>$new_post = array( 'post_type' =&gt; 'rsp_synonym', 'post_title' =&gt; wp_strip_all_tags( $row['word'] ), 'post_date' =&gt; date('Y-m-d H:i:s'), 'post_author...
[ { "answer_id": 134750, "author": "1fixdotio", "author_id": 45728, "author_profile": "https://wordpress.stackexchange.com/users/45728", "pm_score": 2, "selected": true, "text": "<p>Try add the second parameter like:</p>\n\n<pre><code>$post_id = wp_insert_post( $new_post, true );\n</code><...
2014/02/15
[ "https://wordpress.stackexchange.com/questions/134748", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24719/" ]
For whatever reason `wp_insert_post` doesn't work for a custom post type. Here's the code snippet I'm using. ``` $new_post = array( 'post_type' => 'rsp_synonym', 'post_title' => wp_strip_all_tags( $row['word'] ), 'post_date' => date('Y-m-d H:i:s'), 'post_author' => 2, 'post_content' => '', 'po...
Try add the second parameter like: ``` $post_id = wp_insert_post( $new_post, true ); ``` If it still won't work, please var\_dump the $post\_id and paste here.
134,765
<p>I am running into one issue with <strong>pre_get_post</strong> filter.</p> <p>Actually I have 4 post types. Post, Pages, Events, and Venue. I created one custom field called city for event and venue post type. </p> <p>When creating custom field I have one option to select post type on which I want to display that ...
[ { "answer_id": 134767, "author": "offroff", "author_id": 13073, "author_profile": "https://wordpress.stackexchange.com/users/13073", "pm_score": 2, "selected": false, "text": "<p>Wordpress has a great page about <a href=\"http://codex.wordpress.org/Conditional_Tags\" rel=\"nofollow\">con...
2014/02/15
[ "https://wordpress.stackexchange.com/questions/134765", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33338/" ]
I am running into one issue with **pre\_get\_post** filter. Actually I have 4 post types. Post, Pages, Events, and Venue. I created one custom field called city for event and venue post type. When creating custom field I have one option to select post type on which I want to display that custom field. Now, on the f...
Improve your conditional to include a check for post type being queried. It can be done via [`WP_Query::get`](http://codex.wordpress.org/Class_Reference/WP_Query#Methods) method So, where you have ``` if ( !is_admin() ){ $query->set( 'meta_key', '_ct_selectbox_52f65ae267764' ); $query->set( 'meta_value', $cit...
134,784
<p>I would like <code>css_head_scripts</code> and <code>js_head_scripts</code> to be appended to <code>wp-head</code> <br/>but Wordpress completely ignores it? Am I missing something?</p> <pre><code> function css_head_scripts() { wp_enqueue_style( 'Master Stylesheet', get_template_directory_uri()."style.css...
[ { "answer_id": 134788, "author": "Céline Garel", "author_id": 17456, "author_profile": "https://wordpress.stackexchange.com/users/17456", "pm_score": 0, "selected": false, "text": "<p>Try <code>wp_enqueue_scripts</code> hook instead <code>wp_head</code> to enqueue scripts and styles.</p>...
2014/02/15
[ "https://wordpress.stackexchange.com/questions/134784", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45682/" ]
I would like `css_head_scripts` and `js_head_scripts` to be appended to `wp-head` but Wordpress completely ignores it? Am I missing something? ``` function css_head_scripts() { wp_enqueue_style( 'Master Stylesheet', get_template_directory_uri()."style.css" ); } function js_head_scripts() { ...
You problem lies with how you are using [`wp_enqueue_script()`](http://codex.wordpress.org/Function_Reference/wp_enqueue_script). It does not print out the `<script src=""></script>`, instead it adds it to a list of Javascript files to printed out at the appropriate time. There is a different hook that is called for w...
134,804
<p>I am trying to move the wp-content directory outside of the wordpress directory and hitting all kinds of weird problems. Even though <a href="http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder" rel="noreferrer">http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder</a> says ...
[ { "answer_id": 134807, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": true, "text": "<p>You have to define <code>WP_CONTENT_DIR</code> and <code>WP_CONTENT_URL</code>:</p>\n\n<pre><code>const WP_CONTENT_DIR...
2014/02/16
[ "https://wordpress.stackexchange.com/questions/134804", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1498/" ]
I am trying to move the wp-content directory outside of the wordpress directory and hitting all kinds of weird problems. Even though <http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder> says you can do this, it seems that the directory structure is deeply wired into the WP code. For example, I ge...
You have to define `WP_CONTENT_DIR` and `WP_CONTENT_URL`: ``` const WP_CONTENT_DIR = '/path/to/new/directory'; const WP_CONTENT_URL = 'http://content.wp'; ``` The new path must be accessible for read and write operation from the WordPress core directory. You might need a helper function to add the new directory path...
134,825
<p>I'm working on a client's site and I noticed that posts have a hidden <code>&lt;div&gt;</code> filled to SPAM links to dick pills, etc. Hoping to get lucky, I searched for some of the keywords in the database tables, but found no matches. I also searched the code in all the files, and also found no matches.</p> <p>...
[ { "answer_id": 135962, "author": "Squish", "author_id": 28821, "author_profile": "https://wordpress.stackexchange.com/users/28821", "pm_score": 2, "selected": false, "text": "<p><strong>In general, the best place to look is in your theme folders, specifically the main theme and in the in...
2014/02/16
[ "https://wordpress.stackexchange.com/questions/134825", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11363/" ]
I'm working on a client's site and I noticed that posts have a hidden `<div>` filled to SPAM links to dick pills, etc. Hoping to get lucky, I searched for some of the keywords in the database tables, but found no matches. I also searched the code in all the files, and also found no matches. I know that Wordpress hacks...
I won't repeat any of the good advice in Squish's answer. You should also read [this article on Wordpress security](http://codex.wordpress.org/Hardening_WordPress). I'm just going to cover the specifics of what I learned from my episode. My attack is a kind of black hat SEO known as "hideMeYa": <http://siteolytics.com...
134,826
<p>I am trying to get the current logged-in user data and use this in the parent class(I need it in several functions).</p> <p>In the example below I can get the userID in the first function but it will give no output inside the next function.</p> <p>This is my first wordpress plugin and the first time that I work wi...
[ { "answer_id": 134829, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 0, "selected": false, "text": "<p>You are firing both <code>$this-&gt;getId();</code> and <code>$this-&gt;showId();</code> in the constructor....
2014/02/16
[ "https://wordpress.stackexchange.com/questions/134826", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47687/" ]
I am trying to get the current logged-in user data and use this in the parent class(I need it in several functions). In the example below I can get the userID in the first function but it will give no output inside the next function. This is my first wordpress plugin and the first time that I work with OOP, so who ca...
Once you said is you first time using OOP, I want to say: stop using `&` before `$this`: PHP4 died long time ago. Second tip, don't use global variables, if you can. I know that function like `wp_get_current_user` use global variable internally, but I hope that in future it will not be so anymore, however not seeing t...
134,839
<p>I have a website that is powered by WordPress, e.g. <code>example.com</code>. I would like to install a separate WordPress installation with a separate database, themes, etc in a subdirectory on my website though, for example on <code>example.com/blog</code>. </p> <p>Will this cause problems with displaying both in...
[ { "answer_id": 134843, "author": "user42826", "author_id": 42826, "author_profile": "https://wordpress.stackexchange.com/users/42826", "pm_score": 1, "selected": false, "text": "<p>Yes it is possible to have a WordPress installation within another WordPress installation. I had a working...
2014/02/16
[ "https://wordpress.stackexchange.com/questions/134839", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/46097/" ]
I have a website that is powered by WordPress, e.g. `example.com`. I would like to install a separate WordPress installation with a separate database, themes, etc in a subdirectory on my website though, for example on `example.com/blog`. Will this cause problems with displaying both installations properly? For exampl...
Yes, you can do this. There won't be a 404 error because of the default rewrite rules that WordPress has (if you use 'nice URLs', if don't, there is no default .htaccess at all). Because of the exceptions (see below) if there is a 'real' directory or file in the directory of your WordPress installation, WP won't trea...
134,855
<p>I can't get the order of my posts (organized by custom tax terms) to come out right in my loop. </p> <p>I made a custom post type of 'staff', in staff there is a custom taxonomy of 'staff-title'. </p> <p>I added terms (similar to categories to keep the UI clean for the client) such as 'editor-in-chief', 'managing-...
[ { "answer_id": 134856, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>You can't oder by taxonomy term with <code>WP_Query</code>. You could do it with some <a href=\"http://scribu.net/...
2014/02/17
[ "https://wordpress.stackexchange.com/questions/134855", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47713/" ]
I can't get the order of my posts (organized by custom tax terms) to come out right in my loop. I made a custom post type of 'staff', in staff there is a custom taxonomy of 'staff-title'. I added terms (similar to categories to keep the UI clean for the client) such as 'editor-in-chief', 'managing-editor', 'poetry-...
It's already a `hierarchical` post type - no need for some extra meta value just for the order. You can simply add [post type support](http://codex.wordpress.org/Function_Reference/post_type_supports) for `page-attributes` when registering the post type. This will give you the "menu order" meta box that pages have per ...
134,857
<p>I have a custom post type menu called "Notes". It has two basic sub menus: add new and show all.</p> <p>But I want to add more items under these post type but the default array just gave me these. How can I add unlimited items?</p> <p>I'm tired searching, but no result...</p>
[ { "answer_id": 134864, "author": "Abhik", "author_id": 26991, "author_profile": "https://wordpress.stackexchange.com/users/26991", "pm_score": 0, "selected": false, "text": "<p>Try this.. </p>\n\n<pre><code>function my_cpt_extra_menus() {\n //Add Submenu Page\n add_submenu_page( '...
2014/02/17
[ "https://wordpress.stackexchange.com/questions/134857", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47716/" ]
I have a custom post type menu called "Notes". It has two basic sub menus: add new and show all. But I want to add more items under these post type but the default array just gave me these. How can I add unlimited items? I'm tired searching, but no result...
First of all, searching with wrong keyword won't give you any right solution. It's a hint that, you are dealing with Admin menu, and anything under a menu drop down is called a sub menu - so you should search with something like: *How to add submenu to any admin menu item + WordPress?*. :) Anyways, you have a wrong co...
134,894
<p>I am having an overview of custom post types. These have custom tax and also an attachment.</p> <p>In my overview I need to provide links to delete the entries. With that I also need to delete the attachment and the meta data.</p> <p>I was using this:</p> <pre><code> if ( !current_user_can( 'delete_bkroadkill'...
[ { "answer_id": 134916, "author": "David Gard", "author_id": 10097, "author_profile": "https://wordpress.stackexchange.com/users/10097", "pm_score": 4, "selected": true, "text": "<p>@s_ha_dum suggests that Post meta will be deleted automatically. Therefore because his reputation suggests ...
2014/02/17
[ "https://wordpress.stackexchange.com/questions/134894", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45158/" ]
I am having an overview of custom post types. These have custom tax and also an attachment. In my overview I need to provide links to delete the entries. With that I also need to delete the attachment and the meta data. I was using this: ``` if ( !current_user_can( 'delete_bkroadkill', $post->ID ) ) retu...
@s\_ha\_dum suggests that Post meta will be deleted automatically. Therefore because his reputation suggests he knows what he is talking about, this solution only handles Post attachments. I'd suggest checking out the docs for the [before\_delete\_post()](https://codex.wordpress.org/Plugin_API/Action_Reference/before_...
134,913
<p>Presently running Wordpress 3.8.1 French but Wordpress is asking me to update to a new version.</p> <p>When doing the update, I get the following error:</p> <pre><code> Warning: copy(/home/XXXXXX/domains/XXXXXX.com/public_html/wp-admin/includes/update-core.php) [function.copy]: failed to open stream: Permission ...
[ { "answer_id": 134914, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 0, "selected": false, "text": "<p>You need to be sure that PHP and therefore WordPress is able to edit your files. Have a look at <a href=\"ht...
2014/02/17
[ "https://wordpress.stackexchange.com/questions/134913", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47740/" ]
Presently running Wordpress 3.8.1 French but Wordpress is asking me to update to a new version. When doing the update, I get the following error: ``` Warning: copy(/home/XXXXXX/domains/XXXXXX.com/public_html/wp-admin/includes/update-core.php) [function.copy]: failed to open stream: Permission denied in /home/XXXX...
The user your server is running as needs to be able to write and modify the files in WordPress core. Namely that the updater was told: `Permission denied` when it tried to change `wp-admin/includes/update-core.php`. What the permissions will need to be for this to work are different from server to server. [This articl...
134,935
<p>I've been banging my head against this for a while. I have this very straight-forward code in my plugin:</p> <pre><code>add_action('init', 'register_shortcodes'); $shortcodeRegistrationRan = False; function register_shortcodes() { global $shortcodeRegistrationRan; $shortcodeRegistrationRan = True; ech...
[ { "answer_id": 134941, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>I am going to suggest that what you are doing is overly complex, at least insofar as I understand you. </p>\...
2014/02/17
[ "https://wordpress.stackexchange.com/questions/134935", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43552/" ]
I've been banging my head against this for a while. I have this very straight-forward code in my plugin: ``` add_action('init', 'register_shortcodes'); $shortcodeRegistrationRan = False; function register_shortcodes() { global $shortcodeRegistrationRan; $shortcodeRegistrationRan = True; echo "Ran = True"...
I feel very un-smart. My problem was two-fold: 1. First, my plugin had somehow become deactivated. 2. Second, it turned out that I needed to give the `add_shortcode` function the name of the class rather than an instance of that class. It'd be great if someone could explain why this is. [This page](http://wordpress.or...
134,944
<p>I used a custom post type in my website: I added <code>archive-{mytaxonomy}.php</code> and also <code>single-{mytaxonomy}.php</code>.</p> <p>I also created a separate sidebar for my taxonomy and everything looks fine until I click on one of my categories. Then it loads <code>archive.php</code>.</p> <p>Should I add...
[ { "answer_id": 134977, "author": "Brad Dalton", "author_id": 9884, "author_profile": "https://wordpress.stackexchange.com/users/9884", "pm_score": 2, "selected": false, "text": "<p>Categories and Taxonomies are not exactly the same.</p>\n\n<p>A category is a <a href=\"http://codex.wordpr...
2014/02/17
[ "https://wordpress.stackexchange.com/questions/134944", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47484/" ]
I used a custom post type in my website: I added `archive-{mytaxonomy}.php` and also `single-{mytaxonomy}.php`. I also created a separate sidebar for my taxonomy and everything looks fine until I click on one of my categories. Then it loads `archive.php`. Should I add any other code to my files?
Categories and Taxonomies are not exactly the same. A category is a [default taxonomy](http://codex.wordpress.org/Taxonomies) You can use categories with custom post types however its better to use custom taxonomies because the truth is, they are an extremely powerful way to group various items in all sorts of ways. ...
134,952
<p>I'd like to randomize a set of posts (custom post type), but ignore the first post all together.</p> <p>Here's the code I thought would work:</p> <pre><code>$featured_content_query = new WP_Query( array( 'post_type' =&gt; 'feature', 'offset' =&gt; 1, 'posts_per_page' =&gt; 10, 'order' ...
[ { "answer_id": 135013, "author": "sri", "author_id": 34200, "author_profile": "https://wordpress.stackexchange.com/users/34200", "pm_score": 1, "selected": false, "text": "<p>I believe there are different ways of achieving this. Simplest way I could imagine is as below:</p>\n\n<pre><code...
2014/02/17
[ "https://wordpress.stackexchange.com/questions/134952", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20694/" ]
I'd like to randomize a set of posts (custom post type), but ignore the first post all together. Here's the code I thought would work: ``` $featured_content_query = new WP_Query( array( 'post_type' => 'feature', 'offset' => 1, 'posts_per_page' => 10, 'order' => 'ASC', 'orderby' ...
I believe there are different ways of achieving this. Simplest way I could imagine is as below: ``` $featured_content_query = new WP_Query( array( 'post_type' => 'feature', 'offset' => 1, 'posts_per_page' => 10, 'order' => 'ASC' ) ); shuffle( $featured_content_query ); //PHP func...
134,964
<h2>Problem</h2> <p>I'm working on a website where we need to be able to put a username in the custom field of a custom post type, and allow the user specified to make changes to that post and only that post. I thought <code>user_has_cap</code> would be the filter hook to use but weirdly it doesn't seem to be allowing...
[ { "answer_id": 166495, "author": "Nancy", "author_id": 62600, "author_profile": "https://wordpress.stackexchange.com/users/62600", "pm_score": 2, "selected": false, "text": "<p>I've been struggling with the same problem...when args[0] is publish, args[2] is not populated. You have to ge...
2014/02/17
[ "https://wordpress.stackexchange.com/questions/134964", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47581/" ]
Problem ------- I'm working on a website where we need to be able to put a username in the custom field of a custom post type, and allow the user specified to make changes to that post and only that post. I thought `user_has_cap` would be the filter hook to use but weirdly it doesn't seem to be allowing a user to upda...
I've been struggling with the same problem...when args[0] is publish, args[2] is not populated. You have to get it from the url. ``` if(substr($args[0],0,7)=="publish"){ $postid=$_GET["post"]; if(!isset($postid))return $allcaps; } else $postid=$args[2]; ```
134,991
<p>I'm using wp-editor in a simple plugin, but I'm having an issue where the first time I hit the submit button the content from it is blank in the database.</p> <pre><code>&lt;?php $editor_id = 'mycontent'; wp_editor($content, $editor_id ); ?&gt; </code></pre> <p>So I tried alerting the conten...
[ { "answer_id": 135217, "author": "David", "author_id": 43522, "author_profile": "https://wordpress.stackexchange.com/users/43522", "pm_score": 0, "selected": false, "text": "<p>Ok I figured it out.\nFrom what I've found, I can't simply pull the data out with javascript, I need to submit ...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/134991", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43522/" ]
I'm using wp-editor in a simple plugin, but I'm having an issue where the first time I hit the submit button the content from it is blank in the database. ``` <?php $editor_id = 'mycontent'; wp_editor($content, $editor_id ); ?> ``` So I tried alerting the content using this: ``` if (j(".wp-co...
I just had the same problem. the submit of content of the wp\_editor works not at first-submit, but perfect on second submit. Another way: Click on the html-button, and then click on the "Vusual"-Button. I do it with this jquery-statements in my jquery-code to submit the form: ``` $("#post_content-tmce").click(); $("#...
134,993
<p>I am trying to make my loop go through the posts that are associated with these terms. Currently nothing is being output.</p> <pre><code>&lt;?php $args = array( 'post_type' =&gt; 'staff', 'posts_per_page' =&gt; '-1', 'tax_query' =&gt; array( array( 't...
[ { "answer_id": 135217, "author": "David", "author_id": 43522, "author_profile": "https://wordpress.stackexchange.com/users/43522", "pm_score": 0, "selected": false, "text": "<p>Ok I figured it out.\nFrom what I've found, I can't simply pull the data out with javascript, I need to submit ...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/134993", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47713/" ]
I am trying to make my loop go through the posts that are associated with these terms. Currently nothing is being output. ``` <?php $args = array( 'post_type' => 'staff', 'posts_per_page' => '-1', 'tax_query' => array( array( 'taxonomy' => 'staff', ...
I just had the same problem. the submit of content of the wp\_editor works not at first-submit, but perfect on second submit. Another way: Click on the html-button, and then click on the "Vusual"-Button. I do it with this jquery-statements in my jquery-code to submit the form: ``` $("#post_content-tmce").click(); $("#...
135,004
<p>I have created one post and post ID is 34 and added some Tags and Now I want to retrieve all tags with post ID.</p> <p><img src="https://i.stack.imgur.com/lLG9B.png" alt="enter image description here"></p> <p>Any Idea?</p>
[ { "answer_id": 135005, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 2, "selected": false, "text": "<p>Put this inside your loop:</p>\n\n<pre><code>//Returns All Term Items for \"my_term\"\n$term_list = wp_get_p...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/135004", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44300/" ]
I have created one post and post ID is 34 and added some Tags and Now I want to retrieve all tags with post ID. ![enter image description here](https://i.stack.imgur.com/lLG9B.png) Any Idea?
Put this inside your loop: ``` //Returns All Term Items for "my_term" $term_list = wp_get_post_terms($post->ID, 'post_tag', array("fields" => "all")); print_r($term_list); ``` Slightly adapted from [`wp_get_post_terms`](http://codex.wordpress.org/Function_Reference/wp_get_post_terms#Examples)
135,021
<p>I want to install something different than wordpress under 'mydomain.com/login', but WordPress automatically redirecting this link '/login' to '/wp-login.php'.</p> <p>Where can I turn off this redirection?</p>
[ { "answer_id": 135027, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 1, "selected": false, "text": "<p>This answer is based on the findings of <a href=\"https://stackoverflow.com/questions/18241408/login-in-perm...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/135021", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47781/" ]
I want to install something different than wordpress under 'mydomain.com/login', but WordPress automatically redirecting this link '/login' to '/wp-login.php'. Where can I turn off this redirection?
If you look at [`canonical.php`](https://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/canonical.php) you will notice that the `wp_redirect_admin_locations` function is hooked very late-- [at priority 1000](https://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/canonical.php#L536). This means that just...
135,051
<p>What I want is to display the value of the custom field called 'page_template'. I use the code below but it displays nothing under Page Template column although I have already defined a value for the page_template custom field of the page</p> <pre><code>add_filter('manage_pages_columns', 'column_page'); function co...
[ { "answer_id": 135054, "author": "sri", "author_id": 34200, "author_profile": "https://wordpress.stackexchange.com/users/34200", "pm_score": 0, "selected": false, "text": "<p>I think your function declaration should have an argument:</p>\n\n<pre><code>function page_template_field($post_I...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/135051", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44422/" ]
What I want is to display the value of the custom field called 'page\_template'. I use the code below but it displays nothing under Page Template column although I have already defined a value for the page\_template custom field of the page ``` add_filter('manage_pages_columns', 'column_page'); function column_page($d...
The main errors where the missing of the `$post_ID` parameter in `page_template_field` and using `$custom_field_id` instead of `$post_ID`. Anyway, this works and is simpler: ``` add_filter('manage_pages_columns', 'column_page'); function column_page($defaults) { $defaults['column_template'] = 'Page Template'; ...
135,088
<p><strong>Symptoms</strong></p> <p>Visiting /blog/ loads the first 10 posts, as expected.</p> <p>Visiting /blog/page/2/ (and onward) loads the new URL but with the same 10 posts. Nothing changes but the URL.</p> <p><strong>Setup Details</strong></p> <p>Custom Permalink Structure: <code>/blog/%year%/%monthnum%/%day...
[ { "answer_id": 160253, "author": "aifrim", "author_id": 58040, "author_profile": "https://wordpress.stackexchange.com/users/58040", "pm_score": -1, "selected": false, "text": "<p>Why don't you force the pagination by adding the following code like so:</p>\n\n\n\n<pre><code>&lt;div id=\"m...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/135088", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1766/" ]
**Symptoms** Visiting /blog/ loads the first 10 posts, as expected. Visiting /blog/page/2/ (and onward) loads the new URL but with the same 10 posts. Nothing changes but the URL. **Setup Details** Custom Permalink Structure: `/blog/%year%/%monthnum%/%day%/%postname%/` Static Posts Page: "Blog" (slug of 'blog') I'...
``` $my_query = new WP_Query( array( 'posts_per_page' => 3, 'paged' => get_query_var('paged') ) ); while ( $my_query->have_posts() ) : $my_query->the_post(); the_title(); // more stuff here endwhile; wp_pagenavi( array( 'query' => $my_query ) ); wp_reset_postdata(); ``` try this code and also increase the ...
135,089
<p>I have this excerpt function</p> <pre><code> &lt;?php function pietergoosen_get_the_content_limit_custom_allowedtags() { // Add custom tags to this string return '&lt;head&gt;,&lt;title&gt;,&lt;base&gt;,&lt;link&gt;,&lt;meta&gt;,&lt;style&gt;,&lt;script&gt;,&lt;noscript&gt;,&lt;body&gt;,&lt;secti...
[ { "answer_id": 135110, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>The only thing that makes sense to me is that <code>$text</code> immediately after this line:</p>\n\n<pre><c...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/135089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31545/" ]
I have this excerpt function ``` <?php function pietergoosen_get_the_content_limit_custom_allowedtags() { // Add custom tags to this string return '<head>,<title>,<base>,<link>,<meta>,<style>,<script>,<noscript>,<body>,<section>,<nav>, <article>,<aside>,<h1>,<h2>,<h3>,<h4>,<h5>,<h6>,<header...
Thanks for your answer @s\_ha\_dum. I eventually got it working. I changed `$text = $text . $excerpt_end;` to ``` $pos = strrpos($text, '</'); // Add 'Read more' text inside last HTML tag $text = substr_replace($text, $excerpt_end, $pos, 0); ```
135,095
<p>I am trying to add my custom page template to wordpress. I have created a page-portfolio.php to the folder</p> <blockquote> <p>\wp-content\themes\yoo_master2_wp\layouts</p> </blockquote> <p>My php file has following content:</p> <pre><code>&lt;?php /* Template Name: My Portfolio */ // get warp $warp = Warp:...
[ { "answer_id": 135110, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>The only thing that makes sense to me is that <code>$text</code> immediately after this line:</p>\n\n<pre><c...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/135095", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47810/" ]
I am trying to add my custom page template to wordpress. I have created a page-portfolio.php to the folder > > \wp-content\themes\yoo\_master2\_wp\layouts > > > My php file has following content: ``` <?php /* Template Name: My Portfolio */ // get warp $warp = Warp::getInstance(); // load main template f...
Thanks for your answer @s\_ha\_dum. I eventually got it working. I changed `$text = $text . $excerpt_end;` to ``` $pos = strrpos($text, '</'); // Add 'Read more' text inside last HTML tag $text = substr_replace($text, $excerpt_end, $pos, 0); ```
135,116
<p>I have been reading about <a href="https://codex.wordpress.org/Database_Description">the Database Description</a> of Wordpress. I haven't understood the meaning to the use of the table <code>wp_commentmeta</code>.</p> <p>The documentation says:</p> <blockquote> <p>Each comment features information called the met...
[ { "answer_id": 135110, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>The only thing that makes sense to me is that <code>$text</code> immediately after this line:</p>\n\n<pre><c...
2014/02/18
[ "https://wordpress.stackexchange.com/questions/135116", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14854/" ]
I have been reading about [the Database Description](https://codex.wordpress.org/Database_Description) of Wordpress. I haven't understood the meaning to the use of the table `wp_commentmeta`. The documentation says: > > Each comment features information called the meta data and it is stored in the wp\_commentmeta. >...
Thanks for your answer @s\_ha\_dum. I eventually got it working. I changed `$text = $text . $excerpt_end;` to ``` $pos = strrpos($text, '</'); // Add 'Read more' text inside last HTML tag $text = substr_replace($text, $excerpt_end, $pos, 0); ```
135,146
<p>I have a custom post type called "visningshus", and also a Page with that slug. This is as it should (must) be. </p> <p>Currently, "<a href="http://my-site.com/visningshus" rel="noreferrer">http://my-site.com/visningshus</a>" lists all posts of that type. I want to show the page that has that permalink slug instead...
[ { "answer_id": 135162, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 7, "selected": true, "text": "<p>The easiest would be to just disable the archive page for this CPT:</p>\n\n<pre><code>register_post_type( 'vi...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135146", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24829/" ]
I have a custom post type called "visningshus", and also a Page with that slug. This is as it should (must) be. Currently, "<http://my-site.com/visningshus>" lists all posts of that type. I want to show the page that has that permalink slug instead. How can I make Wordpress not make the post type name take precedenc...
The easiest would be to just disable the archive page for this CPT: ``` register_post_type( 'visningshus', array( [...] 'has_archive' => false, [...] ) ); ``` Don't forget to refresh you permalinks afterwards at *"Settings > Permalinks"*
135,157
<p>I'm currently redesigning a local news website. The old design used a whole lot of categories to handle the position of the content in the static homepage as in "top news", "middle box", "left box" and so on.</p> <p>This is working in someway but it's very ugly, in my opinion, very wrong on a semantic level: catego...
[ { "answer_id": 135160, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 0, "selected": false, "text": "<p>I would propose adding <strong>Custom Fields</strong> to the posts (either be convention or by creating a de...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135157", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14047/" ]
I'm currently redesigning a local news website. The old design used a whole lot of categories to handle the position of the content in the static homepage as in "top news", "middle box", "left box" and so on. This is working in someway but it's very ugly, in my opinion, very wrong on a semantic level: categories shoul...
After a lot of digging and trial-error I think I found a solution. It involves custom fields for which I used [Advanced Custom Field](http://wordpress.org/plugins/advanced-custom-fields/ "Advanced Custom Field") but it's optional. To make things easy on the site author I put a metabox before the actual news ![enter ...
135,158
<p>I want to add a shortcode tag in the sidebar/widget.</p> <p>I am able to get the required functionality if I add the code in the theme's function.php</p> <pre><code>add_filter('widget_text', 'do_shortcode'); </code></pre> <p>My problem is that I am searching for a way I can do this from the plugins files itself w...
[ { "answer_id": 135160, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 0, "selected": false, "text": "<p>I would propose adding <strong>Custom Fields</strong> to the posts (either be convention or by creating a de...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135158", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47280/" ]
I want to add a shortcode tag in the sidebar/widget. I am able to get the required functionality if I add the code in the theme's function.php ``` add_filter('widget_text', 'do_shortcode'); ``` My problem is that I am searching for a way I can do this from the plugins files itself without affecting any of the theme...
After a lot of digging and trial-error I think I found a solution. It involves custom fields for which I used [Advanced Custom Field](http://wordpress.org/plugins/advanced-custom-fields/ "Advanced Custom Field") but it's optional. To make things easy on the site author I put a metabox before the actual news ![enter ...
135,178
<p>I am moving Wordpress site from one domain to another. In the old domain the WP version was 3.5.2 while in the new domain WP version is 3.8.1.</p> <p>There is a page named &quot;2002&quot; which just contains an image gallery. The text code is something like this:</p> <pre><code>[gallery columns=&quot;6&quot; ids=&q...
[ { "answer_id": 135160, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 0, "selected": false, "text": "<p>I would propose adding <strong>Custom Fields</strong> to the posts (either be convention or by creating a de...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135178", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17929/" ]
I am moving Wordpress site from one domain to another. In the old domain the WP version was 3.5.2 while in the new domain WP version is 3.8.1. There is a page named "2002" which just contains an image gallery. The text code is something like this: ``` [gallery columns="6" ids="318,319,320,321,322"] ``` In the old w...
After a lot of digging and trial-error I think I found a solution. It involves custom fields for which I used [Advanced Custom Field](http://wordpress.org/plugins/advanced-custom-fields/ "Advanced Custom Field") but it's optional. To make things easy on the site author I put a metabox before the actual news ![enter ...
135,199
<p>I have a menu on a page that shows the children of a parent page, however, if a sub page is clicked on the children only of the sub page shows in this nav. is it possible to haver the direct children of the master parent page?</p> <p>I'm currently using the following:</p> <pre><code>$thispage = $wp_query-&gt;post;...
[ { "answer_id": 135200, "author": "gdaniel", "author_id": 30984, "author_profile": "https://wordpress.stackexchange.com/users/30984", "pm_score": 2, "selected": true, "text": "<p>This is what I have used in a few projects that always displays the children pages even if you're are viewing ...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135199", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16532/" ]
I have a menu on a page that shows the children of a parent page, however, if a sub page is clicked on the children only of the sub page shows in this nav. is it possible to haver the direct children of the master parent page? I'm currently using the following: ``` $thispage = $wp_query->post; if($thispage->post_pare...
This is what I have used in a few projects that always displays the children pages even if you're are viewing a child page. See if this is what you had in mind ``` <?php if(!$post->post_parent){ // will display the subpages of this top level page $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo...
135,208
<p>I am using get_categories to list the child categories of a parent category.</p> <p>I want to add an image to the child categories, using the get_categories output. </p> <ul> <li>I can either take the featured image from any of the posts that are children of the category that I am using get_categories on, IE the ...
[ { "answer_id": 135676, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 2, "selected": false, "text": "<p>Instead of using <a href=\"http://codex.wordpress.org/Function_Reference/get_categories\" rel=\"nof...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135208", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14416/" ]
I am using get\_categories to list the child categories of a parent category. I want to add an image to the child categories, using the get\_categories output. * I can either take the featured image from any of the posts that are children of the category that I am using get\_categories on, IE the grand-child of the ...
This is possible with a filter on `get_terms`. ``` function grab_child_image($terms,$taxonomies,$args) { // var_dump($terms,$taxonomies,$args); // debug foreach ($terms as &$term) { $cp = new WP_Query( array ( 'cat' => $term->term_id, 'fields' => 'ids', 'ignore_sticky_posts' => tr...
135,211
<h2><strong>Background:</strong></h2> <p>My partner and I have a goal to create a customizable vagrant project that uses Wordpress multi site, as a local development environment.</p> <hr /> <p><strong>Ideal Use Case:</strong> Various developers on our team (of varying skill levels) will be provided with a vagrant packa...
[ { "answer_id": 135676, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 2, "selected": false, "text": "<p>Instead of using <a href=\"http://codex.wordpress.org/Function_Reference/get_categories\" rel=\"nof...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135211", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41479/" ]
**Background:** --------------- My partner and I have a goal to create a customizable vagrant project that uses Wordpress multi site, as a local development environment. --- **Ideal Use Case:** Various developers on our team (of varying skill levels) will be provided with a vagrant package. When they "vagrant-up" th...
This is possible with a filter on `get_terms`. ``` function grab_child_image($terms,$taxonomies,$args) { // var_dump($terms,$taxonomies,$args); // debug foreach ($terms as &$term) { $cp = new WP_Query( array ( 'cat' => $term->term_id, 'fields' => 'ids', 'ignore_sticky_posts' => tr...
135,222
<p>Is there a way to check if a custom hook gets called upon? I would like to display a placeholder if no output will be passed to it.</p>
[ { "answer_id": 135223, "author": "tfrommen", "author_id": 27722, "author_profile": "https://wordpress.stackexchange.com/users/27722", "pm_score": 2, "selected": false, "text": "<p>Do you know <a href=\"http://codex.wordpress.org/Function_Reference/did_action\" rel=\"nofollow\"><code>did_...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135222", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Is there a way to check if a custom hook gets called upon? I would like to display a placeholder if no output will be passed to it.
I believe you are looking for [`has_action`](http://codex.wordpress.org/Function_Reference/has_action), which should ... > > Check if any action has been registered for a hook. > > > ``` if (has_action('custom_action')) { // stuff } else { // different stuff } ```
135,227
<p>I am trying to remove the gallery metabox which is added by WooCommerce - its been added in an update, but I already have a Gallery metabox, and I don't want to confuse the client. </p> <p>Obviously I can hack the plugin, but I'd like to do it from the functions.php</p> <p>I've tried:</p> <pre><code>function remo...
[ { "answer_id": 135233, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 4, "selected": true, "text": "<p>A quick search in their <a href=\"https://github.com/woothemes/woocommerce/blob/247f0ac064f13056cfa6d41ec2c1cf3d6f7...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135227", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6402/" ]
I am trying to remove the gallery metabox which is added by WooCommerce - its been added in an update, but I already have a Gallery metabox, and I don't want to confuse the client. Obviously I can hack the plugin, but I'd like to do it from the functions.php I've tried: ``` function remove_my_meta_boxes() { rem...
A quick search in their [GitHub repo](https://github.com/woothemes/woocommerce/blob/247f0ac064f13056cfa6d41ec2c1cf3d6f7a4a4c/includes/admin/post-types/class-wc-admin-meta-boxes.php#L95) shows the following line: ``` add_meta_box( 'woocommerce-product-images', __( 'Product Gallery', 'woocommerce' ), 'WC_Met...
135,250
<p>I have been trying to learn how to write plugins and I thought the best way would be to look at other plugins.</p> <p>I was taking a look at this one and the first lines </p> <pre><code>/** * Plugin Name: Media Library Categories * Plugin URI: http://wordpress.org/plugins/wp-media-library-categories/ * Descript...
[ { "answer_id": 135251, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 1, "selected": false, "text": "<p>You almost gave the answer yourself.</p>\n\n<p>apply_filters, as the name says applies all filters registere...
2014/02/19
[ "https://wordpress.stackexchange.com/questions/135250", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14854/" ]
I have been trying to learn how to write plugins and I thought the best way would be to look at other plugins. I was taking a look at this one and the first lines ``` /** * Plugin Name: Media Library Categories * Plugin URI: http://wordpress.org/plugins/wp-media-library-categories/ * Description: Adds the ability...
Hook use is very, very simple. To create a hook use `apply_filters` or `do_action`. The first parameter is the hook name, the other parameters are the arguments. You must have the hook name, but the other arguments are optional. You can have, so far as I know, as many arguments as you like. For example: ``` $t = ap...
135,268
<p>For some reasons I show the <em>Last Modified</em> information to my users in the blog. Recently I have to clear up my categories and tags, but these actions will result in the update of 'Last Modified' field of a post, which is not actually I desired. </p> <p>Content updates are what readers really concerned about...
[ { "answer_id": 135251, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 1, "selected": false, "text": "<p>You almost gave the answer yourself.</p>\n\n<p>apply_filters, as the name says applies all filters registere...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135268", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47765/" ]
For some reasons I show the *Last Modified* information to my users in the blog. Recently I have to clear up my categories and tags, but these actions will result in the update of 'Last Modified' field of a post, which is not actually I desired. Content updates are what readers really concerned about, and not about m...
Hook use is very, very simple. To create a hook use `apply_filters` or `do_action`. The first parameter is the hook name, the other parameters are the arguments. You must have the hook name, but the other arguments are optional. You can have, so far as I know, as many arguments as you like. For example: ``` $t = ap...
135,271
<p>I'd like to override the core Wordpress function wp_referer_field to change the value of $referer_field variable inside of it. I've found that wp_referer_field is not pluggable and that I need to use some other technics for that. Adding some filters or actions. I was trying to use these code:</p> <pre><code>add_...
[ { "answer_id": 135341, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 3, "selected": true, "text": "<p><code>wp_referer_field</code> is a <em>function</em>. You cannot treat a function like a <em>hook</em>. That ...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135271", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36521/" ]
I'd like to override the core Wordpress function wp\_referer\_field to change the value of $referer\_field variable inside of it. I've found that wp\_referer\_field is not pluggable and that I need to use some other technics for that. Adding some filters or actions. I was trying to use these code: ``` add_filter( 'w...
`wp_referer_field` is a *function*. You cannot treat a function like a *hook*. That isn't how hooks work. That is, you can't hook into a function name. Hooks are intentionally created. ([And there are no hooks built into that function](https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/functions.php#L12...
135,291
<p>I'm inserting information from a user into a custom post type. <code>$current_user</code> it a user-object.</p> <p>Is there anything special I have to think of when setting <code>post_date_gmt</code> when inserting a new post with wp_insert_post? (Or could I just fetch the value from the user-table like below?</p> ...
[ { "answer_id": 135278, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 2, "selected": false, "text": "<p>This is not a WordPress message, it is either from a plugin or from your web hosting. Disable all plugins (per file a...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135291", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38848/" ]
I'm inserting information from a user into a custom post type. `$current_user` it a user-object. Is there anything special I have to think of when setting `post_date_gmt` when inserting a new post with wp\_insert\_post? (Or could I just fetch the value from the user-table like below? ``` $pupil = array( ...
It could be that a plugin which blocks I.P addresses or Countries is causing this. Otherwise it maybe a setting in a security plugin has caused this. Seems the message is a custom one. Otherwise it could be something coded into a .htaccess file.
135,304
<p>I'm just wondering about usernames... Why isn't is possible to change this through Wordpress API? (I understand why a user in the admin dashboard can't change username(s) but that isn't really same thing!?)</p> <p>Code below does just ignore the user_login - setting.</p> <pre><code>$pupil_obj= get_post($postid_pup...
[ { "answer_id": 135307, "author": "Ovidiu Iacomi", "author_id": 36012, "author_profile": "https://wordpress.stackexchange.com/users/36012", "pm_score": 2, "selected": false, "text": "<p>There is a note on the wp_udate_user function codex page: <a href=\"http://codex.wordpress.org/Function...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135304", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38848/" ]
I'm just wondering about usernames... Why isn't is possible to change this through Wordpress API? (I understand why a user in the admin dashboard can't change username(s) but that isn't really same thing!?) Code below does just ignore the user\_login - setting. ``` $pupil_obj= get_post($postid_pupil); $user_login = ...
Looking on Trac I found a ticket that discusses exactly this issue: [Administrator should be able to change usernames](https://core.trac.wordpress.org/ticket/14644) This is what it all boils down to: Changing usernames could break permalinks ----------------------------------------- To prevent this a lot more than j...
135,323
<p>I have the following code working fine in my theme:</p> <pre><code>&lt;!-- Modify query object --&gt; &lt;?php query_posts('showposts=5&amp;post_type=news'); ?&gt; &lt;!-- Start the Loop --&gt; &lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt; &lt;li&gt; &lt;a href="&lt;?php th...
[ { "answer_id": 135329, "author": "kraftner", "author_id": 47733, "author_profile": "https://wordpress.stackexchange.com/users/47733", "pm_score": 0, "selected": false, "text": "<p><strong>First: <a href=\"https://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135323", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27414/" ]
I have the following code working fine in my theme: ``` <!-- Modify query object --> <?php query_posts('showposts=5&post_type=news'); ?> <!-- Start the Loop --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li> <a href="<?php the_permalink(); ?>"> <?php ...
Found an answer to my question using the ACF plugin **get\_field** function (<http://www.advancedcustomfields.com/resources/functions/get_field/>) to retrieve the value of the custom field, save it as a variable and then use it as part of the query\_post parameters: ``` <!-- Modify query object --> <?php $num_news = g...
135,325
<p>I am trying to find a method to delete a certain tag, that is used in my theme to display differently "featured" and "dont-miss" posts, from multiple posts and I was not able to find a solution. Or the only solution that I found is quick-edit each post manually.</p> <p>I know that adding bulk tags to posts is supp...
[ { "answer_id": 135883, "author": "Sudeep K Rana", "author_id": 47179, "author_profile": "https://wordpress.stackexchange.com/users/47179", "pm_score": 3, "selected": true, "text": "<p>Since no direct function is there to achieve the required so I have made the code.</p>\n\n<p>Code is sel...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135325", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36/" ]
I am trying to find a method to delete a certain tag, that is used in my theme to display differently "featured" and "dont-miss" posts, from multiple posts and I was not able to find a solution. Or the only solution that I found is quick-edit each post manually. I know that adding bulk tags to posts is supported direc...
Since no direct function is there to achieve the required so I have made the code. Code is self explanatory and you can tweak it the way you like. ``` <?php //Assuming a post ID to reset tags. $postid = 172; //Assuming tag2 is supposed to be removed $remove_tag ...
135,343
<p>I have a wordpress blog which is served by apache2(on port 80) and nginx(on port 8080) on Ubuntu 12.04. Now whenever a client connects via port 80 all is hunky dory, but when a client connects to 8080 to view the same blog, the connection is redirected to apache. Why is this happening? I searched around and found th...
[ { "answer_id": 135371, "author": "calypso", "author_id": 47923, "author_profile": "https://wordpress.stackexchange.com/users/47923", "pm_score": 4, "selected": false, "text": "<p>I solved it!! here's how:</p>\n\n<p>Edit your current theme's <code>functions.php</code> and add following li...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135343", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47911/" ]
I have a wordpress blog which is served by apache2(on port 80) and nginx(on port 8080) on Ubuntu 12.04. Now whenever a client connects via port 80 all is hunky dory, but when a client connects to 8080 to view the same blog, the connection is redirected to apache. Why is this happening? I searched around and found that ...
I solved it!! here's how: Edit your current theme's `functions.php` and add following line after the opening PHP tag to disable canonical redirection. `remove_filter('template_redirect','redirect_canonical');` save and exit. Restart apache2 and nginx and check with `curl -I IP`.
135,365
<p>I am trying to run an ajax request to pass some data to a function I have written. I return the response, and try and run some javascript based on the response, but it doesn't seem to be running properly. Regardless of what the response is back, it always runs it as if the response was not 'Everything's Chimpy!'</p...
[ { "answer_id": 135367, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>One reason might be that the AJAX request per jQuery defaults to <code>async: true</code>, and the response comes too...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135365", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43000/" ]
I am trying to run an ajax request to pass some data to a function I have written. I return the response, and try and run some javascript based on the response, but it doesn't seem to be running properly. Regardless of what the response is back, it always runs it as if the response was not 'Everything's Chimpy!' ``` j...
I ended up going with: ``` if(response.indexOf('Everything\'s Chimpy!') > -1) { } else { } ``` and it works like a charm. Thanks for the responses!
135,384
<p>I'd like to send email notifications when new posts are saved. But users can select post categories they want to subscribe to. Available plugins are no solution to me – I really need my own code base. Even though I am fairly new to WP there is no problem with all that … but I don't know how to connect custom taxonom...
[ { "answer_id": 135985, "author": "dashaluna", "author_id": 1343, "author_profile": "https://wordpress.stackexchange.com/users/1343", "pm_score": 3, "selected": true, "text": "<p>I came across a tutorial about '<a href=\"http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-...
2014/02/20
[ "https://wordpress.stackexchange.com/questions/135384", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47934/" ]
I'd like to send email notifications when new posts are saved. But users can select post categories they want to subscribe to. Available plugins are no solution to me – I really need my own code base. Even though I am fairly new to WP there is no problem with all that … but I don't know how to connect custom taxonomies...
I came across a tutorial about '[Custom User Taxonomies in WordPress](http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-in-wordpress)' and there is a plugin based on that '[User Taxonomies](http://wordpress.org/plugins/user-taxonomies/)' but these are for creating taxonomies for Users. Have a read tho...
135,423
<p>I want that when <em>every</em> Custom Post Type is published, a hook is called (where I send an email notification to the administrator). I know I can use:</p> <pre><code>add_action('publish_{custom_post_type_name}', 'function_to_call'); </code></pre> <p>but I don't know the <code>custom_post_type_name</code>s (e...
[ { "answer_id": 135985, "author": "dashaluna", "author_id": 1343, "author_profile": "https://wordpress.stackexchange.com/users/1343", "pm_score": 3, "selected": true, "text": "<p>I came across a tutorial about '<a href=\"http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-...
2014/02/21
[ "https://wordpress.stackexchange.com/questions/135423", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20974/" ]
I want that when *every* Custom Post Type is published, a hook is called (where I send an email notification to the administrator). I know I can use: ``` add_action('publish_{custom_post_type_name}', 'function_to_call'); ``` but I don't know the `custom_post_type_name`s (every site has different Custom Post Types re...
I came across a tutorial about '[Custom User Taxonomies in WordPress](http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-in-wordpress)' and there is a plugin based on that '[User Taxonomies](http://wordpress.org/plugins/user-taxonomies/)' but these are for creating taxonomies for Users. Have a read tho...
135,424
<p>I work on a project in which I want to remove +New link in WordPress admin bar. Actuly i want to replace 'new' to 'ADD Deal'. Is there any function in WP with this we can replace this text or how can I do this.</p>
[ { "answer_id": 135428, "author": "Sabita Sahoo", "author_id": 43570, "author_profile": "https://wordpress.stackexchange.com/users/43570", "pm_score": 0, "selected": false, "text": "<p>For removing +New from admin menu bar and adding a new node to the admin bar, you can use the following ...
2014/02/21
[ "https://wordpress.stackexchange.com/questions/135424", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44924/" ]
I work on a project in which I want to remove +New link in WordPress admin bar. Actuly i want to replace 'new' to 'ADD Deal'. Is there any function in WP with this we can replace this text or how can I do this.
I think what you are asking is changing the text +NEW to ADD Deal. This code is adjusted like that. ``` add_action( 'admin_bar_menu', 'change_new_post_name', 999 ); function change_new_post_name ( $wp_admin_bar ) { //Removing +New $wp_admin_bar->remove_node( 'new-content' ); //hyperlink for t...
135,443
<p>I have a page associated with a custom template that list all password protected posts.</p> <blockquote> <p>Let's name it <strong>MyPage</strong>.</p> </blockquote> <p>What I'm trying to achieve is when a user views <strong>MyPage</strong> to show only once the <strong>password protected form</strong> and when h...
[ { "answer_id": 135469, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>Interesting question :)</p>\n\n<p>Here is a very simple implementation.</p>\n\n<pre><code>/**\n * Template N...
2014/02/21
[ "https://wordpress.stackexchange.com/questions/135443", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47660/" ]
I have a page associated with a custom template that list all password protected posts. > > Let's name it **MyPage**. > > > What I'm trying to achieve is when a user views **MyPage** to show only once the **password protected form** and when he/she enter a valid password -> to redirect back to **MyPage** so he ca...
**TL;TR?** *Spoiler alert - hover over the next blockquote to expose it.* > > Building an archive that is *easily* filterable by the currently entered password is nothing that is easy and surely not elegant buildable. The solution involves a secondary query and a small plugin, but it works. All errors and wrong path...
135,455
<p>I am working on a custom sign up proces where a user first fills in his name and email, then receives an activation e-mail and then the sign up proces continues. </p> <p>The e-mail contains an activation link with a reference. I need to save this reference in my new user so if the user clicks on the link I can retr...
[ { "answer_id": 135456, "author": "fischi", "author_id": 15680, "author_profile": "https://wordpress.stackexchange.com/users/15680", "pm_score": 4, "selected": true, "text": "<p><code>wp_insert_user</code> returns your new user's ID, if created successful. You can add the <code>user_meta<...
2014/02/21
[ "https://wordpress.stackexchange.com/questions/135455", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25834/" ]
I am working on a custom sign up proces where a user first fills in his name and email, then receives an activation e-mail and then the sign up proces continues. The e-mail contains an activation link with a reference. I need to save this reference in my new user so if the user clicks on the link I can retrieve back ...
`wp_insert_user` returns your new user's ID, if created successful. You can add the `user_meta` to this ID: ``` $userid = wp_insert_user( $userdata ); if ( !is_wp_error( $userid ) ) { // check if insert was successful add_user_meta( $userid, 'verification_ref', $ref ); // add the meta } else { /* Error Handlin...
135,464
<p>I want to differentiate the featured image from post images. </p> <p>The plan is to give the Featured Image multiple sizes, but the images inside / connected to the post only needs the default sizes. </p> <p>I know I can use <code>intermediate_image_sizes</code> to filter what Custom Post Types get assigned to wha...
[ { "answer_id": 136131, "author": "sanchothefat", "author_id": 1733, "author_profile": "https://wordpress.stackexchange.com/users/1733", "pm_score": 3, "selected": true, "text": "<p>You could do this by filtering the meta value for <code>_thumbnail_id</code>.</p>\n\n<pre><code>add_filter(...
2014/02/21
[ "https://wordpress.stackexchange.com/questions/135464", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7355/" ]
I want to differentiate the featured image from post images. The plan is to give the Featured Image multiple sizes, but the images inside / connected to the post only needs the default sizes. I know I can use `intermediate_image_sizes` to filter what Custom Post Types get assigned to what image sizes, like so: ```...
You could do this by filtering the meta value for `_thumbnail_id`. ``` add_filter( 'update_post_metadata', 'generate_featured_image_sizes', 10, 5 ); add_filter( 'add_post_metadata', 'generate_featured_image_sizes', 10, 5 ); function generate_featured_image_sizes( $check, $object_id, $meta_key, $meta_value, $unique_or...
135,480
<p>In our MySQL slow query log, the cumulatively slowest query is a simple update to wp_postmeta. Here's an example:</p> <pre><code>UPDATE `wp_postmeta` SET `meta_value` = '1392835505:386' WHERE `post_id` = 94705 AND `meta_key` = '_edit_lock'; </code></pre> <p>Relevant details on our setup:</p> <ul> <li>MySQL s...
[ { "answer_id": 139956, "author": "seot", "author_id": 34534, "author_profile": "https://wordpress.stackexchange.com/users/34534", "pm_score": 3, "selected": false, "text": "<p>the _edit_lock is generated each time you edit a post or page. it consist the timecode and the user. so WordPres...
2014/02/21
[ "https://wordpress.stackexchange.com/questions/135480", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10388/" ]
In our MySQL slow query log, the cumulatively slowest query is a simple update to wp\_postmeta. Here's an example: ``` UPDATE `wp_postmeta` SET `meta_value` = '1392835505:386' WHERE `post_id` = 94705 AND `meta_key` = '_edit_lock'; ``` Relevant details on our setup: * MySQL slow query time set to 1s * wp\_postme...
the \_edit\_lock is generated each time you edit a post or page. it consist the timecode and the user. so WordPress is knowing who is currently editing it. ``` meta_id post_id meta_key meta_value 9 5 _edit_lock 1388386997:1 ``` if you manipulate it WordPress reacts somehow sensitive ....
135,504
<p>I'm querying an ACF field, and displaying all the results on the front-end like so—<br> PHP:</p> <pre><code> &lt;ul class="category-menu-items"&gt; &lt;?php // args $args = array( 'numberposts' =&gt; -1, 'post_type'...
[ { "answer_id": 135505, "author": "CommandZ", "author_id": 34723, "author_profile": "https://wordpress.stackexchange.com/users/34723", "pm_score": 0, "selected": false, "text": "<h2>EDIT: They will always return the same value if they have the same field name</h2>\n<p><code>get_field('fie...
2014/02/21
[ "https://wordpress.stackexchange.com/questions/135504", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28065/" ]
I'm querying an ACF field, and displaying all the results on the front-end like so— PHP: ``` <ul class="category-menu-items"> <?php // args $args = array( 'numberposts' => -1, 'post_type' => 'wpsc-product' ...
You could pass all the fields into an array during your while loop, strip the array of duplicates, and then run a foreach loop on that array. It would look something like this: ``` <?php $designers = array(); while ( $the_query->have_posts() ) : $the_query->the_post(); $designers[] = get_field('products_page_des...
135,514
<p>I registered two menus top-menu and main-menu.</p> <p>I created two menu on the admin panel and assigned one to each (different items)</p> <p>But when I view the front end, I see that the two menus have the same items, and the main menu has an id "menu-top-menu-1"</p> <p>Here is what I have:</p> <p>functions.php...
[ { "answer_id": 135505, "author": "CommandZ", "author_id": 34723, "author_profile": "https://wordpress.stackexchange.com/users/34723", "pm_score": 0, "selected": false, "text": "<h2>EDIT: They will always return the same value if they have the same field name</h2>\n<p><code>get_field('fie...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135514", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44390/" ]
I registered two menus top-menu and main-menu. I created two menu on the admin panel and assigned one to each (different items) But when I view the front end, I see that the two menus have the same items, and the main menu has an id "menu-top-menu-1" Here is what I have: functions.php ``` function register_my_menu...
You could pass all the fields into an array during your while loop, strip the array of duplicates, and then run a foreach loop on that array. It would look something like this: ``` <?php $designers = array(); while ( $the_query->have_posts() ) : $the_query->the_post(); $designers[] = get_field('products_page_des...
135,522
<p>Trying to use the the below code for my CPT 'state' like <code>add_filter('the_content', 'my_custom_loop');</code> but the trial and error is not getting me anywhere. I can't use a single-{post_type}.php since i am using a drag and drop theme headway.</p> <p><strong>Update</strong>: exact code I am trying to use in...
[ { "answer_id": 135505, "author": "CommandZ", "author_id": 34723, "author_profile": "https://wordpress.stackexchange.com/users/34723", "pm_score": 0, "selected": false, "text": "<h2>EDIT: They will always return the same value if they have the same field name</h2>\n<p><code>get_field('fie...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135522", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34509/" ]
Trying to use the the below code for my CPT 'state' like `add_filter('the_content', 'my_custom_loop');` but the trial and error is not getting me anywhere. I can't use a single-{post\_type}.php since i am using a drag and drop theme headway. **Update**: exact code I am trying to use in a functionality plugin and it gi...
You could pass all the fields into an array during your while loop, strip the array of duplicates, and then run a foreach loop on that array. It would look something like this: ``` <?php $designers = array(); while ( $the_query->have_posts() ) : $the_query->the_post(); $designers[] = get_field('products_page_des...
135,525
<p>On a WP install with about 1400 images and the <a href="http://wordpress.org/plugins/media-tools/" rel="nofollow">Media Tools 1.1</a> plugin, I ran both "Import External and Set Featured Image" and "Set Featured Image".</p> <p>But the featured images functionality didnt work, because it designated (in the DB) the w...
[ { "answer_id": 136824, "author": "K Themes", "author_id": 24783, "author_profile": "https://wordpress.stackexchange.com/users/24783", "pm_score": 1, "selected": false, "text": "<p>You can get all ids of featured images querying the \"post_meta\" table for \"_thumbnail_id\" (as Milo said)...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135525", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5090/" ]
On a WP install with about 1400 images and the [Media Tools 1.1](http://wordpress.org/plugins/media-tools/) plugin, I ran both "Import External and Set Featured Image" and "Set Featured Image". But the featured images functionality didnt work, because it designated (in the DB) the wrong filename for the images: Instea...
You should probably not run `preg_replace` on the meta data for a `_wp_attachment_metadata` field as the data is serialized. I would recommend instead you write a small script to loop through the images, unserialize the data, update the value, serialize and store the modified array. Here's a sample function which does ...
135,533
<p>I set the number of posts to show on my blog to 1, but the blog is showing all the posts I have. I tried to insert a custom query into my index.php, but it just made one post show up endlessly. This is my index.php:</p> <pre><code>&lt;?php get_header(); ?&gt; &lt;?php if ( have_posts() ) : ?&gt; &lt;div id="conten...
[ { "answer_id": 135538, "author": "NoSense", "author_id": 47660, "author_profile": "https://wordpress.stackexchange.com/users/47660", "pm_score": -1, "selected": false, "text": "<p>I'm newbie in WordPresss, but try to change your code to this:</p>\n\n<pre><code>&lt;?php get_header(); ?&gt...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135533", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/74495/" ]
I set the number of posts to show on my blog to 1, but the blog is showing all the posts I have. I tried to insert a custom query into my index.php, but it just made one post show up endlessly. This is my index.php: ``` <?php get_header(); ?> <?php if ( have_posts() ) : ?> <div id="content" class="group"> <?php /...
No need to edit your parent themes files as its bad practice. You can use this code in your child themes functions file ``` add_action( 'pre_get_posts', 'wpsites_limit_posts' ); function wpsites_limit_posts( $query ) { if( $query->is_main_query() && !is_admin() && is_home() ) { $query->set( 'posts_per_page', '1'...
135,551
<p>I want to uploads videos from admin and show them using any video player. I used a plugin but when i tried uploding a video the message appers that uplod size exceeded. Can anybody suggest me any good video player plugin.</p>
[ { "answer_id": 135538, "author": "NoSense", "author_id": 47660, "author_profile": "https://wordpress.stackexchange.com/users/47660", "pm_score": -1, "selected": false, "text": "<p>I'm newbie in WordPresss, but try to change your code to this:</p>\n\n<pre><code>&lt;?php get_header(); ?&gt...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135551", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44589/" ]
I want to uploads videos from admin and show them using any video player. I used a plugin but when i tried uploding a video the message appers that uplod size exceeded. Can anybody suggest me any good video player plugin.
No need to edit your parent themes files as its bad practice. You can use this code in your child themes functions file ``` add_action( 'pre_get_posts', 'wpsites_limit_posts' ); function wpsites_limit_posts( $query ) { if( $query->is_main_query() && !is_admin() && is_home() ) { $query->set( 'posts_per_page', '1'...
135,555
<p>I wonder how to redirect a user after login to the page called by his first name (name used for registration).</p> <p>Example: Username or first name is John, after login he should be redirected to website.com/john page.</p> <p>I tried to combine these 2 examples but without luck.</p> <pre><code>add_filter( 'log...
[ { "answer_id": 135561, "author": "1fixdotio", "author_id": 45728, "author_profile": "https://wordpress.stackexchange.com/users/45728", "pm_score": 2, "selected": true, "text": "<p>Try the following code in your functions.php:</p>\n\n<pre><code>function my_login_redirect( $redirect_to, $u...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135555", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48008/" ]
I wonder how to redirect a user after login to the page called by his first name (name used for registration). Example: Username or first name is John, after login he should be redirected to website.com/john page. I tried to combine these 2 examples but without luck. ``` add_filter( 'login_redirect', 'ckc_login_redi...
Try the following code in your functions.php: ``` function my_login_redirect( $redirect_to, $url, $user ) { global $user; if( isset( $user->roles ) && is_array( $user->roles ) ) { //check for admins if( in_array( "administrator", $user->roles ) ) { // redirect them to the default p...
135,568
<p>On the frontpage of a blog I want a piece of text (like an excerpt) under the title but I don't want is showing up in the full post.</p> <p>Any ideas how I would go about this?</p> <p>EDIT: Wasn't precise enough in my question. The piece of text under the title will be different for every post and has to be able t...
[ { "answer_id": 135569, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 0, "selected": false, "text": "<p>Find the code block responsible for the post title and excerpt. Then simply use the following:</p>\n\n...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135568", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48013/" ]
On the frontpage of a blog I want a piece of text (like an excerpt) under the title but I don't want is showing up in the full post. Any ideas how I would go about this? EDIT: Wasn't precise enough in my question. The piece of text under the title will be different for every post and has to be able to be set in the b...
Tested this and it worked perfectly on Genesis. You can also use HTML tags in the custom field. ``` add_action( 'genesis_entry_header', 'content_after_archive_title', 15 ); function content_after_archive_title() { if ( is_home() && genesis_get_custom_field('after-title') ) : echo '<div class="after-title">'. genes...
135,571
<p>Is it possible to conditionally set the post_content in wp_insert_post? Im using a foreach to add multiple pages at once:</p> <pre><code>foreach ($create_pages as $new_page) { $add_pages = array( 'post_title' =&gt; $new_page, 'post_content' =&gt; '', // lets say, if the page_title is 'Home', set...
[ { "answer_id": 135580, "author": "Shazzad", "author_id": 42967, "author_profile": "https://wordpress.stackexchange.com/users/42967", "pm_score": 2, "selected": false, "text": "<p>Yes, you could try this - </p>\n\n<pre><code>foreach( $create_pages as $new_page ){\n $content = \"Default...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135571", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41331/" ]
Is it possible to conditionally set the post\_content in wp\_insert\_post? Im using a foreach to add multiple pages at once: ``` foreach ($create_pages as $new_page) { $add_pages = array( 'post_title' => $new_page, 'post_content' => '', // lets say, if the page_title is 'Home', set the post_content...
I can't help but think I am missing something but what seems like the obvious answer is to alter your `$create_pages` array: ``` $create_pages = array( 'one' => 'content for one', 'two' => 'content for two', 'three' => 'content for three' ); foreach ($create_pages as $title => $content) { $add_pages = array...
135,589
<p>I tried few tutorials. All i think is i should use <code>register_nav_menus()</code> and then add the menu in <code>header.php</code></p> <p>Here is the code i tried in functions.php from this help site itself</p> <pre><code>function my_cool_menu_function(){ register_nav_menus( array( 'primary' =&gt; 'Primar...
[ { "answer_id": 135608, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 0, "selected": false, "text": "<p>The default fallback for <a href=\"http://codex.wordpress.org/Function_Reference/wp_nav_menu\" rel=\"nof...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135589", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37102/" ]
I tried few tutorials. All i think is i should use `register_nav_menus()` and then add the menu in `header.php` Here is the code i tried in functions.php from this help site itself ``` function my_cool_menu_function(){ register_nav_menus( array( 'primary' => 'Primary Navigation' )); } add_action( 'after_setu...
Put this pretty much anywhere (ie. functions.php) ``` add_theme_support( 'menus' ); ```
135,611
<p>I'm working with custom post types. In the post type awards I have a relationship field that links each award to a post from the post type project.</p> <p>I'm using the following code to return the values from this field - it should not return anything if $work_value is empty:</p> <pre><code>&lt;?php $work_value ...
[ { "answer_id": 135667, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p><a href=\"https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/post.php#L1769\" rel=\"nofollow\...
2014/02/22
[ "https://wordpress.stackexchange.com/questions/135611", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47302/" ]
I'm working with custom post types. In the post type awards I have a relationship field that links each award to a post from the post type project. I'm using the following code to return the values from this field - it should not return anything if $work\_value is empty: ``` <?php $work_value = get_post_meta($post->...
[`get_post_meta()`](https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/post.php#L1769) should only `return false` under a couple of circumstances: > > > ``` > 269 function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) { > 270 if ( !$meta_type ) > 271 ...
135,622
<p>How to add custom field in wordpress registration form and view it in user profile in the backend?</p> <p>I've already google it but just find how to add it in user profile but not in registration process.</p>
[ { "answer_id": 135667, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p><a href=\"https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/post.php#L1769\" rel=\"nofollow\...
2014/02/23
[ "https://wordpress.stackexchange.com/questions/135622", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48030/" ]
How to add custom field in wordpress registration form and view it in user profile in the backend? I've already google it but just find how to add it in user profile but not in registration process.
[`get_post_meta()`](https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/post.php#L1769) should only `return false` under a couple of circumstances: > > > ``` > 269 function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) { > 270 if ( !$meta_type ) > 271 ...
135,628
<p>The default setting in the bbpress forum topics is that the most active topic automatically gets on top (sorted by freshness). However, I wish to change this setting in descending order of topics created or by topic id. I have tried to locate the template file to make these changes but could not get. Any help is app...
[ { "answer_id": 135702, "author": "netweb", "author_id": 20961, "author_profile": "https://wordpress.stackexchange.com/users/20961", "pm_score": 2, "selected": false, "text": "<p>Add this to a plugin or your active themes functions.php</p>\n\n<pre><code>function my_custom_display_topic_in...
2014/02/23
[ "https://wordpress.stackexchange.com/questions/135628", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13058/" ]
The default setting in the bbpress forum topics is that the most active topic automatically gets on top (sorted by freshness). However, I wish to change this setting in descending order of topics created or by topic id. I have tried to locate the template file to make these changes but could not get. Any help is apprec...
Add this to a plugin or your active themes functions.php ``` function my_custom_display_topic_index_query () { $args['orderby'] = 'date'; $args['order'] = 'DESC'; return $args; } add_filter('bbp_before_has_topics_parse_args', 'my_custom_display_topic_index_query' ); ```
135,645
<p>Using Wordpress 3.8.1 with 'Twenty Fourteen' theme I'd like to arrange my post in such a way that it's main contents go to main (center) column while galleries, attached files and links pertaining to this post go to content sidebar to the right. How can I do that? Do I need some specific plugins?</p> <p>Right now I...
[ { "answer_id": 135702, "author": "netweb", "author_id": 20961, "author_profile": "https://wordpress.stackexchange.com/users/20961", "pm_score": 2, "selected": false, "text": "<p>Add this to a plugin or your active themes functions.php</p>\n\n<pre><code>function my_custom_display_topic_in...
2014/02/23
[ "https://wordpress.stackexchange.com/questions/135645", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48042/" ]
Using Wordpress 3.8.1 with 'Twenty Fourteen' theme I'd like to arrange my post in such a way that it's main contents go to main (center) column while galleries, attached files and links pertaining to this post go to content sidebar to the right. How can I do that? Do I need some specific plugins? Right now I can place...
Add this to a plugin or your active themes functions.php ``` function my_custom_display_topic_index_query () { $args['orderby'] = 'date'; $args['order'] = 'DESC'; return $args; } add_filter('bbp_before_has_topics_parse_args', 'my_custom_display_topic_index_query' ); ```
135,654
<p>How to transform the parent category into an <code>optgroup</code>?</p> <p>Demo of what I want: <a href="http://fiddle.jshell.net/Pp7Ey/show/" rel="nofollow noreferrer">http://fiddle.jshell.net/Pp7Ey/show/</a></p> <p>Currently I have this code:</p> <pre><code>$cat = $_POST['cat']; $data = array( .. 'post...
[ { "answer_id": 135669, "author": "Steven Jones", "author_id": 24124, "author_profile": "https://wordpress.stackexchange.com/users/24124", "pm_score": 1, "selected": false, "text": "<p>You can use <code>get_categories()</code> where you will have more control over the data and build up yo...
2014/02/23
[ "https://wordpress.stackexchange.com/questions/135654", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48026/" ]
How to transform the parent category into an `optgroup`? Demo of what I want: <http://fiddle.jshell.net/Pp7Ey/show/> Currently I have this code: ``` $cat = $_POST['cat']; $data = array( .. 'post_category' => array( $cat ) ); wp_insert_post( $data ); <?php wp_dropdown_categories('orderby=name&hide_empty=0&...
You will need to `extend` the `Walker_CategoryDropdown` walker. A very, very simple version of that is this: ``` class Top_level_Optgroup extends Walker_CategoryDropdown { var $optgroup = false; function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { $pad = str_repeat('&nbsp;', $dep...
135,660
<p>I have a custom post type, <code>course</code> with an associated custom taxonomy <code>curriculum-area</code>. On the permalink <code>domain.com/course/</code>, a list of all courses is shown as expected. However, on the permalink <code>domain.com/curriculum-area/equality</code>, it shows the home page. (The home p...
[ { "answer_id": 135664, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 0, "selected": false, "text": "<p>This is dependent on your template hierarchy and not the code you showed. <code>archive.php</code> is the fallback...
2014/02/23
[ "https://wordpress.stackexchange.com/questions/135660", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48046/" ]
I have a custom post type, `course` with an associated custom taxonomy `curriculum-area`. On the permalink `domain.com/course/`, a list of all courses is shown as expected. However, on the permalink `domain.com/curriculum-area/equality`, it shows the home page. (The home page is a static page). I would like it to, inst...
Your permalink as given is `domain.com/curriculum-area/equality` but you registered your taxonomy as `Curriculum Area`. For `domain.com/curriculum-area/equality` to work, change `Curriculum Area` in: ``` register_taxonomy( 'Curriculum Area', 'course', $args_curriculum_area_taxonomy ); ``` to be: ``` register_taxon...
135,692
<p>I am writing a plugin, that will list a number of entries from a custom set of tables. I added the main page for the plugin using the following WordPress functions: </p> <pre><code>// Add menu and pages to WordPress admin area add_action('admin_menu', 'myplugin_create_top_level_menu'); function myplugin_create_top...
[ { "answer_id": 135694, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 5, "selected": true, "text": "<p>I am less convinced that I know what you are doing than I once was.</p>\n\n<pre><code>// Add menu and pages t...
2014/02/23
[ "https://wordpress.stackexchange.com/questions/135692", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34253/" ]
I am writing a plugin, that will list a number of entries from a custom set of tables. I added the main page for the plugin using the following WordPress functions: ``` // Add menu and pages to WordPress admin area add_action('admin_menu', 'myplugin_create_top_level_menu'); function myplugin_create_top_level_menu() ...
I am less convinced that I know what you are doing than I once was. ``` // Add menu and pages to WordPress admin area add_action('admin_menu', 'myplugin_create_top_level_menu'); function myplugin_create_top_level_menu() { // This is the menu on the side add_menu_page( 'MyPlugin', 'MyPlugin', ...
135,707
<p>I'm trying without success to have a URL structure like <strong>domain.com/term/postname</strong>, but I just get 404 for all non-CPT pages.</p> <pre><code>function add_video_post_type() { $labels = array( 'name' =&gt; _x( 'Videos', 'Post Type General Name', 'kibble' ), 'singular...
[ { "answer_id": 135970, "author": "Sudeep K Rana", "author_id": 47179, "author_profile": "https://wordpress.stackexchange.com/users/47179", "pm_score": 0, "selected": false, "text": "<p>I tried your code and resetting permalink is behaving abnormal. But I have noticed a weird behavior whi...
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135707", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9060/" ]
I'm trying without success to have a URL structure like **domain.com/term/postname**, but I just get 404 for all non-CPT pages. ``` function add_video_post_type() { $labels = array( 'name' => _x( 'Videos', 'Post Type General Name', 'kibble' ), 'singular_name' => _x( 'Video', '...
Short answer ------------ Add this to your `functions.php` file or wherever you have the rest of this code, assuming this is all in your theme. If this is a plugin, the first two lines need to happen on `setup_theme`, so you need to hook into that action. Also, if it were me, I'd put everything into a class. If you d...
135,733
<p>For now, I am not using NextGen Gallery. For now I am adding <code>class="fancybox"</code> and <code>rel="gallery"</code> to each image and it opens all images within a page in fancybox. However, client wants to start using it. I have to figure out if it can be used also for this purpose.</p> <p>Can I use NextGEN G...
[ { "answer_id": 135970, "author": "Sudeep K Rana", "author_id": 47179, "author_profile": "https://wordpress.stackexchange.com/users/47179", "pm_score": 0, "selected": false, "text": "<p>I tried your code and resetting permalink is behaving abnormal. But I have noticed a weird behavior whi...
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135733", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35268/" ]
For now, I am not using NextGen Gallery. For now I am adding `class="fancybox"` and `rel="gallery"` to each image and it opens all images within a page in fancybox. However, client wants to start using it. I have to figure out if it can be used also for this purpose. Can I use NextGEN Gallery for this scenario: * I h...
Short answer ------------ Add this to your `functions.php` file or wherever you have the rest of this code, assuming this is all in your theme. If this is a plugin, the first two lines need to happen on `setup_theme`, so you need to hook into that action. Also, if it were me, I'd put everything into a class. If you d...
135,739
<p>I need to add a small bit of JavaScript to the <code>&lt;head&gt;</code> section of my site (on every page). I thought Widgets would cover this but I am only able to add widgets to the sidebar and nowhere else.</p> <p>I've searched around a bit and <a href="https://stackoverflow.com/questions/5849057/adding-script-...
[ { "answer_id": 135970, "author": "Sudeep K Rana", "author_id": 47179, "author_profile": "https://wordpress.stackexchange.com/users/47179", "pm_score": 0, "selected": false, "text": "<p>I tried your code and resetting permalink is behaving abnormal. But I have noticed a weird behavior whi...
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135739", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5445/" ]
I need to add a small bit of JavaScript to the `<head>` section of my site (on every page). I thought Widgets would cover this but I am only able to add widgets to the sidebar and nowhere else. I've searched around a bit and [one solution on Stack Overflow](https://stackoverflow.com/questions/5849057/adding-script-to-...
Short answer ------------ Add this to your `functions.php` file or wherever you have the rest of this code, assuming this is all in your theme. If this is a plugin, the first two lines need to happen on `setup_theme`, so you need to hook into that action. Also, if it were me, I'd put everything into a class. If you d...
135,747
<p>I have one custom taxonomy with countries and states. I'd like to make these terms translatable but I'm not sure what would be the best way to achieve this. First of all, I don't want the slugs to change, only the label, and maybe the description strings.</p> <p>I thought of two ways. One could be using WPML. But W...
[ { "answer_id": 137178, "author": "Simon", "author_id": 10889, "author_profile": "https://wordpress.stackexchange.com/users/10889", "pm_score": 3, "selected": true, "text": "<p>I'm not really up to date on WPML and how it handles translations, but my general understanding is that in most ...
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135747", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8421/" ]
I have one custom taxonomy with countries and states. I'd like to make these terms translatable but I'm not sure what would be the best way to achieve this. First of all, I don't want the slugs to change, only the label, and maybe the description strings. I thought of two ways. One could be using WPML. But WPML seems ...
I'm not really up to date on WPML and how it handles translations, but my general understanding is that in most cases it simply creates duplicate entries for each language and links them together with the "original". However, I recently hade a similar problem where I needed the ability to add a "pluralized" version of...
135,750
<p>I have added some custom post status to WordPress, I can able display in New and Edit interfaces of POST. I would like to display those to quick edit too. Also I need to apply some condition to display custom status, I will explain with example.</p> <p>Example : I have created status below 1)status-1 2)status-2</p>...
[ { "answer_id": 135753, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 1, "selected": false, "text": "<p>Unfortunately there are no filters or actions for modifying the post status select in quick edit (<code>WP...
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135750", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45445/" ]
I have added some custom post status to WordPress, I can able display in New and Edit interfaces of POST. I would like to display those to quick edit too. Also I need to apply some condition to display custom status, I will explain with example. Example : I have created status below 1)status-1 2)status-2 "status-1" a...
Unfortunately there are no filters or actions for modifying the post status select in quick edit (`WP_Posts_List_Table::inline_edit()`) - you'd need to resort to JavaScript: ``` (function($){ $( "select[name=_status]" ).each( function () { var value = $( this ).val(); if ( value ===...
135,772
<p>On every page of my site I got a contact form that will send an email to the respective address. On this site also I've set the front page display to a static page.</p> <p>The contact form will basically post to self and if successful will take the user to a new page, otherwise will anchor down to the contact form ...
[ { "answer_id": 135775, "author": "Steven Jones", "author_id": 24124, "author_profile": "https://wordpress.stackexchange.com/users/24124", "pm_score": 3, "selected": true, "text": "<p>When posting a form, if you use 'name' as an input name then there seems to be a problem with submitting....
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135772", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8996/" ]
On every page of my site I got a contact form that will send an email to the respective address. On this site also I've set the front page display to a static page. The contact form will basically post to self and if successful will take the user to a new page, otherwise will anchor down to the contact form and displa...
When posting a form, if you use 'name' as an input name then there seems to be a problem with submitting. Try changing: ``` <input type="text" name="name" class="form-contact__text" /> ``` to: ``` <input type="text" name="the_name" class="form-contact__text" /> ``` Also, best to give your submit button a more un...
135,774
<p>Is it possible to put sections within sections at all? It would be very helpful for me to be able to do so due to having several options per section and I don't want the user to be overloaded with information.</p>
[ { "answer_id": 135775, "author": "Steven Jones", "author_id": 24124, "author_profile": "https://wordpress.stackexchange.com/users/24124", "pm_score": 3, "selected": true, "text": "<p>When posting a form, if you use 'name' as an input name then there seems to be a problem with submitting....
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135774", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48085/" ]
Is it possible to put sections within sections at all? It would be very helpful for me to be able to do so due to having several options per section and I don't want the user to be overloaded with information.
When posting a form, if you use 'name' as an input name then there seems to be a problem with submitting. Try changing: ``` <input type="text" name="name" class="form-contact__text" /> ``` to: ``` <input type="text" name="the_name" class="form-contact__text" /> ``` Also, best to give your submit button a more un...
135,785
<p>I have a voting function for comments which needs to display the avatars of the users who voted for a specific comment. I am having trouble getting the user id of the voter ($supporter). All I seem to get is the user ID of the user who made the comment > I need to get the user ID of the user who voted.</p> <p>My fu...
[ { "answer_id": 135775, "author": "Steven Jones", "author_id": 24124, "author_profile": "https://wordpress.stackexchange.com/users/24124", "pm_score": 3, "selected": true, "text": "<p>When posting a form, if you use 'name' as an input name then there seems to be a problem with submitting....
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135785", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17038/" ]
I have a voting function for comments which needs to display the avatars of the users who voted for a specific comment. I am having trouble getting the user id of the voter ($supporter). All I seem to get is the user ID of the user who made the comment > I need to get the user ID of the user who voted. My function: ...
When posting a form, if you use 'name' as an input name then there seems to be a problem with submitting. Try changing: ``` <input type="text" name="name" class="form-contact__text" /> ``` to: ``` <input type="text" name="the_name" class="form-contact__text" /> ``` Also, best to give your submit button a more un...
135,820
<p>I'm trying to merge 2 WP_Query in a new WP_Query and then order all posts in this new merged query by date descending. I can merge 2 WP_Query and work fine, but I can't order the new query</p> <pre><code> $args1 = array( 'posts_per_page' =&gt; '10', 'post_status' =&gt; 'publish', ...
[ { "answer_id": 135822, "author": "Shazzad", "author_id": 42967, "author_profile": "https://wordpress.stackexchange.com/users/42967", "pm_score": 4, "selected": true, "text": "<p>A better approach could be using three queries. First two query retrieve the post ids, and third one query pos...
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135820", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48098/" ]
I'm trying to merge 2 WP\_Query in a new WP\_Query and then order all posts in this new merged query by date descending. I can merge 2 WP\_Query and work fine, but I can't order the new query ``` $args1 = array( 'posts_per_page' => '10', 'post_status' => 'publish', 'post_type...
A better approach could be using three queries. First two query retrieve the post ids, and third one query post by ids. ``` // first query $first_ids = get_posts( array( 'fields' => 'ids', 'posts_per_page' => '10', 'post_status' => 'publish', 'post_type' => array('news','partners'), ...
135,821
<p>I have a shortcode that displays recent WooCommerce products in a carousel, however i would like the end user to be able to use the shortcode multiple times on the same page, currently when this happens the jQuery carousel has conflicts.</p> <p>Here is the code i'm using for the shortcode,</p> <pre><code>function ...
[ { "answer_id": 135876, "author": "Steven Jones", "author_id": 24124, "author_profile": "https://wordpress.stackexchange.com/users/24124", "pm_score": 0, "selected": false, "text": "<p>Providing everything else is working - in order to use an ID to target the slider it must be unique. The...
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135821", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8776/" ]
I have a shortcode that displays recent WooCommerce products in a carousel, however i would like the end user to be able to use the shortcode multiple times on the same page, currently when this happens the jQuery carousel has conflicts. Here is the code i'm using for the shortcode, ``` function recent_products_slide...
I am not a jQuery expert, but I ran into the same problem and I believe I have a workable solution. The problem is that each time you run wp\_localize\_script it creates a javascript variable using the $name setting. In your case that is 'carouselvars'. As this is set before the jQuery in run, only the last values pass...
135,830
<p>I dont get why this isnt working. I have a custom page template, page-politics.php. It should look similar to this page: </p> <p><img src="https://i.stack.imgur.com/MXR0q.png" alt="banking transaction page"></p> <p>But its displaying this:</p> <p><img src="https://i.stack.imgur.com/AfSZW.png" alt="campaign contri...
[ { "answer_id": 135833, "author": "socki03", "author_id": 43511, "author_profile": "https://wordpress.stackexchange.com/users/43511", "pm_score": 0, "selected": false, "text": "<p>I don't know if what's showing up on that page are your posts or not, but you should check your settings to s...
2014/02/24
[ "https://wordpress.stackexchange.com/questions/135830", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47366/" ]
I dont get why this isnt working. I have a custom page template, page-politics.php. It should look similar to this page: ![banking transaction page](https://i.stack.imgur.com/MXR0q.png) But its displaying this: ![campaign contribution page](https://i.stack.imgur.com/AfSZW.png) Ive double, triple checked that the r...
This is less of an answer and more of a kind of troubleshooting aid... Add this function to your project (probably `functions.php`) and then call it from the top of every template file in your theme... ``` /** * Outputs the name of the file as an HTML comment for easy-peesy troubleshooting. * * @param string $file ...
135,857
<p>I need to know the list of hooks that are called in the current page . How to identify the priority assigned to the action and filters in the action . If i want to remove the default action on word-press . It cause any error ? May i overwrite the default action that to be execute? </p> <pre><code>add_filter( $tag,...
[ { "answer_id": 135858, "author": "czerspalace", "author_id": 47406, "author_profile": "https://wordpress.stackexchange.com/users/47406", "pm_score": 2, "selected": false, "text": "<p>The lower priority numbers are executed first, higher numbers last</p>\n" }, { "answer_id": 13586...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135857", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47843/" ]
I need to know the list of hooks that are called in the current page . How to identify the priority assigned to the action and filters in the action . If i want to remove the default action on word-press . It cause any error ? May i overwrite the default action that to be execute? ``` add_filter( $tag, $function_to_a...
Paste this into your functions.php ``` //LIST ALL HOOKS function dump_hook( $tag, $hook ) { ksort($hook); echo "<pre>>>>>>\t$tag<br>"; foreach( $hook as $priority => $functions ) { echo $priority; foreach( $functions as $function ) if( $function['function'] != 'list_hook_details' ) { ...
135,866
<p>I have translated many string successfully previously, but this one gives me a headache. This part is used inside my content-related.php file which I use to display related posts</p> <p>Here is the current string I'm using</p> <p><code>&lt;?php echo 'Click &lt;a href="'. esc_url( get_permalink() ) . '"&gt;here&lt;...
[ { "answer_id": 135868, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 3, "selected": true, "text": "<p>Possible solution to get everything translatable as one sting.</p>\n\n<pre><code>&lt;?php printf(__('Click...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135866", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31545/" ]
I have translated many string successfully previously, but this one gives me a headache. This part is used inside my content-related.php file which I use to display related posts Here is the current string I'm using `<?php echo 'Click <a href="'. esc_url( get_permalink() ) . '">here</a> to go and wacth the video.' ?>...
Possible solution to get everything translatable as one sting. ``` <?php printf(__('Click <a href="%s">Here</a> to go and wacth the video.', 'pietergoosen'), esc_url( get_permalink() )); ?> ``` It is usually safe to assume that the translator have enough knowledge of HTML to understand what is going on there.
135,869
<p>So as the title suggests, I'm trying to run blur.js on my WordPress theme. I have enqueued the script in functions.php:</p> <pre><code> function load_oves_methods(){ wp_enqueue_script( 'blur', get_stylesheet_directory_uri() . '/js/blur.js', array('jquery') ); wp_enqueue_script( 'flexcroll', get_styleshee...
[ { "answer_id": 135879, "author": "NextGenThemes", "author_id": 38602, "author_profile": "https://wordpress.stackexchange.com/users/38602", "pm_score": 1, "selected": false, "text": "<ul>\n<li>First triple check your file and path names for spelling mistakes.</li>\n<li>Then check the perm...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135869", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48124/" ]
So as the title suggests, I'm trying to run blur.js on my WordPress theme. I have enqueued the script in functions.php: ``` function load_oves_methods(){ wp_enqueue_script( 'blur', get_stylesheet_directory_uri() . '/js/blur.js', array('jquery') ); wp_enqueue_script( 'flexcroll', get_stylesheet_directory_ur...
* First triple check your file and path names for spelling mistakes. * Then check the permissions of the .js file * Then take the URL from your source and open it in your browser first without the `?ver=3.8.1`. Do you get a 404 in your browser as well? Then you say you call your script after the head. How exactly? Man...
135,874
<p>I would like to add a custom link to the footer section of the register form.</p> <p>How can I do this?</p> <p>I am using the <code>login_footer</code> hook:</p> <pre><code>add_action( 'login_footer',array($this, 'add_forum_menu'), 50, 2 ); function add_forum_menu() { //need code to append the new items on th...
[ { "answer_id": 135878, "author": "Win More", "author_id": 45710, "author_profile": "https://wordpress.stackexchange.com/users/45710", "pm_score": 3, "selected": true, "text": "<p>I was looking at the wp-login.php file and noticed that there's an action location :</p>\n\n<pre><code>&lt;?p...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135874", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47843/" ]
I would like to add a custom link to the footer section of the register form. How can I do this? I am using the `login_footer` hook: ``` add_action( 'login_footer',array($this, 'add_forum_menu'), 50, 2 ); function add_forum_menu() { //need code to append the new items on the menu ) ); ``` ![enter image descri...
I was looking at the wp-login.php file and noticed that there's an action location : ``` <?php do_action('login_footer'); ?> ``` available... to use. So ``` add_action('login_footer', 'my_addition_to_login_footer'); function my_addition_to_login_footer() { echo '<div style="text-align: center;"><a href="#">lin...
135,899
<p>Ok here we go. I have 2 different custom post types. The first is called 'portfolio', the second one 'games'. </p> <p>All the game reviews I write are 'games' posts. To have a better overview I created custom categories like reviews, playstation xbox etc. Unfortunately everytime I would like to display the posts of...
[ { "answer_id": 135900, "author": "Panagiotis", "author_id": 17795, "author_profile": "https://wordpress.stackexchange.com/users/17795", "pm_score": 0, "selected": false, "text": "<p>Put hierarchical=false (in the post type) if you have a wordpress > 3.6. I think there is a bug that preve...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135899", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48138/" ]
Ok here we go. I have 2 different custom post types. The first is called 'portfolio', the second one 'games'. All the game reviews I write are 'games' posts. To have a better overview I created custom categories like reviews, playstation xbox etc. Unfortunately everytime I would like to display the posts of one categ...
Put hierarchical=false (in the post type) if you have a wordpress > 3.6. I think there is a bug that prevents the taxonomies to work correct, I've used that trick to my cpt / custom taxonomy and it works ok.
135,908
<p>I have a custom post type 'speakers' and I have a checkbox custom field (meta_query) to separate my Conference speakers from my Workshop speakers. </p> <p>I can filter my speakers with this meta_query and things are working fine. But how do I use a different sidebar based on the Conference or Workshop speaker meta_...
[ { "answer_id": 135909, "author": "user42826", "author_id": 42826, "author_profile": "https://wordpress.stackexchange.com/users/42826", "pm_score": 2, "selected": false, "text": "<p>WP multisite (subdomain) is the answer - <a href=\"http://codex.wordpress.org/Create_A_Network\" rel=\"nofo...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135908", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27463/" ]
I have a custom post type 'speakers' and I have a checkbox custom field (meta\_query) to separate my Conference speakers from my Workshop speakers. I can filter my speakers with this meta\_query and things are working fine. But how do I use a different sidebar based on the Conference or Workshop speaker meta\_query? ...
WP multisite (subdomain) is the answer - <http://codex.wordpress.org/Create_A_Network> In addition you can install the [WP Domain Mapping Plugin](http://wordpress.org/plugins/wordpress-mu-domain-mapping/) to run on other domains You need to decide whether you want WP multisite subdomain or sub-directory installation....
135,913
<p>I am running code that shows child categories, and all posts in the child categories. But if there are more than 5 posts in a category, only the 5 newest are shown.</p> <p>How can I show all, or at least set a number like 9 posts etc.?</p> <p>My code:</p> <pre><code>&lt;?php $args = array( 'child_of' =&gt; 1...
[ { "answer_id": 135914, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 2, "selected": false, "text": "<p>You've to make use of the <code>post_per_page</code> or <code>numberposts</code> parameter of <a hr...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135913", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14416/" ]
I am running code that shows child categories, and all posts in the child categories. But if there are more than 5 posts in a category, only the 5 newest are shown. How can I show all, or at least set a number like 9 posts etc.? My code: ``` <?php $args = array( 'child_of' => 1 ); $categories = get_categories( $...
I think you could use the `posts_per_page` argument in your `get_posts` query: ``` $args = array( 'child_of' => 1 ); $categories = get_categories( $args ); foreach ($categories as $category) { echo '<li><a>'.$category->name.'</a>'; echo '<ul>'; $posts_args = array( 'posts_per_page' => 9, ...