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
105,761
<p>Sorry if this is a simple/daft question but I'm still getting to grips with how WordPress search functions.</p> <p>I want to completely replace the standard search within my template with a custom search that only queries a certain custom post type and its meta fields. I have a search form which does this and searc...
[ { "answer_id": 105734, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 3, "selected": true, "text": "<p>See those two hooks in the hacked Core code you posted?</p>\n\n<pre><code>do_action('save_post', $post_ID, $p...
2013/07/08
[ "https://wordpress.stackexchange.com/questions/105761", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35032/" ]
Sorry if this is a simple/daft question but I'm still getting to grips with how WordPress search functions. I want to completely replace the standard search within my template with a custom search that only queries a certain custom post type and its meta fields. I have a search form which does this and search.php whic...
See those two hooks in the hacked Core code you posted? ``` do_action('save_post', $post_ID, $post); do_action('wp_insert_post', $post_ID, $post); ``` Those are what you need to use to do this right. ``` function run_on_update_post($post_ID, $post) { var_dump($post_ID, $post); // debug include '../push/sen...
105,771
<p>I <strong>unchecked</strong> both options in the <code>discussion</code> area <em>(so the one where they need a post to comment and administrator has to approve)</em>, but still, my users can't put their comments without me approving it.</p> <p>Has someone a solution for this glitch? Why on earth can't they post a ...
[ { "answer_id": 105734, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 3, "selected": true, "text": "<p>See those two hooks in the hacked Core code you posted?</p>\n\n<pre><code>do_action('save_post', $post_ID, $p...
2013/07/08
[ "https://wordpress.stackexchange.com/questions/105771", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34977/" ]
I **unchecked** both options in the `discussion` area *(so the one where they need a post to comment and administrator has to approve)*, but still, my users can't put their comments without me approving it. Has someone a solution for this glitch? Why on earth can't they post a comment? And if they post one, the second...
See those two hooks in the hacked Core code you posted? ``` do_action('save_post', $post_ID, $post); do_action('wp_insert_post', $post_ID, $post); ``` Those are what you need to use to do this right. ``` function run_on_update_post($post_ID, $post) { var_dump($post_ID, $post); // debug include '../push/sen...
105,778
<p>I'm developing a theme for wordpress and I'm using this function to enqueue scripts and styles</p> <pre><code>function Joy_scripts() { wp_enqueue_style( 'Joy-style'); wp_enqueue_script( 'Joy-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '1.0', true ); if ( is_singular() &amp;&amp;...
[ { "answer_id": 105779, "author": "thomascharbit", "author_id": 35003, "author_profile": "https://wordpress.stackexchange.com/users/35003", "pm_score": 3, "selected": true, "text": "<p>For jQuery, Wordpress uses the jQuery.noConflict() so \"$\" is not a reference to jQuery.\n- You can use...
2013/07/08
[ "https://wordpress.stackexchange.com/questions/105778", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35059/" ]
I'm developing a theme for wordpress and I'm using this function to enqueue scripts and styles ``` function Joy_scripts() { wp_enqueue_style( 'Joy-style'); wp_enqueue_script( 'Joy-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '1.0', true ); if ( is_singular() && wp_attachment_is_imag...
For jQuery, Wordpress uses the jQuery.noConflict() so "$" is not a reference to jQuery. - You can use jQuery() insteand of $() - or define $, for example you can wrap your code like this : ``` jQuery(function($) { // your jQ code }); ``` For your CSS at the bottom of the document : do you call wp\_head() in yo...
105,794
<p>How can we add <code>#</code> before each tag with both <a href="http://codex.wordpress.org/Function_Reference/the_tags" rel="nofollow"><code>the_tags( )</code></a> and <a href="http://codex.wordpress.org/Function_Reference/wp_tag_cloud" rel="nofollow"><code>wp_tag_cloud( )</code></a>?</p>
[ { "answer_id": 105814, "author": "thomascharbit", "author_id": 35003, "author_profile": "https://wordpress.stackexchange.com/users/35003", "pm_score": 2, "selected": false, "text": "<p>You will have to use your own custom function, the_tags( ) doesn't allow you to do that.\nYou could cre...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105794", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34434/" ]
How can we add `#` before each tag with both [`the_tags( )`](http://codex.wordpress.org/Function_Reference/the_tags) and [`wp_tag_cloud( )`](http://codex.wordpress.org/Function_Reference/wp_tag_cloud)?
You will have to use your own custom function, the\_tags( ) doesn't allow you to do that. You could create a function like this, using get\_the\_tags, and format your html as you prefer : ``` function hashtags() { $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { ech...
105,795
<p>I have been trying to find a solution. but I can't..</p> <p>my links are all <code>domain.com/index.php/post_name/</code></p> <p>I really want to remove <code>/index.php</code></p> <p>I have searched and found some... saying I need to add these.. but it's not working ..</p> <pre><code># BEGIN WordPress &lt;IfMod...
[ { "answer_id": 105809, "author": "Shahinul Islam", "author_id": 34971, "author_profile": "https://wordpress.stackexchange.com/users/34971", "pm_score": 6, "selected": true, "text": "<p>Go to your WP-ADMIN-->Settings-->Permalink and use the permalink structure change there, if it generate...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105795", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34463/" ]
I have been trying to find a solution. but I can't.. my links are all `domain.com/index.php/post_name/` I really want to remove `/index.php` I have searched and found some... saying I need to add these.. but it's not working .. ``` # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRul...
Go to your WP-ADMIN-->Settings-->Permalink and use the permalink structure change there, if it generate any `.htaccess` file copy the content and update your `.htaccess` file. Or Check if your hosting `mod_rewrite` is enable by creating a file `phpinfo.php` with content, ``` <?php phpinfo();?> ``` Upload this fil...
105,808
<p>I want to show a list of articles, but I want to show in the 1st place my second article and after it the last.</p> <p><em>Eg: Article 1 Article 2 Article 3 Article 4 to be: Article 2 Article 1 Article 3 Article 4</em></p> <p>I'm using this while loop:</p> <pre><code>&lt;?php $i = 0; $the_query = new WP_Query( 's...
[ { "answer_id": 105812, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": true, "text": "<p>Prepare the query before you loop over it:</p>\n\n<pre><code>$first = array_shift( $the_query-&gt;posts );\n$second =...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105808", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35040/" ]
I want to show a list of articles, but I want to show in the 1st place my second article and after it the last. *Eg: Article 1 Article 2 Article 3 Article 4 to be: Article 2 Article 1 Article 3 Article 4* I'm using this while loop: ``` <?php $i = 0; $the_query = new WP_Query( 'showposts=35&offset=0' ); while ($the_q...
Prepare the query before you loop over it: ``` $first = array_shift( $the_query->posts ); $second = array_shift( $the_query->posts ); // now re-add in reverse order array_unshift( $the_query->posts, $first ); array_unshift( $the_query->posts, $second ); // this is now the first item while ($the_query -> have_posts(...
105,817
<p>The code below wants to show a list of articles in two collumns. </p> <pre><code> &lt;?php $i = 0; $the_query = new WP_Query( 'showposts=35&amp;offset=0' ); while ($the_query -&gt; have_posts()) : $the_query -&gt; the_post(); $i++; ?&gt; &lt;?php if ($i == "1") { ?&gt; &lt;div style=...
[ { "answer_id": 105818, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 2, "selected": true, "text": "<p>Separate the posts in two different arrays, then loop over both separately:</p>\n\n<pre><code>$columns = array ( ...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105817", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35040/" ]
The code below wants to show a list of articles in two collumns. ``` <?php $i = 0; $the_query = new WP_Query( 'showposts=35&offset=0' ); while ($the_query -> have_posts()) : $the_query -> the_post(); $i++; ?> <?php if ($i == "1") { ?> <div style="padding-top: 10px; float: left; width:...
Separate the posts in two different arrays, then loop over both separately: ``` $columns = array ( 'first' => array (), 'second' => array () ); $first_column = array( 1, 3, 4, 5, 6, 7 ); // separation foreach ( $the_query->posts as $index => $post ) { if ( in_array( $index + 1, $first_column ) ) $col...
105,825
<p>I have the following html code: </p> <pre><code>&lt;script src="js/jquery.vmap.js"&gt;&lt;/script&gt; &lt;script src="js/jquery.vmap.world.js"&gt;&lt;/script&gt; &lt;script src="js/jquery.vmap.sampledata.js"&gt;&lt;/script&gt; &lt;script&gt; jQuery('#vmap').vectorMap({ map: 'world_en', backgroundColor: nul...
[ { "answer_id": 105831, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 2, "selected": true, "text": "<p>For your purpose <em>enqueue</em> is the key:</p>\n\n<ul>\n<li><a href=\"http://codex.wordpress.org/Fun...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105825", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35042/" ]
I have the following html code: ``` <script src="js/jquery.vmap.js"></script> <script src="js/jquery.vmap.world.js"></script> <script src="js/jquery.vmap.sampledata.js"></script> <script> jQuery('#vmap').vectorMap({ map: 'world_en', backgroundColor: null, color: '#ffffff', hoverOpacity: 0.7, sele...
For your purpose *enqueue* is the key: * [`wp_enqueue_script()`](http://codex.wordpress.org/Function_Reference/wp_enqueue_script) * [`wp_enqueue_style()`](http://codex.wordpress.org/Function_Reference/wp_enqueue_style) You can consult this question: **[How to enqueue the style using wp\_enqueue\_style()](https://word...
105,856
<p>I have created a custom post type called "faq". The custom post type uses categories. I have created a shortcode [faq] that displays all the faq posts. </p> <p>What I would like to do is add an attribute to the shortcode that specifies an faq category. So instead of using the shortcode [faq] it would be something l...
[ { "answer_id": 105857, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 3, "selected": true, "text": "<pre><code>add_shortcode( 'faq', 'wpse105856_shortcode_callback' );\n\nfunction wpse105856_shortcode_callbac...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105856", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/29158/" ]
I have created a custom post type called "faq". The custom post type uses categories. I have created a shortcode [faq] that displays all the faq posts. What I would like to do is add an attribute to the shortcode that specifies an faq category. So instead of using the shortcode [faq] it would be something like [faq c...
``` add_shortcode( 'faq', 'wpse105856_shortcode_callback' ); function wpse105856_shortcode_callback( $atts ) { extract( shortcode_atts( array( 'category' => '' ), $atts ) ); $args = array( 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type'...
105,866
<p>Condition: some post have meta_key 'status'. Please help me in with this condition: sql query for those post who don't have meta_key 'status'</p>
[ { "answer_id": 105868, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>Pure SQL questions are off-topic but beyond that, pure SQL is dangerous because it may break if the WordPres...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105866", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31989/" ]
Condition: some post have meta\_key 'status'. Please help me in with this condition: sql query for those post who don't have meta\_key 'status'
Pure SQL questions are off-topic but beyond that, pure SQL is dangerous because it may break if the WordPress Core changes the database structure. You are better off using Core tools where possible. In this case, [`WP_Query`](http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters) can do what you...
105,873
<p>I'm learning my ways in PHP lately and play allot with WP and PHP. I've created a some PHP that fetches some posts with the same 1th tag. This with some help with a tutorial here and there. The thing the tutorial is missing is a message when there is no tag attached to the post.</p> <p>Here is the code:</p> <pre><...
[ { "answer_id": 105877, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": true, "text": "<p>There is no <a href=\"https://stackoverflow.com/a/14951790/1735890\"><code>while/else</code> in PHP</a> that ...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105873", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34030/" ]
I'm learning my ways in PHP lately and play allot with WP and PHP. I've created a some PHP that fetches some posts with the same 1th tag. This with some help with a tutorial here and there. The thing the tutorial is missing is a message when there is no tag attached to the post. Here is the code: ``` <?php $tags = wp...
There is no [`while/else` in PHP](https://stackoverflow.com/a/14951790/1735890) that I know of. Second, I find ["alternate" control structure syntax](http://php.net/manual/en/control-structures.alternative-syntax.php) impossible to read, especially with two or three on the same line. Use brackets and properly indent ...
105,874
<p>I have an existing application running at my website root now. Using .htaccess, would it be possible for a single Wordpress installation to manage sub-directories? For example, /press/, /careers/, /blog/ would be served by Wordpress. The problem is I don't want Wordpress to get served on the root. I suspect somethin...
[ { "answer_id": 105877, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": true, "text": "<p>There is no <a href=\"https://stackoverflow.com/a/14951790/1735890\"><code>while/else</code> in PHP</a> that ...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105874", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/730/" ]
I have an existing application running at my website root now. Using .htaccess, would it be possible for a single Wordpress installation to manage sub-directories? For example, /press/, /careers/, /blog/ would be served by Wordpress. The problem is I don't want Wordpress to get served on the root. I suspect something t...
There is no [`while/else` in PHP](https://stackoverflow.com/a/14951790/1735890) that I know of. Second, I find ["alternate" control structure syntax](http://php.net/manual/en/control-structures.alternative-syntax.php) impossible to read, especially with two or three on the same line. Use brackets and properly indent ...
105,881
<p>I'm new to wordpress but have knowledge in php and javascript.</p> <p>I read a lot of blogs about ajax call in wordpress. I also read some posts on this forum. However, I still have some difficulties making an ajax call with wordpress.</p> <p>It's a little confusing in my mind where <code>add_action</code> and hoo...
[ { "answer_id": 105888, "author": "livearoha", "author_id": 25235, "author_profile": "https://wordpress.stackexchange.com/users/25235", "pm_score": 2, "selected": true, "text": "<p>In your functions.php file you should add an action to enqueue your scripts.</p>\n\n<pre><code>&lt;?php\nfun...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105881", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35097/" ]
I'm new to wordpress but have knowledge in php and javascript. I read a lot of blogs about ajax call in wordpress. I also read some posts on this forum. However, I still have some difficulties making an ajax call with wordpress. It's a little confusing in my mind where `add_action` and hook must be written (inside my...
In your functions.php file you should add an action to enqueue your scripts. ``` <?php function my_enqueue_scripts() { wp_enqueue_script( 'load_post', get_template_directory_uri() . '/js/load_post.js', array( 'jquery' ), '1.0', 1 ); wp_localize_script( '...
105,883
<p>I need to add line breaks to the nav menu item titles. I didn't realize this was a problem as when I am logged in as a Super Admin, I can add <code>&lt;br/&gt;</code> just fine, but apparently regular-level admins cannot.</p> <p>I've read over this post <a href="https://wordpress.stackexchange.com/questions/51609/...
[ { "answer_id": 105895, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Sans turning sanitization logic inside out or coding custom interface for it... I would just designate some safe ch...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105883", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6477/" ]
I need to add line breaks to the nav menu item titles. I didn't realize this was a problem as when I am logged in as a Super Admin, I can add `<br/>` just fine, but apparently regular-level admins cannot. I've read over this post [Custom Menus Description Stripping HTML Tags](https://wordpress.stackexchange.com/questi...
Following the hint from @Rarst regarding safe characters here's what I ended up doing: ``` function wpa_105883_menu_title_markup( $title, $id ){ if ( is_nav_menu_item ( $id ) && ! is_admin() ){ $title = preg_replace( '/#BR#/', '<br/>', $title ); } return $title; } add_filter( 'the_title', 'wpa_1058...
105,894
<p>I'm trying to list categories for my posts on the home page with each of their posts under them. I'm not really sure how to go about doing this.</p> <p>Example of what I want.</p> <h2>Category 1</h2> <p>Post 1 - Post 2 - Post 3 - Post 4</p> <h2>Category 2</h2> <p>Post 1 - Post 2 - Post 3 - Post 4</p> <h2>Categ...
[ { "answer_id": 105896, "author": "JMau", "author_id": 31376, "author_profile": "https://wordpress.stackexchange.com/users/31376", "pm_score": 1, "selected": false, "text": "<p>I would say you have to run queries by category name or category ID, use <a href=\"http://codex.wordpress.org/Cl...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105894", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/29073/" ]
I'm trying to list categories for my posts on the home page with each of their posts under them. I'm not really sure how to go about doing this. Example of what I want. Category 1 ---------- Post 1 - Post 2 - Post 3 - Post 4 Category 2 ---------- Post 1 - Post 2 - Post 3 - Post 4 Category 3 ---------- Post 1 - P...
I would say you have to run queries by category name or category ID, use [WP\_Query](http://codex.wordpress.org/Class_Reference/WP_Query): ``` $query = new WP_Query( 'cat=cat_ID', 'posts_per_page' => 4 ); ``` Maybe [`get_posts()`](http://codex.wordpress.org/Function_Reference/get_posts) is more appropriate in this c...
105,899
<p>I have a People post type with a Person Type taxonomy (e.g. "Staff"). On the Person Type Term Archive pages, I want to sort by a "Sort Name" custom field. To do so, I'm using a <code>pre_get_posts</code> call:</p> <pre><code>&lt;?php function my_query_tweaks( $query ) { // stop immediately if we're in the admi...
[ { "answer_id": 105957, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 1, "selected": false, "text": "<p><code>'meta_key' =&gt; 'keyname'</code> must be part of the query to be able to sort by its value.<br>\n...
2013/07/09
[ "https://wordpress.stackexchange.com/questions/105899", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9844/" ]
I have a People post type with a Person Type taxonomy (e.g. "Staff"). On the Person Type Term Archive pages, I want to sort by a "Sort Name" custom field. To do so, I'm using a `pre_get_posts` call: ``` <?php function my_query_tweaks( $query ) { // stop immediately if we're in the admin or not working with the ma...
`'meta_key' => 'keyname'` must be part of the query to be able to sort by its value. Unfortunately, that will immediately result in the query being limited to posts where the key is set (its value can be empty, but it must exist). Hence, either consider [the method s\_ha\_dum linked to in the question comments](htt...
105,915
<p>I recently added Javascript and CSS files into the wordpress. All the files are being registered through <code>functions.php</code>. One of the files is <code>my_worldmap.js</code> as shown below</p> <pre><code>$(function() { $('#world-map').vectorMap(); }); </code></pre> <p>The issue here, the above function ...
[ { "answer_id": 105903, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 0, "selected": false, "text": "<p>I presume your blog is set to show at most 7 posts per page. Try going to Settings>Reading and adjust t...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/105915", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35042/" ]
I recently added Javascript and CSS files into the wordpress. All the files are being registered through `functions.php`. One of the files is `my_worldmap.js` as shown below ``` $(function() { $('#world-map').vectorMap(); }); ``` The issue here, the above function is called as soon as I visit the homepage. My ex...
The solution was to make a custom query with a posts\_per\_page argument to the desired number of posts.
105,926
<p>I need to retrieve an ACF field within the post, and change the slug(permalink) of the post before saving it to database. What is the approach to achieve that? I need the slug to be changed every create/edit post operations.</p>
[ { "answer_id": 105936, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 6, "selected": true, "text": "<p>The following is to be taken more as a proof of concept rather than a copy/paste-ready solution.<br>\nTha...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/105926", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15112/" ]
I need to retrieve an ACF field within the post, and change the slug(permalink) of the post before saving it to database. What is the approach to achieve that? I need the slug to be changed every create/edit post operations.
The following is to be taken more as a proof of concept rather than a copy/paste-ready solution. That being said, this is how you'd go about it: The [`save_post`](http://codex.wordpress.org/Plugin_API/Action_Reference/save_post) [action](http://codex.wordpress.org/Plugin_API/Action_Reference) runs whenever a post i...
105,931
<p>Description of the problem:</p> <p>I should make a blog with, let's say 4 authors (may be more).<br> The blog shoud have a page 'blog-page-1' (without sidebar) on which will be the last post of each author and a page 'blog-page-2' (with sidebar) on which will be diplayed only posts of a specific author, depends on ...
[ { "answer_id": 105936, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 6, "selected": true, "text": "<p>The following is to be taken more as a proof of concept rather than a copy/paste-ready solution.<br>\nTha...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/105931", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35115/" ]
Description of the problem: I should make a blog with, let's say 4 authors (may be more). The blog shoud have a page 'blog-page-1' (without sidebar) on which will be the last post of each author and a page 'blog-page-2' (with sidebar) on which will be diplayed only posts of a specific author, depends on which post ...
The following is to be taken more as a proof of concept rather than a copy/paste-ready solution. That being said, this is how you'd go about it: The [`save_post`](http://codex.wordpress.org/Plugin_API/Action_Reference/save_post) [action](http://codex.wordpress.org/Plugin_API/Action_Reference) runs whenever a post i...
105,934
<p>Obviously, I know I can't have two single.php files. The one with the comments would have to have a different name...maybe single-comments.php or something.</p> <p>I am working on a restaurant reviews site and because of lack of space on the page, I have decided to show some excerpts of the latest comments (custome...
[ { "answer_id": 105976, "author": "Vigs", "author_id": 33573, "author_profile": "https://wordpress.stackexchange.com/users/33573", "pm_score": 3, "selected": true, "text": "<p>Create a page template to display the comments for the particular \"review\" aka post. </p>\n\n<p>Then you can li...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/105934", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10241/" ]
Obviously, I know I can't have two single.php files. The one with the comments would have to have a different name...maybe single-comments.php or something. I am working on a restaurant reviews site and because of lack of space on the page, I have decided to show some excerpts of the latest comments (customer reviews)...
Create a page template to display the comments for the particular "review" aka post. Then you can link to that page and include the post ID in the url and $\_GET the post ide from the url on the new page, then query the post and display its comments. This should point you in the right direction atleast. The Final T...
105,937
<p>I have a Problem with grouping meta_values. The Query looks for posts with the meta key "company". I want a unique listing of the colors like: blue red yellow</p> <p>array_unique was not successful and also custom mysql query.</p> <pre><code>&lt;?php $args = array( 'category_name' =&gt; $cat_name, 'p...
[ { "answer_id": 105939, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 0, "selected": false, "text": "<p>Take a look at the codex page for the <a href=\"http://codex.wordpress.org/Class_Reference/WP_Query\" re...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/105937", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35118/" ]
I have a Problem with grouping meta\_values. The Query looks for posts with the meta key "company". I want a unique listing of the colors like: blue red yellow array\_unique was not successful and also custom mysql query. ``` <?php $args = array( 'category_name' => $cat_name, 'posts_per_page' => '60', ...
This is the solution, according to the asker. He used the [`get()`](https://developer.wordpress.org/reference/classes/wp_query/get/) method of the `WP_Query` class to retrieve an array of values (colors), each stored with the meta key `color`. Because `[color] => 'Yellow'` may appear in the array more than once, he the...
105,942
<p>In my posts, you can embed a video of Youtube by adding the link to the post. You don't have to do anything beside that.</p> <p>On my comments, I can't do the same thing. Is it possible to embed Youtube video's by putting the link only (or a different manner, but I prefer the first), and if so, how?</p>
[ { "answer_id": 105944, "author": "Ravinder Kumar", "author_id": 29439, "author_profile": "https://wordpress.stackexchange.com/users/29439", "pm_score": 0, "selected": false, "text": "<p>You can use <a href=\"http://jetpack.me/\" rel=\"nofollow\">jetpack plugin</a> for embedding Youtube v...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/105942", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34977/" ]
In my posts, you can embed a video of Youtube by adding the link to the post. You don't have to do anything beside that. On my comments, I can't do the same thing. Is it possible to embed Youtube video's by putting the link only (or a different manner, but I prefer the first), and if so, how?
Just add the comments to oEmbed. Here's a small plugin that you can use as MU-Plugin or normal plugin and that should explain what's going on pretty well. ``` <?php defined( 'ABSPATH' ) or exit; /* Plugin Name: (#105942) oEmbed Comments */ add_filter( 'comment_text', 'wpse_105942_oembed_comments', 0 ); function wpse_...
105,952
<p>I want to get a custom post value from post ID</p> <p>PHP code :</p> <pre><code>$custom_field = get_post_meta(2055, the_field('titdesc')); var_dump($custom_field);` </code></pre> <p>Output :</p> <pre><code>array(6) { ["_edit_last"]=&gt; array(1) { [0]=&gt; string(1) "1" } ["_edit_lock"]=&gt; ar...
[ { "answer_id": 105954, "author": "Kumar", "author_id": 32466, "author_profile": "https://wordpress.stackexchange.com/users/32466", "pm_score": 0, "selected": false, "text": "<p>You should use</p>\n\n<pre><code>echo \"&lt;pre&gt;\";\nprint_r($array_name); //$custom_field in your case\nech...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/105952", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33506/" ]
I want to get a custom post value from post ID PHP code : ``` $custom_field = get_post_meta(2055, the_field('titdesc')); var_dump($custom_field);` ``` Output : ``` array(6) { ["_edit_last"]=> array(1) { [0]=> string(1) "1" } ["_edit_lock"]=> array(1) { [0]=> string(12) "1373450528:1" } ...
I think you messed up a bit. I'm assuming you're using the [ACF plugin](http://www.advancedcustomfields.com/) because you used [`the_field()`](http://www.advancedcustomfields.com/resources/functions/the_field/). Have you tried only `the_field('titdesc');` if you're in the WordPress loop? Those functions already query ...
105,955
<p>I am trying to listing posts from a single category of my custom taxonomy.</p> <p>I have created a custom post type called "news" and a custom taxonomy called "instituteName".</p> <p>I then created a number of categories using the "instituteName" taxonomy.</p> <p>I would now like to display the posts from only a ...
[ { "answer_id": 105956, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>You can do it using custom WP_Query:</p>\n\n<pre><code>$my_query = new WP_Query( array(\n 'post_ty...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/105955", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35123/" ]
I am trying to listing posts from a single category of my custom taxonomy. I have created a custom post type called "news" and a custom taxonomy called "instituteName". I then created a number of categories using the "instituteName" taxonomy. I would now like to display the posts from only a single category. e.g. i ...
You can do it using custom WP\_Query: ``` $my_query = new WP_Query( array( 'post_type'=>'news', 'posts_per_page'=>4, 'tax_query'=>array( array( 'taxonomy'=>'instituteName', 'field'=>'slug', 'terms'=>'businessschool' // change to real slug ) ) ) ); ...
106,016
<p>I have my facebook likes stored in a custom field named fb_likes. my wordpress post order is sorted by this field, like this.</p> <pre><code> 'meta_key' =&gt; 'fb_likes', 'orderby' =&gt; 'meta_value_num', 'order' =&gt; 'DESC', 'ignore_sticky_posts' =&gt; 1, 'posts_per_page' =&gt; $wp_query-&gt;get('posts_per_pa...
[ { "answer_id": 106149, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 1, "selected": false, "text": "<p>As for the edit (leading zeroes):</p>\n\n<pre><code>/* will print \"001\" */\necho sprintf( \"%03d\", 1 ...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/106016", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/30939/" ]
I have my facebook likes stored in a custom field named fb\_likes. my wordpress post order is sorted by this field, like this. ``` 'meta_key' => 'fb_likes', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => 1, 'posts_per_page' => $wp_query->get('posts_per_page'), 'paged' => $paged ``` ...
As for the edit (leading zeroes): ``` /* will print "001" */ echo sprintf( "%03d", 1 ); /* will print "00097" */ echo sprintf( "%05d", 97 ); ``` As for the inital problem: Obviously, I believe your problem description, but if `'orderby' => 'meta_value'` does not produce duplicate results, neither *should* a change...
106,032
<p>As many of you know <a href="http://support.wpengine.com/cookies-and-php-sessions/" rel="noreferrer">WPEngine</a> don't support PHP SESSIONS unless the user is logged in. In that case WPEngine start taking consideration of PHP SESSIONS and the software based on <a href="http://hybridauth.sourceforge.net" rel="norefe...
[ { "answer_id": 106053, "author": "s1lv3r", "author_id": 27536, "author_profile": "https://wordpress.stackexchange.com/users/27536", "pm_score": 3, "selected": true, "text": "<p>You could create a dummy user (with no rights) and log in every visitor using this dummy user. This could be do...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/106032", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4130/" ]
As many of you know [WPEngine](http://support.wpengine.com/cookies-and-php-sessions/) don't support PHP SESSIONS unless the user is logged in. In that case WPEngine start taking consideration of PHP SESSIONS and the software based on [hybridauth](http://hybridauth.sourceforge.net) like [Wordpress Social Login](http://h...
You could create a dummy user (with no rights) and log in every visitor using this dummy user. This could be done pretty easily: ``` wp_set_auth_cookie($uid, true); wp_set_current_user($uid); ``` But in my opinion that's a rather flawy workaround. Your main problem is that all pages for not-logged-in users come fro...
106,033
<p>I have a custom-post-type archive (archive-rg_blog.php) with two loops in it. One of the loops I'd like to filter with the below code. It's just a basic loop for all posts, and I just need to set it to return all posts instead of the custom posts it'd return by default. </p> <p>The other loop needs to pull the titl...
[ { "answer_id": 106038, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<p>Add the filter where you need it and <a href=\"http://codex.wordpress.org/Function_Reference/remove_action\"...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/106033", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9764/" ]
I have a custom-post-type archive (archive-rg\_blog.php) with two loops in it. One of the loops I'd like to filter with the below code. It's just a basic loop for all posts, and I just need to set it to return all posts instead of the custom posts it'd return by default. The other loop needs to pull the title and con...
Add the filter where you need it and [remove it afterwards](http://codex.wordpress.org/Function_Reference/remove_action). ``` add_action('pre_get_posts','blog_filter'); // your query; presumably WP_Query // your first loop remove_action('pre_get_posts','blog_filter'); // another query; presumably WP_Query // your seco...
106,042
<p>I am trying to create a SILO structure on one of my WordPress site. </p> <p>I have always checked this option on Yoast SEO plugin "Strip the category base (usually /category/) from the category URL."</p> <p>So my category pages have this URL: sitename.com/apple/ (where "apple" is the category page)</p> <p>Now I w...
[ { "answer_id": 106045, "author": "JMau", "author_id": 31376, "author_profile": "https://wordpress.stackexchange.com/users/31376", "pm_score": 0, "selected": false, "text": "<p>Depends. If you're trying to set 2 different page with the same URL it's not a good idea. But if you do not care...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/106042", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7371/" ]
I am trying to create a SILO structure on one of my WordPress site. I have always checked this option on Yoast SEO plugin "Strip the category base (usually /category/) from the category URL." So my category pages have this URL: sitename.com/apple/ (where "apple" is the category page) Now I want to create a new "pag...
One possible solution is to *not* change the category base and leave as-is, but instead modify any output of a category link to strip the category base via a filter. This of course will result in a 404 if you haven't created a page in place of where these links point, so creating a page for every category is required. ...
106,068
<p>I'm trying to see if I can make this happen with the built-in meta_query function. I'm taking a <code>$_GET</code> variable and want to return posts that contain that string inside the meta_key <code>urls</code>. So far, the below <em>seems</em> like it would be the most appropriate, but it's not returning values li...
[ { "answer_id": 106070, "author": "Steven Jones", "author_id": 24124, "author_profile": "https://wordpress.stackexchange.com/users/24124", "pm_score": 1, "selected": false, "text": "<p>First of all - I assume the $search variable is being populated from $_GET (it's not in your code).</p>\...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/106068", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15124/" ]
I'm trying to see if I can make this happen with the built-in meta\_query function. I'm taking a `$_GET` variable and want to return posts that contain that string inside the meta\_key `urls`. So far, the below *seems* like it would be the most appropriate, but it's not returning values like I expected. ``` $search = ...
First of all - I assume the $search variable is being populated from $\_GET (it's not in your code). Secondly, do you need the % ? I think using LIKE with wp\_query doesn't require them.
106,085
<p>I'm adding a widget on my sidebar but the Featured Image isn't shown.</p> <p>this is the code of my side bar:</p> <pre><code>&lt;?php /** * The Sidebar containing the main widget areas. * * @package PowerMag * @since PowerMag 1.0 */ ?&gt; &lt;div id="sidebar" &lt;?php if ( of_get_option('pm_sidebar_positi...
[ { "answer_id": 106090, "author": "Steve", "author_id": 3206, "author_profile": "https://wordpress.stackexchange.com/users/3206", "pm_score": 0, "selected": false, "text": "<p>Your conditions to display the sidebar might be met, but there is no command to display the sidebar:</p>\n\n<pre>...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106085", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34943/" ]
I'm adding a widget on my sidebar but the Featured Image isn't shown. this is the code of my side bar: ``` <?php /** * The Sidebar containing the main widget areas. * * @package PowerMag * @since PowerMag 1.0 */ ?> <div id="sidebar" <?php if ( of_get_option('pm_sidebar_position') == 'sidebar-content' ) { ech...
You can get the Post Thumbnail by [`get_the_post_thumbnail( )`](http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail). Inside your widget add the following code: ``` global $post; if ( has_post_thumbnail( $post->ID ) ) echo get_the_post_thumbnail( $post->ID, 'your-image-size' ); ``` If there is...
106,086
<p>I was manually uploading a theme im working on to my wordpress install tonight when I noticed a index.php file in my themes folder. I opened the file and it contained only the following three lines of code:</p> <pre><code>&lt;?php //silence is golden ?&gt; </code></pre> <p>This kind of concerned me, at first I th...
[ { "answer_id": 106088, "author": "Steve", "author_id": 3206, "author_profile": "https://wordpress.stackexchange.com/users/3206", "pm_score": 0, "selected": false, "text": "<p>This file is okay.</p>\n\n<p>It is to ensure visitors cannot manually browse the /wp-content/themes/ folder and s...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106086", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33573/" ]
I was manually uploading a theme im working on to my wordpress install tonight when I noticed a index.php file in my themes folder. I opened the file and it contained only the following three lines of code: ``` <?php //silence is golden ?> ``` This kind of concerned me, at first I thought well maybe I accidentally ...
This file and the copy in `wp-content/plugins/` was [added 2009](http://core.trac.wordpress.org/changeset/10940) to prevent directory browsing even when the server allows that. This isn’t really a security feature, except in the sense of *security by obscurity,* but there might be files not everyone wants to see publi...
106,104
<p>I want to override my plugin CSS settings, but I can't do that in my <code>style.css</code> file, because the plugin CSS gets loaded after.</p> <p>Is there a way of getting style to be applied to override plugin CSS?</p>
[ { "answer_id": 106113, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 2, "selected": false, "text": "<h2>Include overrides after wp_head / wp_footer actions</h2>\n\n<p>The plugin's stylesheet(s) are most like...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106104", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25446/" ]
I want to override my plugin CSS settings, but I can't do that in my `style.css` file, because the plugin CSS gets loaded after. Is there a way of getting style to be applied to override plugin CSS?
Include overrides after wp\_head / wp\_footer actions ----------------------------------------------------- The plugin's stylesheet(s) are most likely inserted into the page using WordPress' [enqueue functions](http://codex.wordpress.org/Function_Reference/wp_enqueue_style). If so, scripts and stylesheets will be add...
106,108
<p>I'm looking for a way to add a CSS class to the anchor tag of the tooltip on a menu item. Currently, I see that you can easily add a CSS class to the menu's li but I'm trying to style the tooltip itself, not the menu item.</p> <p>Looking at the <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" rel...
[ { "answer_id": 106114, "author": "Shahinul Islam", "author_id": 34971, "author_profile": "https://wordpress.stackexchange.com/users/34971", "pm_score": 3, "selected": true, "text": "<p>Add this code into your functions.php</p>\n\n<pre><code>\n\nclass Tooltips_Walker extends Walker_Nav_Me...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106108", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7408/" ]
I'm looking for a way to add a CSS class to the anchor tag of the tooltip on a menu item. Currently, I see that you can easily add a CSS class to the menu's li but I'm trying to style the tooltip itself, not the menu item. Looking at the [Codex for wp\_nav\_menu](http://codex.wordpress.org/Function_Reference/wp_nav_me...
Add this code into your functions.php ``` class Tooltips_Walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { $classes = empty ( $item->classes ) ? array () : (array) $item->classes; $class_names = join( ' ' , apply_filters( ...
106,111
<p>I am trying to make use of the Single template for single posts ( I have a custom one). But for some reason my posts get overridden instead of displaying new data. </p> <p>This is the setup I have right now</p> <pre><code>&lt;div class="details"&gt; &lt;?php global $post; $category_id=get_the_category($post-&gt;I...
[ { "answer_id": 106115, "author": "dannyw24", "author_id": 34257, "author_profile": "https://wordpress.stackexchange.com/users/34257", "pm_score": 0, "selected": false, "text": "<p>You need to Pass arguments into the new Object like so.</p>\n\n<pre><code>$category_id = get_the_category( $...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106111", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35180/" ]
I am trying to make use of the Single template for single posts ( I have a custom one). But for some reason my posts get overridden instead of displaying new data. This is the setup I have right now ``` <div class="details"> <?php global $post; $category_id=get_the_category($post->ID); $announcements = new WP_Quer...
> > But for some reason my posts get overridden instead of displaying new > data. > > > The problem is here: `$announcements->query('showposts=1&cat=$category_id');` You are trying to use a variable inside a single quote string. [Variables do not expand inside single quotes](http://www.php.net/manual/en/language...
106,154
<p>I'm using the following wp_query snippet to show all pages on a single page while being able to select individual pages to exclude.</p> <pre><code>// This pulls a list of page ID's from a theme options multicheck field $pages = of_get_option('exclude_pages' ); // This shows only those ID's that have been checked $i...
[ { "answer_id": 106155, "author": "Pat J", "author_id": 16121, "author_profile": "https://wordpress.stackexchange.com/users/16121", "pm_score": 0, "selected": false, "text": "<p>From the <a href=\"http://codex.wordpress.org/Class_Reference/WP_Query\" rel=\"nofollow\">Codex page for <code>...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106154", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33310/" ]
I'm using the following wp\_query snippet to show all pages on a single page while being able to select individual pages to exclude. ``` // This pulls a list of page ID's from a theme options multicheck field $pages = of_get_option('exclude_pages' ); // This shows only those ID's that have been checked $implode_pages ...
A hardcoded `array( 12, 31 )` is *not the same* as `array($implode_pages)`. The earlier is equivalent to `array( 0 => 12, 1 => 31 )` The latter is equivalent to `array( 0 => '12, 31' )` `$implode_pages = implode(', ',array_keys($pages, 1));` makes `$implode_pages` a string - which is *not* what you want. N...
106,164
<p>As discussed at <a href="https://wordpress.stackexchange.com/questions/34125/wordpress-admin-screen-very-slow-timing-out-when-editing-or-adding-a-new-page#new-answer">WordPress admin screen very slow / timing out when editing or adding a new page/custom post</a></p> <p>I am having a similar issue on a WP site conta...
[ { "answer_id": 106165, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": false, "text": "<p>Just use <a href=\"http://codex.wordpress.org/Function_Reference/remove_meta_box\" rel=\"nofollow\"><...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106164", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35198/" ]
As discussed at [WordPress admin screen very slow / timing out when editing or adding a new page/custom post](https://wordpress.stackexchange.com/questions/34125/wordpress-admin-screen-very-slow-timing-out-when-editing-or-adding-a-new-page#new-answer) I am having a similar issue on a WP site containing 7,784 pages. Ed...
Just use [`remove_meta_box`](http://codex.wordpress.org/Function_Reference/remove_meta_box) function: ``` if (is_admin()) : function my_remove_meta_boxes() { remove_meta_box('pageparentdiv', 'page', 'side'); } add_action( 'admin_menu', 'my_remove_meta_boxes' ); endif; ``` If you need to set hierarchy of these pa...
106,171
<p>I'm working on a WP_Query using the <a href="http://tri.be/shop/wordpress-events-calendar/" rel="nofollow">Modern Tribe Events Calendar</a></p> <p>My problem is with pagination.</p> <p>Is this the incorrect way to paginate the WP_Query or could there be another method for paginating the Events Calendar?</p> <p>I ...
[ { "answer_id": 106165, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": false, "text": "<p>Just use <a href=\"http://codex.wordpress.org/Function_Reference/remove_meta_box\" rel=\"nofollow\"><...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106171", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35203/" ]
I'm working on a WP\_Query using the [Modern Tribe Events Calendar](http://tri.be/shop/wordpress-events-calendar/) My problem is with pagination. Is this the incorrect way to paginate the WP\_Query or could there be another method for paginating the Events Calendar? I found a [tutorial](http://tri.be/queries-and-pag...
Just use [`remove_meta_box`](http://codex.wordpress.org/Function_Reference/remove_meta_box) function: ``` if (is_admin()) : function my_remove_meta_boxes() { remove_meta_box('pageparentdiv', 'page', 'side'); } add_action( 'admin_menu', 'my_remove_meta_boxes' ); endif; ``` If you need to set hierarchy of these pa...
106,177
<p>A few days ago I set the title tag for my home page by doing this:</p> <p>Settings => General </p> <p>but it turned out that this didn't just change the title of the home page. It actually changed the title of every page on the site to that one title.</p> <p>What is the way for me to correctly set the title for t...
[ { "answer_id": 106180, "author": "Vigs", "author_id": 33573, "author_profile": "https://wordpress.stackexchange.com/users/33573", "pm_score": 3, "selected": true, "text": "<p>WordPress sets the titles of your pages using tags which is normally set int he header.php file of your theme. I...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106177", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34846/" ]
A few days ago I set the title tag for my home page by doing this: Settings => General but it turned out that this didn't just change the title of the home page. It actually changed the title of every page on the site to that one title. What is the way for me to correctly set the title for the home page, and not ov...
WordPress sets the titles of your pages using tags which is normally set int he header.php file of your theme. In my themes I use: ``` <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title> ``` Find your themes header.php and try changing the code inside the tags to the code above.
106,185
<p>I am using the <a href="http://www.elegantthemes.com/demo/?theme=eList" rel="nofollow">eList</a> wordpress theme. </p> <p>Now on the main page, there is a thumbnail display of all the categories listed. Now, on the theme you will see that they have no sub-categories under the categories, only listings</p> <p>Now i...
[ { "answer_id": 106180, "author": "Vigs", "author_id": 33573, "author_profile": "https://wordpress.stackexchange.com/users/33573", "pm_score": 3, "selected": true, "text": "<p>WordPress sets the titles of your pages using tags which is normally set int he header.php file of your theme. I...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106185", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27604/" ]
I am using the [eList](http://www.elegantthemes.com/demo/?theme=eList) wordpress theme. Now on the main page, there is a thumbnail display of all the categories listed. Now, on the theme you will see that they have no sub-categories under the categories, only listings Now in my theme, I have sub-categories, and the ...
WordPress sets the titles of your pages using tags which is normally set int he header.php file of your theme. In my themes I use: ``` <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title> ``` Find your themes header.php and try changing the code inside the tags to the code above.
106,187
<p>At the moment, I'm building a website for a local NGO and I have the following situation: in the sidebar, I should have a widget that displays the title of the latest editorials from the members of the NGO. These editorials are published on external sites. So, my widget will look something like this:</p> <p>first r...
[ { "answer_id": 106180, "author": "Vigs", "author_id": 33573, "author_profile": "https://wordpress.stackexchange.com/users/33573", "pm_score": 3, "selected": true, "text": "<p>WordPress sets the titles of your pages using tags which is normally set int he header.php file of your theme. I...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106187", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35211/" ]
At the moment, I'm building a website for a local NGO and I have the following situation: in the sidebar, I should have a widget that displays the title of the latest editorials from the members of the NGO. These editorials are published on external sites. So, my widget will look something like this: first row: Post t...
WordPress sets the titles of your pages using tags which is normally set int he header.php file of your theme. In my themes I use: ``` <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title> ``` Find your themes header.php and try changing the code inside the tags to the code above.
106,195
<p>I'm trying to place a simple bunch of codes to redirect the 'Subscribers' only, to the home page (or a desired page) after login. I thought to use <code>if( current_user_can('read') ):</code>, but that's a global capability, will be applicable for all the other roles too. So I tried <code>get_role('subscriber')</cod...
[ { "answer_id": 106196, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 3, "selected": true, "text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/get_role\" rel=\"nofollow\"><code>get_role</code></a>...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106195", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22728/" ]
I'm trying to place a simple bunch of codes to redirect the 'Subscribers' only, to the home page (or a desired page) after login. I thought to use `if( current_user_can('read') ):`, but that's a global capability, will be applicable for all the other roles too. So I tried `get_role('subscriber')`. Here are my `function...
[`get_role`](http://codex.wordpress.org/Function_Reference/get_role) is just going to return information about the role. It isn't going to tell you if the current user has that role. Use [`wp_get_current_user`](http://codex.wordpress.org/Function_Reference/wp_get_current_user) with a check something like this: ``` fun...
106,198
<p>i'm using woocommerce on my theme, and it comes with a proudct_cat term as a defualt catagory on the shop proudct. I need to show on every proudct_cat archive its direct child and the sub-tems, but not the sub terms child.</p> <p>I tried:</p> <pre><code> &lt;?php $thispage = $wp_query-&gt;post; wp_list_cate...
[ { "answer_id": 106196, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 3, "selected": true, "text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/get_role\" rel=\"nofollow\"><code>get_role</code></a>...
2013/07/11
[ "https://wordpress.stackexchange.com/questions/106198", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/30989/" ]
i'm using woocommerce on my theme, and it comes with a proudct\_cat term as a defualt catagory on the shop proudct. I need to show on every proudct\_cat archive its direct child and the sub-tems, but not the sub terms child. I tried: ``` <?php $thispage = $wp_query->post; wp_list_categories("taxonomy=product_...
[`get_role`](http://codex.wordpress.org/Function_Reference/get_role) is just going to return information about the role. It isn't going to tell you if the current user has that role. Use [`wp_get_current_user`](http://codex.wordpress.org/Function_Reference/wp_get_current_user) with a check something like this: ``` fun...
106,217
<p>hello i did add a custem filed and this is my code</p> <pre><code>add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add() { add_meta_box( 'my-meta-box-id', 'المعلومات الرئيسية لفلل مشروع', 'cd_meta_box_cb', 'post', 'normal', 'high' ); } function cd_meta_box_cb( $post ) { $values = get...
[ { "answer_id": 106196, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 3, "selected": true, "text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/get_role\" rel=\"nofollow\"><code>get_role</code></a>...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106217", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35224/" ]
hello i did add a custem filed and this is my code ``` add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add() { add_meta_box( 'my-meta-box-id', 'المعلومات الرئيسية لفلل مشروع', 'cd_meta_box_cb', 'post', 'normal', 'high' ); } function cd_meta_box_cb( $post ) { $values = get_post_custom( ...
[`get_role`](http://codex.wordpress.org/Function_Reference/get_role) is just going to return information about the role. It isn't going to tell you if the current user has that role. Use [`wp_get_current_user`](http://codex.wordpress.org/Function_Reference/wp_get_current_user) with a check something like this: ``` fun...
106,233
<p>I wanna pass a variable, but always get the error message </p> <blockquote> <p>Invalid argument supplied for foreach()...</p> </blockquote> <p>Here is my code:</p> <pre><code>function second($taxonomies) { global $wpdb; $result = $wpdb-&gt;get_results( "SELECT * FROM tblTest WHERE manufacturer = $d", $t...
[ { "answer_id": 106234, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 0, "selected": false, "text": "<pre><code>$result = $wpdb-&gt;get_results(\n $wpdb-&gt;prepare(\n \"SELECT * FROM tblTest WHERE ma...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106233", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35227/" ]
I wanna pass a variable, but always get the error message > > Invalid argument supplied for foreach()... > > > Here is my code: ``` function second($taxonomies) { global $wpdb; $result = $wpdb->get_results( "SELECT * FROM tblTest WHERE manufacturer = $d", $taxonomies); foreach ($result as $pointer) ...
As you can see in the Codex pages the [`get_results`](http://codex.wordpress.org/Class_Reference/wpdb#SELECT_Generic_Results) doesn't provide the functionality to add a value parameter in the method: ``` $wpdb->get_results('query', output_type); ``` `output_type` has the following description: > > One of four pre-...
106,243
<p>I guess I have a problem understanding inheritance.<br> I have 4 classes like so;</p> <pre><code>class FOO extends WP_Widget { protected $pluginOptions; function __construct() { $this-&gt;pluginOptions = get_option('option_name',0); /*$this-&gt;pluginOptions['email'] returns /is set to emai...
[ { "answer_id": 106245, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 0, "selected": false, "text": "<p><code>$pluginOptions</code> is object property. It is not static property, so you set it's value for ...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106243", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26009/" ]
I guess I have a problem understanding inheritance. I have 4 classes like so; ``` class FOO extends WP_Widget { protected $pluginOptions; function __construct() { $this->pluginOptions = get_option('option_name',0); /*$this->pluginOptions['email'] returns /is set to email@domain.com here*/ ...
If you call `BAR` the e-mail address is set to `anotheremail@anotherdomain.com`. But when you call `FOO_SEND_EMAIL`, the e-mail address is set to `email@domain.com` because it is overwritten by `FOO`'s constructor. You run `$sendEmail = new FOO_SEND_EMAIL`, when you do this the constructor of `FOO` is called. It has n...
106,246
<p>I was wondering how to translate content under <code>index.php</code> (or <code>category.php</code> with qtranslate?).</p> <p>I'm using twenty twelve theme.</p> <p>My code on <code>index.php</code>: </p> <pre><code>&lt;?php /** * The main template file. * @package WordPress * @subpackage Twenty_Twelve * @since Tw...
[ { "answer_id": 106254, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>Most correct way to do this would be to use WordPress translations.</p>\n\n<p>You should replace this ...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106246", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35231/" ]
I was wondering how to translate content under `index.php` (or `category.php` with qtranslate?). I'm using twenty twelve theme. My code on `index.php`: ``` <?php /** * The main template file. * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <?php get_header(); ?> <?php $page_id = 1...
Most correct way to do this would be to use WordPress translations. You should replace this static text with: ``` <?php _e('YOUR TEXT', 'your_text_domain'); ?> ``` And add text domain to your theme. More on this topic: <http://codex.wordpress.org/I18n_for_WordPress_Developers> You can also... --------------- ......
106,262
<p>I'm using an instance of the TinyMCE editor in a plugin form, and I need for the editor to be highlighted (light red background) if the field is not correctly filled in.</p> <p>I can add a custom class 'error' if my code assesses that the editor has not been filled in as desired, but adding that class only affects ...
[ { "answer_id": 106265, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 0, "selected": false, "text": "<p>There seem to be several ways to go it (all found with some <strong><em>Google</em></strong> foo):</p>\n\n<p>Via J...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106262", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10097/" ]
I'm using an instance of the TinyMCE editor in a plugin form, and I need for the editor to be highlighted (light red background) if the field is not correctly filled in. I can add a custom class 'error' if my code assesses that the editor has not been filled in as desired, but adding that class only affects the backgr...
So this is how I achieved what I was after - The filter `'tiny_mce_before_init'` is used to update the settings of the editor, so you can add your own JS to the `'setup'` key. ``` add_filter('tiny_mce_before_init', 'initiate_tinyMCE_wordcount'); function initiate_tinyMCE_wordcount($initArray){ $initArray['setup'...
106,267
<p>As you know, there are input boxes for CSS Classes (optional) on each menus.</p> <p>But it's not showing (coming out) in source. Is there any function for disable for CSS Classes (optional)? I need to find it and remove it.</p> <p>my another sites work fine like this. I put "navi_box1" on Menu1 as CSS Class. and i...
[ { "answer_id": 106289, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p>The obvious answer is that <code>sweetdate_walker_nav_menu</code>, which is the walker that creates this menu...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106267", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34463/" ]
As you know, there are input boxes for CSS Classes (optional) on each menus. But it's not showing (coming out) in source. Is there any function for disable for CSS Classes (optional)? I need to find it and remove it. my another sites work fine like this. I put "navi\_box1" on Menu1 as CSS Class. and it shows right sp...
The obvious answer is that `sweetdate_walker_nav_menu`, which is the walker that creates this menu, is written is such a way as to not print those classes. It is hard to say for sure without seeing the code for that custom walker but you can remove the `'walker' => new sweetdate_walker_nav_menu` argument to verify that...
106,277
<p>Basically I've enqueued all of the files I need and can see there been picked up in the browser but for some reason none of them seem to load or function correctly and I get no errors in the console.</p> <p>I'm a complete novice with jquery so go easy on me please. </p> <p>website with the issue <a href="http://w...
[ { "answer_id": 106289, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p>The obvious answer is that <code>sweetdate_walker_nav_menu</code>, which is the walker that creates this menu...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106277", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34257/" ]
Basically I've enqueued all of the files I need and can see there been picked up in the browser but for some reason none of them seem to load or function correctly and I get no errors in the console. I'm a complete novice with jquery so go easy on me please. website with the issue <http://www.sportsrule.co.uk/> her...
The obvious answer is that `sweetdate_walker_nav_menu`, which is the walker that creates this menu, is written is such a way as to not print those classes. It is hard to say for sure without seeing the code for that custom walker but you can remove the `'walker' => new sweetdate_walker_nav_menu` argument to verify that...
106,278
<p>I have the following code which queries for all users (excluding admin) and sort them by the meta value user_business. When there are more than 10 users I have pagination which is currently working perfectly except no matter what 'userp' equals the pagination has page 1 always set as the current page. Can someone he...
[ { "answer_id": 106284, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>I ran your code, and the problem I see seems to be opposite what you describe-- Page 1 <strong><em>never</em...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106278", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31784/" ]
I have the following code which queries for all users (excluding admin) and sort them by the meta value user\_business. When there are more than 10 users I have pagination which is currently working perfectly except no matter what 'userp' equals the pagination has page 1 always set as the current page. Can someone help...
I ran your code, and the problem I see seems to be opposite what you describe-- Page 1 ***never*** sets as the current page. Assuming that is the issue, I understand the puzzlement. That one is tricky to work out. You need to set `base` to an absolute URL. ``` 'base' => get_permalink( get_the_ID() ). '%_%', ``` Or s...
106,296
<p>What's the best way to force oembed (or shortcodes too) to the top of a post?</p> <p>I'd like to feature youtube embeds before the actual article content, regardless of where the link was inserted. Any ideas?</p>
[ { "answer_id": 106284, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>I ran your code, and the problem I see seems to be opposite what you describe-- Page 1 <strong><em>never</em...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106296", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34001/" ]
What's the best way to force oembed (or shortcodes too) to the top of a post? I'd like to feature youtube embeds before the actual article content, regardless of where the link was inserted. Any ideas?
I ran your code, and the problem I see seems to be opposite what you describe-- Page 1 ***never*** sets as the current page. Assuming that is the issue, I understand the puzzlement. That one is tricky to work out. You need to set `base` to an absolute URL. ``` 'base' => get_permalink( get_the_ID() ). '%_%', ``` Or s...
106,299
<p>I have this query to get posts and show like this:</p> <pre><code>Custom taxonomy 1 &lt;div ID1&gt; |-- post 1 |-- post 2 &lt;/div&gt; Custom taxonomy 2 &lt;div ID2&gt; |-- post 3 |-- post 4 &lt;/div&gt; </code></pre> <p>Now I need to get the current taxonomy ID for each section and insert to &lt; div <stro...
[ { "answer_id": 106284, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>I ran your code, and the problem I see seems to be opposite what you describe-- Page 1 <strong><em>never</em...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106299", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31680/" ]
I have this query to get posts and show like this: ``` Custom taxonomy 1 <div ID1> |-- post 1 |-- post 2 </div> Custom taxonomy 2 <div ID2> |-- post 3 |-- post 4 </div> ``` Now I need to get the current taxonomy ID for each section and insert to < div **ID**>. How to request & echo the ID in this code? ``` <...
I ran your code, and the problem I see seems to be opposite what you describe-- Page 1 ***never*** sets as the current page. Assuming that is the issue, I understand the puzzlement. That one is tricky to work out. You need to set `base` to an absolute URL. ``` 'base' => get_permalink( get_the_ID() ). '%_%', ``` Or s...
106,313
<p>I'm trying to switch from Drupal to WordPress, and I have lots of articles written in Drupal's WYSIWYG Editors, and stored like</p> <pre><code>&lt;p&gt;Hi, this is an article&lt;/p&gt;&lt;p&gt;&lt;img bla='bla'&gt;&lt;/img&gt;&lt;/p&gt; </code></pre> <p>So I want to directly copy the source code and paste it into ...
[ { "answer_id": 106284, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>I ran your code, and the problem I see seems to be opposite what you describe-- Page 1 <strong><em>never</em...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106313", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35050/" ]
I'm trying to switch from Drupal to WordPress, and I have lots of articles written in Drupal's WYSIWYG Editors, and stored like ``` <p>Hi, this is an article</p><p><img bla='bla'></img></p> ``` So I want to directly copy the source code and paste it into WordPress. I can do it by disabling the visual text editor. So...
I ran your code, and the problem I see seems to be opposite what you describe-- Page 1 ***never*** sets as the current page. Assuming that is the issue, I understand the puzzlement. That one is tricky to work out. You need to set `base` to an absolute URL. ``` 'base' => get_permalink( get_the_ID() ). '%_%', ``` Or s...
106,343
<p>I have a custom metabox in a custom post type that records system outages across the campus that I work at. One of the fields in the metabox is a multiselect box listing all the buildings on campus.</p> <p>When I save the post, I am able to retrieve the array of buildings on the front-end. However, if I go back to ...
[ { "answer_id": 106350, "author": "keilowe", "author_id": 34888, "author_profile": "https://wordpress.stackexchange.com/users/34888", "pm_score": 1, "selected": true, "text": "<p>I tested your code and this ended up working for me:</p>\n\n<pre><code>case 'multiselect': \n echo '&#60;sel...
2013/07/12
[ "https://wordpress.stackexchange.com/questions/106343", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35260/" ]
I have a custom metabox in a custom post type that records system outages across the campus that I work at. One of the fields in the metabox is a multiselect box listing all the buildings on campus. When I save the post, I am able to retrieve the array of buildings on the front-end. However, if I go back to edit the p...
I tested your code and this ended up working for me: ``` case 'multiselect': echo '<select name="'.$field['id'].'" id="'.$field['id'].'">'; foreach ($field['options'] as $option) { echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option...
106,367
<p>I am creating wordpress that constists of many many custom styled static pages. Some has tables, some has text+iages etc. - so each page has almost unique style with some commonalityes, of course.</p> <p>So I have a question - how to better style this. I have two options:</p> <p>1) I create some static text, image...
[ { "answer_id": 106350, "author": "keilowe", "author_id": 34888, "author_profile": "https://wordpress.stackexchange.com/users/34888", "pm_score": 1, "selected": true, "text": "<p>I tested your code and this ended up working for me:</p>\n\n<pre><code>case 'multiselect': \n echo '&#60;sel...
2013/07/13
[ "https://wordpress.stackexchange.com/questions/106367", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35268/" ]
I am creating wordpress that constists of many many custom styled static pages. Some has tables, some has text+iages etc. - so each page has almost unique style with some commonalityes, of course. So I have a question - how to better style this. I have two options: 1) I create some static text, images, table etc. in ...
I tested your code and this ended up working for me: ``` case 'multiselect': echo '<select name="'.$field['id'].'" id="'.$field['id'].'">'; foreach ($field['options'] as $option) { echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option...
106,377
<p>How to set a Static page (example Sample Page with every WordPress install) as default fron page for every newly created site on multisite network. I mean when a new user creates a site on my multisite network a Page with custom name sets as front page automatically. Please tell me how to accomplish that.</p>
[ { "answer_id": 106378, "author": "ksr89", "author_id": 31368, "author_profile": "https://wordpress.stackexchange.com/users/31368", "pm_score": -1, "selected": false, "text": "<p>1) To set Your first page you can add new page as <code>home.php</code> in your directory. Wordpress by defaul...
2013/07/13
[ "https://wordpress.stackexchange.com/questions/106377", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35209/" ]
How to set a Static page (example Sample Page with every WordPress install) as default fron page for every newly created site on multisite network. I mean when a new user creates a site on my multisite network a Page with custom name sets as front page automatically. Please tell me how to accomplish that.
Try the following code. Based on these two Q&A's (not tested): * [How to add Custom Blog Options to new blog setup form?](https://wordpress.stackexchange.com/q/50235/12615) * [Programmatically set page\_on\_front](https://wordpress.stackexchange.com/q/96066/12615) ``` add_action( 'wpmu_new_blog', 'process_extra_field...
106,380
<p>I'm working on a very very simple theme, it's only a one page site.</p> <p>I'm off for holiday tomorrow morning and I've been asked to set this site live last night. Well, everything was going great until I opened IE (I've tested the html in IE before I developed the theme) - for some reason IE triggered Quirks Mod...
[ { "answer_id": 106378, "author": "ksr89", "author_id": 31368, "author_profile": "https://wordpress.stackexchange.com/users/31368", "pm_score": -1, "selected": false, "text": "<p>1) To set Your first page you can add new page as <code>home.php</code> in your directory. Wordpress by defaul...
2013/07/13
[ "https://wordpress.stackexchange.com/questions/106380", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35271/" ]
I'm working on a very very simple theme, it's only a one page site. I'm off for holiday tomorrow morning and I've been asked to set this site live last night. Well, everything was going great until I opened IE (I've tested the html in IE before I developed the theme) - for some reason IE triggered Quirks Mode and ever...
Try the following code. Based on these two Q&A's (not tested): * [How to add Custom Blog Options to new blog setup form?](https://wordpress.stackexchange.com/q/50235/12615) * [Programmatically set page\_on\_front](https://wordpress.stackexchange.com/q/96066/12615) ``` add_action( 'wpmu_new_blog', 'process_extra_field...
106,386
<p>I've added a page template that is my new home page and I would like to be able simply list the last 5 blog entries. My home page currently looks like...</p> <pre><code>&lt;?php /** * This file controls the layout of your homepage * * @package WordPress * @subpackage Pytheas WordPress Theme * T...
[ { "answer_id": 106378, "author": "ksr89", "author_id": 31368, "author_profile": "https://wordpress.stackexchange.com/users/31368", "pm_score": -1, "selected": false, "text": "<p>1) To set Your first page you can add new page as <code>home.php</code> in your directory. Wordpress by defaul...
2013/07/13
[ "https://wordpress.stackexchange.com/questions/106386", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14569/" ]
I've added a page template that is my new home page and I would like to be able simply list the last 5 blog entries. My home page currently looks like... ``` <?php /** * This file controls the layout of your homepage * * @package WordPress * @subpackage Pytheas WordPress Theme * Template Name: Cust...
Try the following code. Based on these two Q&A's (not tested): * [How to add Custom Blog Options to new blog setup form?](https://wordpress.stackexchange.com/q/50235/12615) * [Programmatically set page\_on\_front](https://wordpress.stackexchange.com/q/96066/12615) ``` add_action( 'wpmu_new_blog', 'process_extra_field...
106,408
<p>I am using a plugin called formidable which is similar to Gravity Forms in terms of purpose.</p> <p>I have two fields of interest. The first field loads up all the values in the <code>Town</code> column of my <code>wp_locations</code> table. Using the code below.</p> <pre><code>function frm_populate_posts_town($va...
[ { "answer_id": 106418, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>My guess is that this is the wrong hook for what you are trying to do, or you are using it incorrectly. </p>...
2013/07/13
[ "https://wordpress.stackexchange.com/questions/106408", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28123/" ]
I am using a plugin called formidable which is similar to Gravity Forms in terms of purpose. I have two fields of interest. The first field loads up all the values in the `Town` column of my `wp_locations` table. Using the code below. ``` function frm_populate_posts_town($values, $field){ if($field->id == 800){ /...
My guess is that this is the wrong hook for what you are trying to do, or you are using it incorrectly. A few notes: You are passing unvalidated data into a query. Please don't do that. This... ``` $town_b = $_POST['item_meta'][800];//Gets the value from the first field global $wpdb; $query = "SELECT County FROM w...
106,415
<p>In Advanced Custom Fields plugin, is it possible to display a WYSIWYG editor field in which <code>p</code> tags are omitted?</p>
[ { "answer_id": 106431, "author": "David Kryzaniak", "author_id": 31548, "author_profile": "https://wordpress.stackexchange.com/users/31548", "pm_score": 1, "selected": false, "text": "<p>Natively, I don't believe there is a way to do that. Are you looking to remove just P tags, or all ht...
2013/07/13
[ "https://wordpress.stackexchange.com/questions/106415", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11634/" ]
In Advanced Custom Fields plugin, is it possible to display a WYSIWYG editor field in which `p` tags are omitted?
`strip_tags()` is not bad, but there may be a lot of tags you'll have to allow. So maybe you can use `str_replace()` to only get rid of the `<p>`-tag: ``` <?php $field = get_field('wysiwyg'); // your wysiwyg field data $strip = array('<p>','</p>'); // search for <p> echo str_replace($strip,'',$field); ?> ```
106,427
<p>At the moment I have an ajax that works (I get a success [200] response), but having an issue with the action hooks on the response. The JSON object is not coming back, instead <strong>I'm getting a 0</strong>. </p> <p>I have the die(); after my return so I'm thinking the issue is the hook not working.</p> <p>I've...
[ { "answer_id": 106434, "author": "Shahinul Islam", "author_id": 34971, "author_profile": "https://wordpress.stackexchange.com/users/34971", "pm_score": 0, "selected": false, "text": "<p>Please check your ajax call</p>\n\n<p>if you use make sure you put dataType : \"json\" </p>\n\n<pre><c...
2013/07/13
[ "https://wordpress.stackexchange.com/questions/106427", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12691/" ]
At the moment I have an ajax that works (I get a success [200] response), but having an issue with the action hooks on the response. The JSON object is not coming back, instead **I'm getting a 0**. I have the die(); after my return so I'm thinking the issue is the hook not working. I've tried multiple methods within...
The issue was that **in my functions.php I was loading a file** (*reservations.php*) using the `after_setup_theme` hook ``` add_action('after_setup_theme', 'init_cpts'); ``` And then from within the file that was loaded I was requiring my class files with the `init` hook. I thought this would be ok since `init` load...
106,438
<p>For example, if I write some code (e.d. add a custom post type or something) in my theme's functions.php, it works fine. If I move it to a new file, then <code>include()</code> the file in my theme's functions.php file, it no longer works (but debug code using <code>error_log()</code> still works.</p> <p>e.g. </p> ...
[ { "answer_id": 130137, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": false, "text": "<p>When including files in <code>functions.php</code>, you need to reference the correct filepath, using <cod...
2013/07/14
[ "https://wordpress.stackexchange.com/questions/106438", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1226/" ]
For example, if I write some code (e.d. add a custom post type or something) in my theme's functions.php, it works fine. If I move it to a new file, then `include()` the file in my theme's functions.php file, it no longer works (but debug code using `error_log()` still works. e.g. Here's functions.php: ``` <?php //...
When including files in `functions.php`, you need to reference the correct filepath, using `get_template_directory()`: ``` include( get_template_directory() . '/newfile.php' ); ```
106,440
<p>I'm trying to see if there is a way to find an average age of user accounts which came through my wordpress site not including the age of the administrator account.</p> <p>When I say age I don't mean their actual birth age but the tenure of their account.</p> <p>Is there a simple way to determine this?</p>
[ { "answer_id": 106444, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 2, "selected": false, "text": "<p>WordPress records when a user was registered in the <code>$wpdb-&gt;users</code> (usually <code>wp_users...
2013/07/14
[ "https://wordpress.stackexchange.com/questions/106440", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28262/" ]
I'm trying to see if there is a way to find an average age of user accounts which came through my wordpress site not including the age of the administrator account. When I say age I don't mean their actual birth age but the tenure of their account. Is there a simple way to determine this?
WordPress records when a user was registered in the `$wpdb->users` (usually `wp_users`) table in the column `user_registered`. So you can use that to calculate the average account age. There's no internal function for this, so you'll have to use `$wpdb` directly. [This stackoverflow answer](https://stackoverflow.com/a...
106,448
<p>Is there an RSS feed for the page that displays the newest WordPress plugins from the official plugins repository?</p> <p>I know of the following link, but I'm looking for an RSS feed that I can add to my reader.</p> <p><a href="http://wordpress.org/plugins/browse/new/" rel="nofollow">http://wordpress.org/plugins/...
[ { "answer_id": 106444, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 2, "selected": false, "text": "<p>WordPress records when a user was registered in the <code>$wpdb-&gt;users</code> (usually <code>wp_users...
2013/07/14
[ "https://wordpress.stackexchange.com/questions/106448", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35294/" ]
Is there an RSS feed for the page that displays the newest WordPress plugins from the official plugins repository? I know of the following link, but I'm looking for an RSS feed that I can add to my reader. <http://wordpress.org/plugins/browse/new/>
WordPress records when a user was registered in the `$wpdb->users` (usually `wp_users`) table in the column `user_registered`. So you can use that to calculate the average account age. There's no internal function for this, so you'll have to use `$wpdb` directly. [This stackoverflow answer](https://stackoverflow.com/a...
106,483
<p>Actually I am developing a new free plugin for Wordpress partially based on this plugin FrameWork: <a href="http://gndev.info/sunrise/" rel="nofollow">Sunrise framewok</a>, each option's name will start like this:</p> <pre><code>my_plugin_ </code></pre> <p>So everytime i need to echo and option i simply write: </p...
[ { "answer_id": 106484, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p>The <a href=\"http://codex.wordpress.org/Function_Reference/get_alloptions\" rel=\"nofollow\">Codex suggests<...
2013/07/14
[ "https://wordpress.stackexchange.com/questions/106483", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4107/" ]
Actually I am developing a new free plugin for Wordpress partially based on this plugin FrameWork: [Sunrise framewok](http://gndev.info/sunrise/), each option's name will start like this: ``` my_plugin_ ``` So everytime i need to echo and option i simply write: ``` echo get_option('my_plugin_option_example') ```...
The [Codex suggests](http://codex.wordpress.org/Function_Reference/get_alloptions) that you use [`wp_load_alloptions`](http://codex.wordpress.org/Function_Reference/wp_load_alloptions) instead. I would suggest that you therefore use [`wp_load_alloptions`](http://codex.wordpress.org/Function_Reference/wp_load_alloptio...
106,490
<p>I've designed a sidebar widget and found that on many themes the widget looks fine. However, certain themes make the widget look out of place (clashing with colors, bad contrast, etc.)</p> <p>Are there any guidelines on how to properly style widgets so that they match <em>most</em> websites?</p>
[ { "answer_id": 106484, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p>The <a href=\"http://codex.wordpress.org/Function_Reference/get_alloptions\" rel=\"nofollow\">Codex suggests<...
2013/07/14
[ "https://wordpress.stackexchange.com/questions/106490", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35247/" ]
I've designed a sidebar widget and found that on many themes the widget looks fine. However, certain themes make the widget look out of place (clashing with colors, bad contrast, etc.) Are there any guidelines on how to properly style widgets so that they match *most* websites?
The [Codex suggests](http://codex.wordpress.org/Function_Reference/get_alloptions) that you use [`wp_load_alloptions`](http://codex.wordpress.org/Function_Reference/wp_load_alloptions) instead. I would suggest that you therefore use [`wp_load_alloptions`](http://codex.wordpress.org/Function_Reference/wp_load_alloptio...
106,494
<p>I used a functions into my page I created for WordPress, it's working, but the functions 're not working, doesn't showing any result. For example:</p> <pre><code>&lt;?php function tester() { global $pol; $pol="ok all fine and working"; } tester(); echo $pol; ?&gt; </code></pre> <p>This function works perfectly...
[ { "answer_id": 106495, "author": "JMau", "author_id": 31376, "author_profile": "https://wordpress.stackexchange.com/users/31376", "pm_score": 0, "selected": false, "text": "<p>It's a PHP question. That's because you do not use correct way to retrieve your global. Use the magic var_dump i...
2013/07/14
[ "https://wordpress.stackexchange.com/questions/106494", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32760/" ]
I used a functions into my page I created for WordPress, it's working, but the functions 're not working, doesn't showing any result. For example: ``` <?php function tester() { global $pol; $pol="ok all fine and working"; } tester(); echo $pol; ?> ``` This function works perfectly if I use it outside WordPress, ...
WordPress template files are included via *functions*, which places the scope of those included files within those functions. That's why you have to declare it global twice. Here is an example you can try with 3 simple php files to illustrate this without using WordPress: > > main.php > > > ``` function include_f...
106,498
<p>I'm using a child theme of Twenty Twelve in wordpress. Here's where I am developing the site:</p> <p><a href="http://internalcompass.us/castle/" rel="nofollow">http://internalcompass.us/castle/</a></p> <p>You'll notice the two columns of posts on the homepage. I have one labeled recent posts and one labeled favori...
[ { "answer_id": 106495, "author": "JMau", "author_id": 31376, "author_profile": "https://wordpress.stackexchange.com/users/31376", "pm_score": 0, "selected": false, "text": "<p>It's a PHP question. That's because you do not use correct way to retrieve your global. Use the magic var_dump i...
2013/07/14
[ "https://wordpress.stackexchange.com/questions/106498", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35310/" ]
I'm using a child theme of Twenty Twelve in wordpress. Here's where I am developing the site: <http://internalcompass.us/castle/> You'll notice the two columns of posts on the homepage. I have one labeled recent posts and one labeled favorites. In actuality, both columns are the same - recent posts organized by date....
WordPress template files are included via *functions*, which places the scope of those included files within those functions. That's why you have to declare it global twice. Here is an example you can try with 3 simple php files to illustrate this without using WordPress: > > main.php > > > ``` function include_f...
106,543
<p>I am following the wp.tutsplus tutorial on Custom post types. Everything was fine until i added this code in my main plugin file</p> <pre><code>&lt;?php add_filter( 'template_include', 'include_template_function', 1);?&gt; &lt;?php function include_template_function(){ if( get_post_type() == 'movie_reviews' ){...
[ { "answer_id": 106495, "author": "JMau", "author_id": 31376, "author_profile": "https://wordpress.stackexchange.com/users/31376", "pm_score": 0, "selected": false, "text": "<p>It's a PHP question. That's because you do not use correct way to retrieve your global. Use the magic var_dump i...
2013/07/15
[ "https://wordpress.stackexchange.com/questions/106543", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28040/" ]
I am following the wp.tutsplus tutorial on Custom post types. Everything was fine until i added this code in my main plugin file ``` <?php add_filter( 'template_include', 'include_template_function', 1);?> <?php function include_template_function(){ if( get_post_type() == 'movie_reviews' ){ if( is_single(...
WordPress template files are included via *functions*, which places the scope of those included files within those functions. That's why you have to declare it global twice. Here is an example you can try with 3 simple php files to illustrate this without using WordPress: > > main.php > > > ``` function include_f...
106,546
<p>On my page, I have many fields text area fields containing text, and one WYSIWYG field containing a YouTube video (I need it to be WYSIWYG because otherwise only the URL of the video would show, not the video itself).</p> <p>Problem: my text area fields have no tags other than br tags in them, whereas my WYSIWYG is...
[ { "answer_id": 106547, "author": "Ravinder Kumar", "author_id": 29439, "author_profile": "https://wordpress.stackexchange.com/users/29439", "pm_score": 0, "selected": false, "text": "<p>you can create text type field in Advance custom field</p>\n\n<pre><code>$yt=get_field('youtube_url');...
2013/07/15
[ "https://wordpress.stackexchange.com/questions/106546", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11634/" ]
On my page, I have many fields text area fields containing text, and one WYSIWYG field containing a YouTube video (I need it to be WYSIWYG because otherwise only the URL of the video would show, not the video itself). Problem: my text area fields have no tags other than br tags in them, whereas my WYSIWYG is full of p...
You can try using [`wp_oembed_get`](http://codex.wordpress.org/Function_Reference/wp_oembed_get) and a textfield. You add the youtube url in the textfield. Assuming the field name is `youtube_url`, your code will be something like: ``` if( get_field('youtube_url') ){ $embed_code = wp_oembed_get( get_field('youtube_...
106,562
<p>I am new to the world of WordPress. I own a new site and I'd like my home page to display the latest news and articles (which I accomplished to set in Settings > Reading), but I'd like another page to display all posts (not the whole post but a summary) without the need to press "previous page".</p> <p>e.x. If I ha...
[ { "answer_id": 106547, "author": "Ravinder Kumar", "author_id": 29439, "author_profile": "https://wordpress.stackexchange.com/users/29439", "pm_score": 0, "selected": false, "text": "<p>you can create text type field in Advance custom field</p>\n\n<pre><code>$yt=get_field('youtube_url');...
2013/07/10
[ "https://wordpress.stackexchange.com/questions/106562", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35142/" ]
I am new to the world of WordPress. I own a new site and I'd like my home page to display the latest news and articles (which I accomplished to set in Settings > Reading), but I'd like another page to display all posts (not the whole post but a summary) without the need to press "previous page". e.x. If I have 8 posts...
You can try using [`wp_oembed_get`](http://codex.wordpress.org/Function_Reference/wp_oembed_get) and a textfield. You add the youtube url in the textfield. Assuming the field name is `youtube_url`, your code will be something like: ``` if( get_field('youtube_url') ){ $embed_code = wp_oembed_get( get_field('youtube_...
106,576
<p>My Javascript doesn't seem to get called on this page called news, this uses the default post custom type in wordpress.</p> <p>Every other page that uses's this javascript is a custom post type I've implemented, I've got an idea of what's causing it and thats the if conditional at the top, but I've tried removing !...
[ { "answer_id": 106579, "author": "GhostToast", "author_id": 13676, "author_profile": "https://wordpress.stackexchange.com/users/13676", "pm_score": 3, "selected": true, "text": "<p>Looks like it is your <code>if</code> statement possibly. It's kind of tricky to say \"if it's not this or ...
2013/07/15
[ "https://wordpress.stackexchange.com/questions/106576", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34257/" ]
My Javascript doesn't seem to get called on this page called news, this uses the default post custom type in wordpress. Every other page that uses's this javascript is a custom post type I've implemented, I've got an idea of what's causing it and thats the if conditional at the top, but I've tried removing !is\_home a...
Looks like it is your `if` statement possibly. It's kind of tricky to say "if it's not this or if it's not that, then I want this to happen". Normally you have to negate *and* change the operator. Try `<?php if (!is_home() && !is_front_page()) { ?>` This says "I want this to run on every single page that is not hom...
106,621
<p>I'm using the <a href="https://woocommerce.com/products/canvas/" rel="nofollow">Canvas theme</a>, and their framework.</p> <p>I built a child theme and have my custom CSS segregated in a <code>custom.css</code> file in that directory. I've made some changes to one specific page layout file (<code>loop-magazine.php<...
[ { "answer_id": 106622, "author": "user1352792", "author_id": 35353, "author_profile": "https://wordpress.stackexchange.com/users/35353", "pm_score": 0, "selected": false, "text": "<p>Assuming that you category is 'services\" then;</p>\n\n<pre><code>.category-services .post-meta {\n di...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106621", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35354/" ]
I'm using the [Canvas theme](https://woocommerce.com/products/canvas/), and their framework. I built a child theme and have my custom CSS segregated in a `custom.css` file in that directory. I've made some changes to one specific page layout file (`loop-magazine.php`) to pull posts from a specific category (`id=7`) fr...
Posting the answer that was solved by OP in one of the comments. This way it's easier to read it. Hopefully a moderator can mark the question as solved. ``` .page-template-template-magazine-php .post-meta, .category-services .post-meta { display:none; } ```
106,639
<p>Does anyone know how o load wp_editor via AJAX in WordPress?</p> <p>My markup and editor is getting loaded properly but editor controls are not getting loaded properly, it may be because Javascript is not running in AJAX call.</p> <p>Any help would be appreciated.</p>
[ { "answer_id": 130425, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": false, "text": "<p>The main problem are the missing scripts. The scripts enqueued in <code>_WP_Editors::enqueue_scripts()</code> are nev...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106639", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17108/" ]
Does anyone know how o load wp\_editor via AJAX in WordPress? My markup and editor is getting loaded properly but editor controls are not getting loaded properly, it may be because Javascript is not running in AJAX call. Any help would be appreciated.
The main problem are the missing scripts. The scripts enqueued in `_WP_Editors::enqueue_scripts()` are never printed. The same is true for `_WP_Editors::editor_js()`. So you have to do that in your AJAX callback handler. I have written a demo plugin and put it on GitHub: [T5 AJAX Editor](https://gist.github.com/toscho...
106,649
<p>I have a project where I need to display an alternating food menu each week.</p> <ul> <li>i.e. menu1 on week1, menu2 on week2 then back to week1 etc.</li> <li>I've created custom post types for each menu (menu1 &amp; menu2).</li> </ul> <p>Ideally, if the user wanted to see what the food menu was going to be next w...
[ { "answer_id": 130425, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": false, "text": "<p>The main problem are the missing scripts. The scripts enqueued in <code>_WP_Editors::enqueue_scripts()</code> are nev...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106649", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13092/" ]
I have a project where I need to display an alternating food menu each week. * i.e. menu1 on week1, menu2 on week2 then back to week1 etc. * I've created custom post types for each menu (menu1 & menu2). Ideally, if the user wanted to see what the food menu was going to be next week, they would click on a calendar day...
The main problem are the missing scripts. The scripts enqueued in `_WP_Editors::enqueue_scripts()` are never printed. The same is true for `_WP_Editors::editor_js()`. So you have to do that in your AJAX callback handler. I have written a demo plugin and put it on GitHub: [T5 AJAX Editor](https://gist.github.com/toscho...
106,651
<p>I am coming here for advice mainly, because I am stuck on what to do next. Within my latest project, I am using Wordpress at the backbone, as a fully fledged CMS system. I have styled every single page, and the theme is looking great! One problem however:</p> <p>I am going to be posting <em>not so news-y posts as g...
[ { "answer_id": 106652, "author": "Disgeae", "author_id": 33144, "author_profile": "https://wordpress.stackexchange.com/users/33144", "pm_score": 0, "selected": false, "text": "<p>I think this isn't able to do without (much) coding, check this URL. <a href=\"http://codeseekah.com/2012/03/...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106651", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35322/" ]
I am coming here for advice mainly, because I am stuck on what to do next. Within my latest project, I am using Wordpress at the backbone, as a fully fledged CMS system. I have styled every single page, and the theme is looking great! One problem however: I am going to be posting *not so news-y posts as guides, inform...
It shouldn;'t be so hard. All you have to do is to use `wp_get_nav_menu_items` filter. This will add 10 posts to submenu of item which title is equal to ''. ``` function insert_my_posts_to_menu( $items, $menu, $args ) { $menu_order = count($items); $child_items = array(); foreach ( $items as &$item ) { ...
106,658
<p>I have set of user data from another wordpress site and i want o create users for each of them in a another wordpress web site..,it is works fine with <code>wp_insert_user($user)</code> but problem is the password is hashed agin..,so i can't log with that login information,so how can i create user with hash passwo...
[ { "answer_id": 106663, "author": "Bradly Spicer", "author_id": 35329, "author_profile": "https://wordpress.stackexchange.com/users/35329", "pm_score": 1, "selected": false, "text": "<p>Well for creating hash passwords have a look at this:</p>\n\n<p><a href=\"http://codex.wordpress.org/Fu...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106658", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28855/" ]
I have set of user data from another wordpress site and i want o create users for each of them in a another wordpress web site..,it is works fine with `wp_insert_user($user)` but problem is the password is hashed agin..,so i can't log with that login information,so how can i create user with hash password or stop creat...
You would have to update the password column in the database (see below). But this alone won't work. Password hashes are salted using the SALT keys in your `wp-config.php` (this must be kept secret). Your new site would **need to have identical keys** for the password verification to work. The following function updat...
106,661
<p>I needed to make custom HTML page in root which will not use default wordpress theme and show content and I linked it on menu as custom links. So in front end everything perfect. But this page is not part of wordpress and I am not sure if it will harm SEO or something.</p> <p>Is there any way plugin or something so...
[ { "answer_id": 106663, "author": "Bradly Spicer", "author_id": 35329, "author_profile": "https://wordpress.stackexchange.com/users/35329", "pm_score": 1, "selected": false, "text": "<p>Well for creating hash passwords have a look at this:</p>\n\n<p><a href=\"http://codex.wordpress.org/Fu...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106661", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33057/" ]
I needed to make custom HTML page in root which will not use default wordpress theme and show content and I linked it on menu as custom links. So in front end everything perfect. But this page is not part of wordpress and I am not sure if it will harm SEO or something. Is there any way plugin or something so text on t...
You would have to update the password column in the database (see below). But this alone won't work. Password hashes are salted using the SALT keys in your `wp-config.php` (this must be kept secret). Your new site would **need to have identical keys** for the password verification to work. The following function updat...
106,688
<p>I am using the <a href="http://wordpress.org/plugins/like-to-keep-reading/" rel="nofollow"><em>like to keep reading</em></a> plugin. </p> <p>I have created some code in <em>index.html</em> file. </p> <p>I use this code </p> <pre><code>[like_to_read] some code here [/like_to_read] </code></pre> <p>That is not wo...
[ { "answer_id": 106699, "author": "Derfder", "author_id": 17368, "author_profile": "https://wordpress.stackexchange.com/users/17368", "pm_score": 0, "selected": false, "text": "<p>1) Put this in your Apache configuration file (httpd.conf), so html files will be interpreted as php files:</...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106688", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34665/" ]
I am using the [*like to keep reading*](http://wordpress.org/plugins/like-to-keep-reading/) plugin. I have created some code in *index.html* file. I use this code ``` [like_to_read] some code here [/like_to_read] ``` That is not working. But if I use in this in a post it will work like a charm. I, however...
There are three major flaws with what you're asking: **1.** You are attempting to use a [WordPress API](http://codex.wordpress.org/Shortcode_API) in a file loaded separately from WordPress. This will only work if you include WP in that file (resulting in the performance difference you likely expected to gain by loadin...
106,710
<p>I want to grab images 161 thru 166 without having to calling my entire media library array and having to splice those up. In time, the more I have in there the more it's going to slow my site down. Here is what I have so far, I use array_reverse to reverse the IDs so the most recent uploads are last and I use array_...
[ { "answer_id": 106712, "author": "Rohit Pande", "author_id": 21274, "author_profile": "https://wordpress.stackexchange.com/users/21274", "pm_score": 1, "selected": false, "text": "<p>If you have all the IDs of images you want then you just need to use the <a href=\"http://codex.wordpress...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106710", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32203/" ]
I want to grab images 161 thru 166 without having to calling my entire media library array and having to splice those up. In time, the more I have in there the more it's going to slow my site down. Here is what I have so far, I use array\_reverse to reverse the IDs so the most recent uploads are last and I use array\_s...
Add `post__in` (two underscores) to your `$args`: ``` $args = array( 'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1, 'post__in' => array( 161, 162, 163, 164, 165, 166 ), ); ``` ### Reference [WP\_Query on the Codex](http://codex.wordpr...
106,716
<p>Whether I'm using a Wordpress default theme or a custom one, I see the JS error: <code>Uncaught TypeError: Object [object Object] has no method 'wpColorPicker'</code> when I click "Customize" on the theme. I've also noticed that on the widgets page nothing is draggable. I believe these issues may be related as I j...
[ { "answer_id": 106712, "author": "Rohit Pande", "author_id": 21274, "author_profile": "https://wordpress.stackexchange.com/users/21274", "pm_score": 1, "selected": false, "text": "<p>If you have all the IDs of images you want then you just need to use the <a href=\"http://codex.wordpress...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106716", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14569/" ]
Whether I'm using a Wordpress default theme or a custom one, I see the JS error: `Uncaught TypeError: Object [object Object] has no method 'wpColorPicker'` when I click "Customize" on the theme. I've also noticed that on the widgets page nothing is draggable. I believe these issues may be related as I just moved this s...
Add `post__in` (two underscores) to your `$args`: ``` $args = array( 'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1, 'post__in' => array( 161, 162, 163, 164, 165, 166 ), ); ``` ### Reference [WP\_Query on the Codex](http://codex.wordpr...
106,734
<p>This is my search js code for processing search :</p> <pre><code>jQuery(document).ready(function($){ $('#searchsubmit').click(function(e){ e.preventDefault(); var searchval = $('#s').val(); // get search term $.post( WPaAjax.ajaxurl, { action :...
[ { "answer_id": 106741, "author": "Jake", "author_id": 11966, "author_profile": "https://wordpress.stackexchange.com/users/11966", "pm_score": 2, "selected": false, "text": "<pre><code>jQuery(document).ready(function($) {\n\n $('#searchsubmit').click(function(e){ \n e.preventDef...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106734", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17368/" ]
This is my search js code for processing search : ``` jQuery(document).ready(function($){ $('#searchsubmit').click(function(e){ e.preventDefault(); var searchval = $('#s').val(); // get search term $.post( WPaAjax.ajaxurl, { action : 'wpa56343_mor...
You can use the inbuilt spinner class : Add the class to the HTML where you want the spinner to appear, for example after your search button : ``` <button type="button" id="searchsubmit">Search Button</button> <span class="spinner"></span> <!-- Add this spinner class where you want it to appear--> ``` In jQuery y...
106,744
<p>This is my function in my template's functions.php.</p> <p>The problem is that this is working:</p> <pre><code>function ajax_search_action_do(){ global $wp_query; $search = $_POST['search_value']; $country = $_POST['country_value']; $args = array( 's' =&gt; $search, 'posts_per_p...
[ { "answer_id": 106751, "author": "Mat_", "author_id": 9122, "author_profile": "https://wordpress.stackexchange.com/users/9122", "pm_score": -1, "selected": false, "text": "<p>I think that you're probably registering your custom taxonomies in the <code>init</code> action hook. However, if...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106744", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17368/" ]
This is my function in my template's functions.php. The problem is that this is working: ``` function ajax_search_action_do(){ global $wp_query; $search = $_POST['search_value']; $country = $_POST['country_value']; $args = array( 's' => $search, 'posts_per_page' => 10, ); $...
This is a result of a problematic `GROUP BY` clause that's added to WP\_Query when `tax_query` is present. It conflicts with the `s` parameter. You can remove the `GROUP BY` entirely to fix it, but you shouldn't do this for every WP\_Query. I use the following class often to approach this: ``` /** * Search Within a T...
106,756
<p>I have set up my blog (WP 3.4) the following way: I had created pages in my blog, so that I have them as separate navigation items in the header (it looks like: Home, PageA, PageB, etc.). What I want to do now is to create posts on the pages. When I create posts, there is no way to select the page, where my post sh...
[ { "answer_id": 106751, "author": "Mat_", "author_id": 9122, "author_profile": "https://wordpress.stackexchange.com/users/9122", "pm_score": -1, "selected": false, "text": "<p>I think that you're probably registering your custom taxonomies in the <code>init</code> action hook. However, if...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106756", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34170/" ]
I have set up my blog (WP 3.4) the following way: I had created pages in my blog, so that I have them as separate navigation items in the header (it looks like: Home, PageA, PageB, etc.). What I want to do now is to create posts on the pages. When I create posts, there is no way to select the page, where my post shoul...
This is a result of a problematic `GROUP BY` clause that's added to WP\_Query when `tax_query` is present. It conflicts with the `s` parameter. You can remove the `GROUP BY` entirely to fix it, but you shouldn't do this for every WP\_Query. I use the following class often to approach this: ``` /** * Search Within a T...
106,784
<p>Ok, I've seen some similar posts on how to change a custom post type's attributes after it has been registered (in my case, I'm trying to modify a custom post type created by a plugin without modifying the plugin files). </p> <p>This appears to be working for some properties:</p> <pre><code>function change_wp_obje...
[ { "answer_id": 106751, "author": "Mat_", "author_id": 9122, "author_profile": "https://wordpress.stackexchange.com/users/9122", "pm_score": -1, "selected": false, "text": "<p>I think that you're probably registering your custom taxonomies in the <code>init</code> action hook. However, if...
2013/07/16
[ "https://wordpress.stackexchange.com/questions/106784", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35400/" ]
Ok, I've seen some similar posts on how to change a custom post type's attributes after it has been registered (in my case, I'm trying to modify a custom post type created by a plugin without modifying the plugin files). This appears to be working for some properties: ``` function change_wp_object() { $object = ge...
This is a result of a problematic `GROUP BY` clause that's added to WP\_Query when `tax_query` is present. It conflicts with the `s` parameter. You can remove the `GROUP BY` entirely to fix it, but you shouldn't do this for every WP\_Query. I use the following class often to approach this: ``` /** * Search Within a T...
106,792
<p>Suppose I created a custom metabox for the add/edit post page that uses a wide width (not suitable for being in the sidebar), is there a way of keeping it in the middle column only and sortable while not allowing the user to drag it to the side bar?</p>
[ { "answer_id": 106805, "author": "iyrin", "author_id": 33393, "author_profile": "https://wordpress.stackexchange.com/users/33393", "pm_score": 2, "selected": false, "text": "<p>If you want the meta box to appear below the content area, use the context parameter 'normal'. See <a href=\"ht...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106792", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35405/" ]
Suppose I created a custom metabox for the add/edit post page that uses a wide width (not suitable for being in the sidebar), is there a way of keeping it in the middle column only and sortable while not allowing the user to drag it to the side bar?
First of all, thanks to RyanLoremIpsum for pointing me to the right direction. I've found the solution to my problem, which uses the method from the post suggested by Ryan [Block metabox - No expanding, no moving around](https://wordpress.stackexchange.com/a/73806) and the answer from [jQuery UI Sortable - prevent drop...
106,810
<p>I see galleries are represented as separate post records with <code>post_type = 'gallery'</code> in the database.</p> <p>How is this record (gallery) associated with a basic post (<code>type = 'post'</code>) in the terms of database records?</p>
[ { "answer_id": 106817, "author": "iyrin", "author_id": 33393, "author_profile": "https://wordpress.stackexchange.com/users/33393", "pm_score": 0, "selected": false, "text": "<p>If you have a custom post type called 'gallery', you should be able to find it fairly easy if you can browse th...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106810", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35361/" ]
I see galleries are represented as separate post records with `post_type = 'gallery'` in the database. How is this record (gallery) associated with a basic post (`type = 'post'`) in the terms of database records?
WordPress galleries are implemented as [shortcodes](http://codex.wordpress.org/Shortcode_API): the `[gallery]` shortcode should appear in the `post_content` of your "basic" post (whose `post_type = 'post'`). The shortcode's parameters specify the images to be included in the gallery by giving the post ID of the `attach...
106,820
<p>I put these inside wp-admin/php.ini</p> <pre><code>upload_max_filesize = 75M post_max_size = 75M max_execution_time = 300 </code></pre> <p>Still not working, please advice if i am doing the right way or not?</p>
[ { "answer_id": 106823, "author": "Pankaj Gupta", "author_id": 35419, "author_profile": "https://wordpress.stackexchange.com/users/35419", "pm_score": 2, "selected": false, "text": "<p>Please contact your host and ask them what is the default size of file a user can upload. They might hav...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106820", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35414/" ]
I put these inside wp-admin/php.ini ``` upload_max_filesize = 75M post_max_size = 75M max_execution_time = 300 ``` Still not working, please advice if i am doing the right way or not?
Please contact your host and ask them what is the default size of file a user can upload. They might have lesser value in their system. If you talk to them on their chat, I think this issue will be solved.
106,830
<p>I wanted to duplicate my WordPress site, and make just a few small changes to the duplicate. However, after duplicating the site, I have had problems with the links sending the user back to the original site. Both the original and duplicate site should function. Here are the steps I have taken:</p> <ol> <li>I dupli...
[ { "answer_id": 106836, "author": "rolz", "author_id": 35414, "author_profile": "https://wordpress.stackexchange.com/users/35414", "pm_score": 0, "selected": false, "text": "<p>Wordpress site migration I usually do the following steps:</p>\n\n<ul>\n<li>Upload the database.</li>\n<li>Updat...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106830", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31382/" ]
I wanted to duplicate my WordPress site, and make just a few small changes to the duplicate. However, after duplicating the site, I have had problems with the links sending the user back to the original site. Both the original and duplicate site should function. Here are the steps I have taken: 1. I duplicated my enti...
In response to @krysiek's comment above, I simply selected the default permalink setting, saved, then selected correct permalink setting and resaved. Works perfectly.
106,854
<p>I've created a custom field using ACF to display the editors of a page (this may be a comma separated list of a few) including a link to their archive, but all I'm getting is a plain text 'Array'. Could someone help me get this right? For some reason I'm not finding the right info through the documentation.</p> <pr...
[ { "answer_id": 106970, "author": "RRikesh", "author_id": 17305, "author_profile": "https://wordpress.stackexchange.com/users/17305", "pm_score": 2, "selected": true, "text": "<p>You can use <a href=\"http://codex.wordpress.org/Function_Reference/get_author_posts_url\" rel=\"nofollow\"><c...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106854", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9371/" ]
I've created a custom field using ACF to display the editors of a page (this may be a comma separated list of a few) including a link to their archive, but all I'm getting is a plain text 'Array'. Could someone help me get this right? For some reason I'm not finding the right info through the documentation. ``` if(get...
You can use [`get_author_posts_url()`](http://codex.wordpress.org/Function_Reference/get_author_posts_url) or [`get_the_author_meta()`](http://codex.wordpress.org/Function_Reference/get_the_author_meta): ``` $values = get_field( 'editor' ); if ( $values ) { $editors = array(); foreach ( $values as $value ) { $...
106,857
<p>I have a php script that executes a function and creates an xml file with results. I want this script runs only once daily and i'm using wordpress cron to do this. Problem is this script always runs on all pages load and this is bad because it takes more than 30 sec to complete. How can i stop it always runs and mak...
[ { "answer_id": 106869, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 1, "selected": false, "text": "<p>WP_Cron isn't a real cron scheduler.</p>\n\n<p>What it does is schedule events, mark when they should be run, and wa...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106857", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35378/" ]
I have a php script that executes a function and creates an xml file with results. I want this script runs only once daily and i'm using wordpress cron to do this. Problem is this script always runs on all pages load and this is bad because it takes more than 30 sec to complete. How can i stop it always runs and make i...
WP\_Cron isn't a real cron scheduler. What it does is schedule events, mark when they should be run, and wait for page traffic. When the site is loaded, it checks to see if any of these tasks need to be run (i.e. the time they were scheduled for has passed) and runs them. So you see, WordPress' cron system is entirely...
106,859
<p>Ok, I've looked through the forum here, but haven't found quite what I'm looking for. I wanted to see if it was possible to add a Metabox to all custom post types without the need to setup an array? Or, maybe just the CPTs created using Custom Post Types UI plugin? </p> <p>Here's the code I'm testing, but it onl...
[ { "answer_id": 106866, "author": "Pat J", "author_id": 16121, "author_profile": "https://wordpress.stackexchange.com/users/16121", "pm_score": 1, "selected": false, "text": "<p>The 4th parameter for <code>add_meta_box()</code> is the <code>post_type</code>. So if you're calling it with ...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106859", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35190/" ]
Ok, I've looked through the forum here, but haven't found quite what I'm looking for. I wanted to see if it was possible to add a Metabox to all custom post types without the need to setup an array? Or, maybe just the CPTs created using Custom Post Types UI plugin? Here's the code I'm testing, but it only shows up on...
The 4th parameter for `add_meta_box()` is the `post_type`. So if you're calling it with `post`, it'll only show on WordPress's native posts. Try this: ``` add_meta_box( 'my-meta-box-id2', 'Enter your PDF location for your post category below:', 'cd2_meta_box_cb', 'your_custom_post_type_name', 'nor...
106,861
<p>I've got a site with a News page (archive for category 'news') and a separate Blog page. When I make a post for the News page I select the category 'news'. So, on the news page you only see the posts marked news, but on the blog page you can see all posts. What I would like to do is preferably show all posts EXCEPT ...
[ { "answer_id": 106863, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": false, "text": "<p>You can do it with <a href=\"http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts\" r...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106861", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35437/" ]
I've got a site with a News page (archive for category 'news') and a separate Blog page. When I make a post for the News page I select the category 'news'. So, on the news page you only see the posts marked news, but on the blog page you can see all posts. What I would like to do is preferably show all posts EXCEPT the...
Thank you for replying to my question but after trying to do something else I have managed to work out the answer, and what I believe to be the easiest and shortest answer. In the main loop for posting the posts you will see something along the lines of ``` <?php if (have_posts()) : while (have_posts()) : the_post();...
106,876
<p>Should I always deregister script or not?</p> <p>Right now I am using this:</p> <pre><code>add_action('wp_enqueue_scripts', 'js_jqTransform', 20); function js_jqTransform() { wp_register_script('jqTransform', get_template_directory_uri() . '/js/jqtransform/jqtransformplugin/jquery.jqtransform.js', false, null)...
[ { "answer_id": 106863, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": false, "text": "<p>You can do it with <a href=\"http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts\" r...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106876", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17368/" ]
Should I always deregister script or not? Right now I am using this: ``` add_action('wp_enqueue_scripts', 'js_jqTransform', 20); function js_jqTransform() { wp_register_script('jqTransform', get_template_directory_uri() . '/js/jqtransform/jqtransformplugin/jquery.jqtransform.js', false, null); wp_enqueue_scri...
Thank you for replying to my question but after trying to do something else I have managed to work out the answer, and what I believe to be the easiest and shortest answer. In the main loop for posting the posts you will see something along the lines of ``` <?php if (have_posts()) : while (have_posts()) : the_post();...
106,886
<p>I am trying to print the post excerpt using the following code:</p> <pre><code>&lt;?php echo $post-&gt;post_excerpt; ?&gt; </code></pre> <p>It works fantastic the only problem is that apparently I get also predefined styles and I cannot get rid of them. How can I get the raw text - is there a different function ...
[ { "answer_id": 106863, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": false, "text": "<p>You can do it with <a href=\"http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts\" r...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106886", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34216/" ]
I am trying to print the post excerpt using the following code: ``` <?php echo $post->post_excerpt; ?> ``` It works fantastic the only problem is that apparently I get also predefined styles and I cannot get rid of them. How can I get the raw text - is there a different function or maybe there is a php function th...
Thank you for replying to my question but after trying to do something else I have managed to work out the answer, and what I believe to be the easiest and shortest answer. In the main loop for posting the posts you will see something along the lines of ``` <?php if (have_posts()) : while (have_posts()) : the_post();...
106,888
<p>I have made a page template for a Genesis theme in which I want to change the <code>&lt;title&gt;</code> tag but I can't find any API reference or example to do this.</p> <p>Does anyone have any idea how to do this?</p>
[ { "answer_id": 107210, "author": "Tyler K", "author_id": 35547, "author_profile": "https://wordpress.stackexchange.com/users/35547", "pm_score": 1, "selected": false, "text": "<p>Try</p>\n\n<pre><code>add_filter('wp_title', 'my_custom_title');\nfunction my_custom_title($title) {\n ret...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106888", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11998/" ]
I have made a page template for a Genesis theme in which I want to change the `<title>` tag but I can't find any API reference or example to do this. Does anyone have any idea how to do this?
Try ``` add_filter('wp_title', 'my_custom_title'); function my_custom_title($title) { return 'My Custom Title'; } ``` Check genesis/lib/structure/header.php to see how Genesis does it.
106,892
<p>How to force jquery to load as a first script in header?</p> <p>Right now it's the last ;( like:</p> <pre><code>&lt;link type="text/css" rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" /&gt; &lt;link type="text/css" rel="stylesheet" href="http://cdnjs.c...
[ { "answer_id": 106898, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 3, "selected": true, "text": "<p>All JS that is <a href=\"http://codex.wordpress.org/Function_Reference/wp_enqueue_script\" rel=\"nofollow...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106892", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17368/" ]
How to force jquery to load as a first script in header? Right now it's the last ;( like: ``` <link type="text/css" rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" /> <link type="text/css" rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jquery...
All JS that is [properly enqueued](http://codex.wordpress.org/Function_Reference/wp_enqueue_script) will be added to your header at the very point where you, or the theme designer, respectively, included [`wp_head()`](http://codex.wordpress.org/Function_Reference/wp_head). Ideally, you should also enqueue your custom ...
106,895
<p>What is the condition to check if we are in admin or frontend?</p> <p>I want to add_action not in backend, but only in frontend.</p>
[ { "answer_id": 106896, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 5, "selected": true, "text": "<p>Take a look at the <a href=\"http://codex.wordpress.org/Function_Reference/is_admin\" rel=\"noreferrer\">...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106895", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17368/" ]
What is the condition to check if we are in admin or frontend? I want to add\_action not in backend, but only in frontend.
Take a look at the [`is_admin()`](http://codex.wordpress.org/Function_Reference/is_admin) [conditional tag](http://codex.wordpress.org/Conditional_Tags): ``` function wpse106895_dummy_func() { if ( ! is_admin() ) { // do your thing } } add_action( 'some-hook', 'wpse106895_dummy_func' ); ``` [`is_admi...
106,922
<p>I would like to call a javascript function after user attaches something to post. I hooked the <code>add_attachment</code> hook, and processed what I want. However, how can I call a function in a Javascript loaded in the post edit page? Just printing the javascript in the function doesn't work, as I guessed.</p> <p...
[ { "answer_id": 106941, "author": "Vitaliy Kukin", "author_id": 34421, "author_profile": "https://wordpress.stackexchange.com/users/34421", "pm_score": -1, "selected": false, "text": "<p>use <a href=\"http://api.jquery.com/ready/\" rel=\"nofollow\">$.ready</a> <code>jQuery(document).ready...
2013/07/17
[ "https://wordpress.stackexchange.com/questions/106922", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31039/" ]
I would like to call a javascript function after user attaches something to post. I hooked the `add_attachment` hook, and processed what I want. However, how can I call a function in a Javascript loaded in the post edit page? Just printing the javascript in the function doesn't work, as I guessed. ``` function analyse...
did you try the image editor class hooks? try: image\_editor\_save\_pre more information about the hooks changes: <http://make.wordpress.org/core/2012/12/06/wp_image_editor-is-incoming/> <http://codex.wordpress.org/Class_Reference/WP_Image_Editor>
106,943
<p>Here is the link for the website - <a href="http://zigzagadvertising.com.ph/aleemguiapal/97-2/" rel="nofollow">http://zigzagadvertising.com.ph/aleemguiapal/97-2/</a></p> <p>I have a problem regarding my forms in wordpress. Whenever i click on the submit button it returns to the index page instead of sending the dat...
[ { "answer_id": 106941, "author": "Vitaliy Kukin", "author_id": 34421, "author_profile": "https://wordpress.stackexchange.com/users/34421", "pm_score": -1, "selected": false, "text": "<p>use <a href=\"http://api.jquery.com/ready/\" rel=\"nofollow\">$.ready</a> <code>jQuery(document).ready...
2013/07/18
[ "https://wordpress.stackexchange.com/questions/106943", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35356/" ]
Here is the link for the website - <http://zigzagadvertising.com.ph/aleemguiapal/97-2/> I have a problem regarding my forms in wordpress. Whenever i click on the submit button it returns to the index page instead of sending the data into an email address **This is my PHP code which i placed on top of the Header.php....
did you try the image editor class hooks? try: image\_editor\_save\_pre more information about the hooks changes: <http://make.wordpress.org/core/2012/12/06/wp_image_editor-is-incoming/> <http://codex.wordpress.org/Class_Reference/WP_Image_Editor>