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
75,563
<p>I migrated our old blog to the same server in the main root. For some reason a couple of images won't load up any more even when they are in the /uploads/ folder. When going to them as a URL I'm getting 404's but I can download them straight from my FTP (and work). </p> <p>Does anyone know what the problem might be...
[ { "answer_id": 75586, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": -1, "selected": false, "text": "<p>You probably need to update your wp_posts table with the new URL of the images. Look for the \"guid\" field for a...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75563", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20548/" ]
I migrated our old blog to the same server in the main root. For some reason a couple of images won't load up any more even when they are in the /uploads/ folder. When going to them as a URL I'm getting 404's but I can download them straight from my FTP (and work). Does anyone know what the problem might be? I was ...
Check the image file permissions. And check the path in page source to be sure the images are in the correct location.
75,565
<p>I have a very big multisite. And I got a request to enable option that multiple users can use the same email. I found a plugin "Allow Multiple Accounts" which doesn't work properly. I should figure out some other solution for that. I know that I could use something like adding +sometext to every email, so it will sh...
[ { "answer_id": 75697, "author": "Parham", "author_id": 21163, "author_profile": "https://wordpress.stackexchange.com/users/21163", "pm_score": 5, "selected": true, "text": "<p>You can use <code>wpmu_validate_user_signup</code> filter to remove the error and then define <code>WP_IMPORTING...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75565", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22671/" ]
I have a very big multisite. And I got a request to enable option that multiple users can use the same email. I found a plugin "Allow Multiple Accounts" which doesn't work properly. I should figure out some other solution for that. I know that I could use something like adding +sometext to every email, so it will show ...
You can use `wpmu_validate_user_signup` filter to remove the error and then define `WP_IMPORTING` just to skip the `email_exist()` check in `wp_insert_user()` function: ``` add_filter('wpmu_validate_user_signup', 'skip_email_exist'); function skip_email_exist($result){ if(isset($result['errors']->errors['user_emai...
75,572
<p>I want to get the recent comments on all posts in a multisite network, and I want to display these ceomments in a sidebar on the multisites "mother" blog. To complicate: All blogs are forced to post in either category A or category B. I want two outputs on the mother blog, showing comments on posts in category A and...
[ { "answer_id": 75592, "author": "gmaliar", "author_id": 24643, "author_profile": "https://wordpress.stackexchange.com/users/24643", "pm_score": 2, "selected": false, "text": "<p>Well it is quite possible, when using a multisite you have a few extra tables in your database.\nOne of them i...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75572", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23323/" ]
I want to get the recent comments on all posts in a multisite network, and I want to display these ceomments in a sidebar on the multisites "mother" blog. To complicate: All blogs are forced to post in either category A or category B. I want two outputs on the mother blog, showing comments on posts in category A and a ...
Well it is quite possible, when using a multisite you have a few extra tables in your database. One of them is one that is called wp\_site which has inside it a list of all your blogs. It looks something like ``` site_id | blog_id | some other vars ... 1 1 ... 1 2 ... 1 3 ...
75,579
<p>I have written a web-page which is a web-app (a simple card database using php, mysql, and styled with css3). The page works as expected. </p> <p>A friend of mine proposed me to use wordpress for everything else to save time on coding - welcome page, etc, so I decided to try it out. I need to lock the page to users...
[ { "answer_id": 75585, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": 0, "selected": false, "text": "<p>I guess, your paths do not point to actual files. Try Firebug or similar to check where your browser is requesting...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75579", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24310/" ]
I have written a web-page which is a web-app (a simple card database using php, mysql, and styled with css3). The page works as expected. A friend of mine proposed me to use wordpress for everything else to save time on coding - welcome page, etc, so I decided to try it out. I need to lock the page to users with pass...
Ok. 1. M-R is right about using the full paths and not relative URLs. Make sure to do that. 2. Create a page from wp-admin->Pages named whatever you want. The title will be used to construct the URL so choose carefully 3. Assign this page to your template "Tarot" 4. The page should be accessible, but to everyone, logg...
75,590
<p>When I am putting a WordPress value inside the attribute tag, for example, the following method does not need <code>esc_attr</code></p> <p>e.g.</p> <pre><code>// JS code alert('&lt;?php echo get_bloginfo('name');?&gt;'); </code></pre> <p>the following method does need <code>esc_attr</code></p> <pre><code>// JS c...
[ { "answer_id": 75591, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": 0, "selected": false, "text": "<p>If your post title has single quote in it. Output of your code would be</p>\n\n<p>alert('It's bad');</p>\n\n<p>tha...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75590", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13654/" ]
When I am putting a WordPress value inside the attribute tag, for example, the following method does not need `esc_attr` e.g. ``` // JS code alert('<?php echo get_bloginfo('name');?>'); ``` the following method does need `esc_attr` ``` // JS code alert('<?php echo esc_attr($post->post_title);?>'); ``` What is th...
[You can look at the Codex](http://codex.wordpress.org/Function_Reference/esc_attr). > > Encodes < > & " ' (less than, greater than, ampersand, double quote, > single quote). Will never double encode entities. > > > Given that, arguably, [both of those strings need sanitization](http://codex.wordpress.org/Data_V...
75,604
<p>I have a wordpress site where the category base is stripped from the url. </p> <p>Now, when a category has a certain slug that's similar to a post slug, the category is shown.</p> <p>I would like to show the post instead. Is this possible?</p> <p>Thanks!</p>
[ { "answer_id": 75617, "author": "Parham", "author_id": 21163, "author_profile": "https://wordpress.stackexchange.com/users/21163", "pm_score": 1, "selected": false, "text": "<p>I think you can use the answer to <a href=\"https://wordpress.stackexchange.com/questions/22438/how-to-make-pag...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75604", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24647/" ]
I have a wordpress site where the category base is stripped from the url. Now, when a category has a certain slug that's similar to a post slug, the category is shown. I would like to show the post instead. Is this possible? Thanks!
There isn't a clean way to do what you're asking. What you want is for WordPress to check to see if, for a given URL, there is a post with that slug, and if not, try to find a category with that slug. With the exception of pages, WordPress doesn't check to see if an opject (post, term) exists before "committing" to a m...
75,605
<p>Sorry if this is already answered on here. I looked around and couldn't see any answers to my question so I thought I'd post my own.</p> <p>I'm building a plugin for a client that gathers customer feedback on a recent project that has been completed.</p> <p>The admin would use the system to send a "prompt" to the ...
[ { "answer_id": 75705, "author": "Caleuanhopkins", "author_id": 24675, "author_profile": "https://wordpress.stackexchange.com/users/24675", "pm_score": 2, "selected": false, "text": "<p><em>edit</em> Have you tried placing <code>print_r('hello world'); die();</code> after <code>function s...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75605", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7583/" ]
Sorry if this is already answered on here. I looked around and couldn't see any answers to my question so I thought I'd post my own. I'm building a plugin for a client that gathers customer feedback on a recent project that has been completed. The admin would use the system to send a "prompt" to the customer asking t...
> > The "save\_post" action is only called when we actually changed > something in the post page form. If we just press the update button, > without changing anything, the "save\_post" action is not called. > > > This is important if we are editing a custom post type where we had > custom meta boxes. If we rely o...
75,626
<p>I'm using the <a href="http://wordpress.org/extend/plugins/taxonomy-images/" rel="nofollow">Taxonomy Images plugin</a> to try to pull in the category images for custom categories on a page that displays all the categories my site has. For some reason, this code outputs the correct names and descriptions, but will on...
[ { "answer_id": 75653, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 1, "selected": false, "text": "<p>I <em>think</em> (at least part of) the problem is that you've got a nested loop where you don't really nee...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75626", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23689/" ]
I'm using the [Taxonomy Images plugin](http://wordpress.org/extend/plugins/taxonomy-images/) to try to pull in the category images for custom categories on a page that displays all the categories my site has. For some reason, this code outputs the correct names and descriptions, but will only show one category image. ...
Chip was on the right path, but closing the first loop would only publish one category instead of every category. What I ended up doing was closing the first loop and calling the ID and the img inside the second loop. ``` $imgs = get_option( 'taxonomy_image_plugin' ); $categories = get_terms('portfolio_category', arr...
75,631
<p>I have few posts which have a dropcap shortcode wrapped around the first character like so:</p> <pre><code>[dropcap]T[/dropcap]his is a dropcap. </code></pre> <p>The replacement for this shortcode yields:</p> <pre><code>&lt;span class="dropcap"&gt;T&lt;/span&gt;his is a dropcap. </code></pre> <p>However, when I...
[ { "answer_id": 75633, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>The <a href=\"http://codex.wordpress.org/Function_Reference/the_excerpt\" rel=\"nofollow\"><strong><code>th...
2012/12/10
[ "https://wordpress.stackexchange.com/questions/75631", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6620/" ]
I have few posts which have a dropcap shortcode wrapped around the first character like so: ``` [dropcap]T[/dropcap]his is a dropcap. ``` The replacement for this shortcode yields: ``` <span class="dropcap">T</span>his is a dropcap. ``` However, when I call the\_excerpt() or get\_the\_excerpt() on these posts, i...
You can make WordPress execute your shortcode in the excerpt by hooking into `get_the_excerpt` filter and overwriting the default `wp_trim_excerpt` function, which is responsible of stripping the shortcode tags from the excerpt as pointed by Chip: ``` add_filter('get_the_excerpt', 'do_my_shortcode_in_excerpt'); functi...
75,655
<p>I'm trying to get post's permalinks outside of the loop via a wordress plugin. Nothing seems to be working. Here is the original code that does not link to any permalink. </p> <pre><code>public function get_comments_count($single){ if (isset($this-&gt;params['comments']) &amp;&amp; $this-&gt;params['comment...
[ { "answer_id": 75658, "author": "barakadam", "author_id": 23571, "author_profile": "https://wordpress.stackexchange.com/users/23571", "pm_score": -1, "selected": false, "text": "<p>Inside your function, you are outside of scope from your loop. You should call the function with the ID of ...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75655", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24379/" ]
I'm trying to get post's permalinks outside of the loop via a wordress plugin. Nothing seems to be working. Here is the original code that does not link to any permalink. ``` public function get_comments_count($single){ if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){ r...
According to: <http://wpseek.com/get_comment_count/> `$single` is the post ID. Try: ``` public function get_comment_count($single){ if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){ return '<div id="disquscomments"><a href="'.get_permalink($single).'#disqus_thread">Comments</a><...
75,666
<p>What do I need to do in order to have the author name in the blog posts on my wordpress blog?</p> <p>currently when I view a post it doesn't have the author that wrote the post. </p>
[ { "answer_id": 75658, "author": "barakadam", "author_id": 23571, "author_profile": "https://wordpress.stackexchange.com/users/23571", "pm_score": -1, "selected": false, "text": "<p>Inside your function, you are outside of scope from your loop. You should call the function with the ID of ...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75666", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24665/" ]
What do I need to do in order to have the author name in the blog posts on my wordpress blog? currently when I view a post it doesn't have the author that wrote the post.
According to: <http://wpseek.com/get_comment_count/> `$single` is the post ID. Try: ``` public function get_comment_count($single){ if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){ return '<div id="disquscomments"><a href="'.get_permalink($single).'#disqus_thread">Comments</a><...
75,675
<p>I'm trying to filter out the excerpt by character length for a plugin called "List Category Posts". I've been trying to get the excerpts working for the past week, but nothing is doing the trick. The plugin actually comes with a feature that allows you to post the excerpt or not, then filter it by character length....
[ { "answer_id": 75680, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": true, "text": "<p>You need to have</p>\n\n<pre><code>'excerpt' =&gt; 'yes',\n'excerpt_size' =&gt; '100',\n'content' =&gt; 'no'\n...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75675", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24379/" ]
I'm trying to filter out the excerpt by character length for a plugin called "List Category Posts". I've been trying to get the excerpts working for the past week, but nothing is doing the trick. The plugin actually comes with a feature that allows you to post the excerpt or not, then filter it by character length.. by...
You need to have ``` 'excerpt' => 'yes', 'excerpt_size' => '100', 'content' => 'no' ``` ... when `get_excerpt` runs. You can set `$params` like that but what you posted is not all of the code. It is using `$this` which means it is part of a class (or you'd get errors). Somewhere in that class something might be alte...
75,687
<p>I am new to wordpress, I am creating a plugin and for the short code, I am using the short code api. But when I insert this shortcode in my page, it displayes as it is, it does not display the required output. Can asny body tell me what i am doing wrong? Am I calling or creating the function on right place or not? B...
[ { "answer_id": 75688, "author": "barakadam", "author_id": 23571, "author_profile": "https://wordpress.stackexchange.com/users/23571", "pm_score": -1, "selected": true, "text": "<p>Your code seems Ok, but is your plug-in correctly installed? You have to upload your urp_functions.php in a ...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75687", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24671/" ]
I am new to wordpress, I am creating a plugin and for the short code, I am using the short code api. But when I insert this shortcode in my page, it displayes as it is, it does not display the required output. Can asny body tell me what i am doing wrong? Am I calling or creating the function on right place or not? Belo...
Your code seems Ok, but is your plug-in correctly installed? You have to upload your urp\_functions.php in a folder inside the /wp-content/plugins/ folder and in your urp\_functions.php file, you have to insert comments so it gets detected as a plugin. here is the example comment on WordPress codex : ``` <?php /* Plug...
75,691
<p>Is there a way to limit the word count of the post title?</p> <p>I searched over the internet but found nothing.</p> <p>All I know is, only the content of the post can be limited or excerpted.</p>
[ { "answer_id": 75694, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 0, "selected": false, "text": "<pre><code>function limit_word_count($title) {\n $len = 5; //change this to the number of words\n i...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75691", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24673/" ]
Is there a way to limit the word count of the post title? I searched over the internet but found nothing. All I know is, only the content of the post can be limited or excerpted.
simply use this where ever you want to display your title with limited words ``` <?php echo wp_trim_words( get_the_title(), 5 ); ?> ``` replace number 5 in above code with whatever number of words you need to display. Regards.
75,708
<p>I've written a plugin which retrieves an xml file, parses and creates a series of short posts from the content.</p> <p>Although each post is very short (sometimes just a single sentence, never more than a few sentences), there are around 1000 posts to create from the file. </p> <p>Using wp_insert_post takes enough...
[ { "answer_id": 75711, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": true, "text": "<p>You can access the database with an <a href=\"http://dev.mysql.com/doc/refman/5.5/en/insert.html\" rel=\"nofollow\">INS...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75708", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24678/" ]
I've written a plugin which retrieves an xml file, parses and creates a series of short posts from the content. Although each post is very short (sometimes just a single sentence, never more than a few sentences), there are around 1000 posts to create from the file. Using wp\_insert\_post takes enough time for this ...
You can access the database with an [INSERT statement](http://dev.mysql.com/doc/refman/5.5/en/insert.html) and add multiple rows at once. Something like this pseudo-code: ``` INSERT INTO $wpdb->posts ( `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_status`, `post_name`, `post_...
75,709
<p>I want to get the template in the theme which being in use of the current edited post(_type)/Page.</p> <p>Lets say im editing a single Post, Then i want to retrive that it using the template <code>single.php</code></p> <p>And if im editing a Custom Post Type that have its own <code>single-{post_type}.php</code> i ...
[ { "answer_id": 75719, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 3, "selected": true, "text": "<p>Basically this isn't available in admin. You can take a look at my profile, go to my github page and grab the <a hre...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75709", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16722/" ]
I want to get the template in the theme which being in use of the current edited post(\_type)/Page. Lets say im editing a single Post, Then i want to retrive that it using the template `single.php` And if im editing a Custom Post Type that have its own `single-{post_type}.php` i want to retrive that. How can i arch...
Basically this isn't available in admin. You can take a look at my profile, go to my github page and grab the ["current admin info" plugin](https://github.com/franz-josef-kaiser/current-admin-info). But this won't help you much. This would show you the template name: ``` get_page_template_slug( get_queried_object_id(...
75,712
<p>I'm having problems getting all related posts of the current viewing tag. Does anyone know how you can do this dynamic? I want to create a own kind of 'archive' page for this. </p>
[ { "answer_id": 75714, "author": "Sven", "author_id": 24680, "author_profile": "https://wordpress.stackexchange.com/users/24680", "pm_score": 0, "selected": false, "text": "<p>You can use the default <a href=\"http://codex.wordpress.org/Template_Tags/get_posts\" rel=\"nofollow\"><code>get...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75712", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20548/" ]
I'm having problems getting all related posts of the current viewing tag. Does anyone know how you can do this dynamic? I want to create a own kind of 'archive' page for this.
Ok .. after searching for a while I figured out what I was doing wrong. I wasn't including custom post types in the loop. I ended up constantly with 'not found'. Whats the solution: ``` query_posts( array( 'post_type' => 'blog', 'showposts' => 3, 'orderby' => 'rand') ); if ( have_posts() ) : while ( have_posts() ) :...
75,734
<p>I want to get the current category details that the user is on in category.php.</p> <pre><code>$category = get_the_category(); $slug = $category[0]-&gt;slug; // Why is this an array ? </code></pre> <p>In most cases (where there are no sub-categories) it returns and array of single length.</p> <p>But if there are...
[ { "answer_id": 75761, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 4, "selected": true, "text": "<p>You are using the wrong function. Try:</p>\n\n<pre><code>$thiscat = $wp_query-&gt;get_queried_object();\nvar_d...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75734", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24322/" ]
I want to get the current category details that the user is on in category.php. ``` $category = get_the_category(); $slug = $category[0]->slug; // Why is this an array ? ``` In most cases (where there are no sub-categories) it returns and array of single length. But if there are sub-categories it (parent category ...
You are using the wrong function. Try: ``` $thiscat = $wp_query->get_queried_object(); var_dump($thiscat); ``` I don't know exactly what you want to do with this information but you will get an object (stdClass) with ~15 items in it. You should be able to find what you need.
75,773
<p>I have used $count before, but never run into this problem. I cannot get it to work. I have limited php background, so please be patient with me! Here is the $count setup code:</p> <pre><code>&lt;?php $count = 0; ?&gt; &lt;?php if ( have_posts() ) : // Start the Loop ?&gt; &lt;?php $count++; ?&gt; ...
[ { "answer_id": 75775, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": 0, "selected": false, "text": "<p>How about using the $GLOBALS['count'] to make it surely available everywhere.</p>\n" }, { "answer_id": 757...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75773", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5861/" ]
I have used $count before, but never run into this problem. I cannot get it to work. I have limited php background, so please be patient with me! Here is the $count setup code: ``` <?php $count = 0; ?> <?php if ( have_posts() ) : // Start the Loop ?> <?php $count++; ?> <?php while ( have_posts() ) : the_...
The variable `$count` is accessible in the scope of the current function only. So whatever happens inside `get_template_part()` cannot know that variable. You could use a global variable, which is accessible everywhere as `$GLOBALS['count']`. But then you risk collisions with plugins and maybe other code. I recommend...
75,783
<p>How can I loop through all Wordpress users in a blog, and sort them in ascending order by their usernames?</p>
[ { "answer_id": 75784, "author": "Andy Adams", "author_id": 6816, "author_profile": "https://wordpress.stackexchange.com/users/6816", "pm_score": 0, "selected": false, "text": "<p>Would the <a href=\"http://codex.wordpress.org/Function_Reference/get_users\" rel=\"nofollow\">get_users</a> ...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75783", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12918/" ]
How can I loop through all Wordpress users in a blog, and sort them in ascending order by their usernames?
Refer to the [**`get_users()`** Codex entry](http://codex.wordpress.org/Function_Reference/get_users). ``` $users = get_users(); ``` You can pass the function an array of arguments, including: ``` $args = array( // Order by username (display name) // Note: 'login' is default 'orderby' => 'display_name',...
75,793
<p>I am customizing a plugin. I needed it to show a list of the categories in hierarchy, which I got working with all of the functions of the plugin. I'm using <code>wp_dropdown_categories</code>, but I'd like to display the list of categories as their slugs, and not as their category names. Any suggestions?</p> <p>He...
[ { "answer_id": 75804, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": true, "text": "<p>There is an argument <code>walker</code> for <code>wp_dropdown_categories()</code>. It accepts an instance of a custom ...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75793", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24676/" ]
I am customizing a plugin. I needed it to show a list of the categories in hierarchy, which I got working with all of the functions of the plugin. I'm using `wp_dropdown_categories`, but I'd like to display the list of categories as their slugs, and not as their category names. Any suggestions? Here's what I have so f...
There is an argument `walker` for `wp_dropdown_categories()`. It accepts an instance of a custom walker, a class extending `Walker_CategoryDropdown` or the generic `Walker`. Let’s create such a class. We have to change just one method. ``` class WPSE_Cat_Slug_Walker extends Walker_Category { function start_el( &$ou...
75,808
<p>Is this possible to do?</p> <p>I love how the new uploader works. I'm guessing it has to do with a jQuery call like the other way did.</p> <p><em>EDIT</em></p> <p>This is the code I am currently using</p> <pre><code>jQuery(document).ready(function($) { $('.custom_upload_image_button').click(function() { imag...
[ { "answer_id": 75823, "author": "ungestaltbar", "author_id": 12449, "author_profile": "https://wordpress.stackexchange.com/users/12449", "pm_score": 4, "selected": true, "text": "<p>To get you started, the basic functions and overrides as far as I know currently.There might be better sol...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75808", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18241/" ]
Is this possible to do? I love how the new uploader works. I'm guessing it has to do with a jQuery call like the other way did. *EDIT* This is the code I am currently using ``` jQuery(document).ready(function($) { $('.custom_upload_image_button').click(function() { imageField = $(this).prev('input'); tb_sho...
To get you started, the basic functions and overrides as far as I know currently.There might be better solutions, but I only had two days with 3.5 yet: ``` // open modal - bind this to your button if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) wp.media.editor.open( ##unique_id_here## ); /...
75,811
<p>This is a fairly new installation. Almost no plugins. Everyting works fine except the dinamically-generated <code>robots.txt</code> gives Error 500. Google doesn't like it much. (won't read my sitemap).</p> <p>All other pages work fine.</p> <p>Permalinks are "default". </p> <p>htaccess on public_html is:</p> <pr...
[ { "answer_id": 75812, "author": "Lenin", "author_id": 23316, "author_profile": "https://wordpress.stackexchange.com/users/23316", "pm_score": 0, "selected": false, "text": "<p>500 internal server error is given to hide actual error message for security reasons.</p>\n\n<p>Your robots.txt ...
2012/12/11
[ "https://wordpress.stackexchange.com/questions/75811", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
This is a fairly new installation. Almost no plugins. Everyting works fine except the dinamically-generated `robots.txt` gives Error 500. Google doesn't like it much. (won't read my sitemap). All other pages work fine. Permalinks are "default". htaccess on public\_html is: ``` # BEGIN WordPress # END WordPress `...
1) Don't alter or edit core Wordpress files or folders. 2) There is no function in Wordpress core that dynamically generates a robots.txt file. The theme you are using is trying to create the robots.txt file with that function in functions.php and must be creating it with the wrong character encoding, and that is caus...
75,831
<p>Let me explain my problem. I have this post that uses multiple categories... and categories are being shown as breadcrumbs</p> <p>I there a way where I can display 1 specific tree?</p> <p>example I have</p> <p><code>game &gt; basketball &gt; teams &gt; team A &gt; players &gt; player1</code></p> <p>and</p> <p><...
[ { "answer_id": 75812, "author": "Lenin", "author_id": 23316, "author_profile": "https://wordpress.stackexchange.com/users/23316", "pm_score": 0, "selected": false, "text": "<p>500 internal server error is given to hide actual error message for security reasons.</p>\n\n<p>Your robots.txt ...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75831", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/974/" ]
Let me explain my problem. I have this post that uses multiple categories... and categories are being shown as breadcrumbs I there a way where I can display 1 specific tree? example I have `game > basketball > teams > team A > players > player1` and `announcement > new players > player1` Now, when I browse game g...
1) Don't alter or edit core Wordpress files or folders. 2) There is no function in Wordpress core that dynamically generates a robots.txt file. The theme you are using is trying to create the robots.txt file with that function in functions.php and must be creating it with the wrong character encoding, and that is caus...
75,855
<p>I used to have an extra option added to the 'Edit Media' screen (using the <code>attachment_fields_to_edit</code> hook, and then saving with <code>attachment_fields_to_save</code>). However, I've updated to 3.5 today, and the Edit Media screen is now based on the Edit Post screen, so those hooks no longer work in th...
[ { "answer_id": 78005, "author": "jontro", "author_id": 23135, "author_profile": "https://wordpress.stackexchange.com/users/23135", "pm_score": 3, "selected": true, "text": "<p>attachment_fields_to_save is still called.</p>\n\n<p>Just tried out this on my wordpress 3.5. installation and t...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75855", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10097/" ]
I used to have an extra option added to the 'Edit Media' screen (using the `attachment_fields_to_edit` hook, and then saving with `attachment_fields_to_save`). However, I've updated to 3.5 today, and the Edit Media screen is now based on the Edit Post screen, so those hooks no longer work in this context. To overcome ...
attachment\_fields\_to\_save is still called. Just tried out this on my wordpress 3.5. installation and the following code killed wordpress when saving an image. ``` add_filter('attachment_fields_to_save', function() { die('attachment_fields_to_save'); }); ```
75,857
<p>I am new to wordpress and learning to create plugins. I want to know how wordpress itself create options in 'wp_options' table for plugin during plugin installation or activation? How wordpress decide about these option values, which is sometimes serialized data?</p>
[ { "answer_id": 78005, "author": "jontro", "author_id": 23135, "author_profile": "https://wordpress.stackexchange.com/users/23135", "pm_score": 3, "selected": true, "text": "<p>attachment_fields_to_save is still called.</p>\n\n<p>Just tried out this on my wordpress 3.5. installation and t...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75857", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24726/" ]
I am new to wordpress and learning to create plugins. I want to know how wordpress itself create options in 'wp\_options' table for plugin during plugin installation or activation? How wordpress decide about these option values, which is sometimes serialized data?
attachment\_fields\_to\_save is still called. Just tried out this on my wordpress 3.5. installation and the following code killed wordpress when saving an image. ``` add_filter('attachment_fields_to_save', function() { die('attachment_fields_to_save'); }); ```
75,859
<p>I have just started to build in Wordpress, and my question is how can I build a few website in WP? After I purchase domains, do I need to install the program every time I want to create a new site?</p>
[ { "answer_id": 78005, "author": "jontro", "author_id": 23135, "author_profile": "https://wordpress.stackexchange.com/users/23135", "pm_score": 3, "selected": true, "text": "<p>attachment_fields_to_save is still called.</p>\n\n<p>Just tried out this on my wordpress 3.5. installation and t...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75859", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24728/" ]
I have just started to build in Wordpress, and my question is how can I build a few website in WP? After I purchase domains, do I need to install the program every time I want to create a new site?
attachment\_fields\_to\_save is still called. Just tried out this on my wordpress 3.5. installation and the following code killed wordpress when saving an image. ``` add_filter('attachment_fields_to_save', function() { die('attachment_fields_to_save'); }); ```
75,863
<p>For some reason the following isn't loaded anymore in wordpress 3.5. Does anyone know how to fix the <code>get_the_post_thumbnail()</code> ?</p> <p>I'm using the follow code:</p> <pre><code>echo "&lt;div class='meta_apps'&gt;"; echo "&lt;a href='"; the_permalink(); echo "'&gt;"; echo "&lt;div class=\"meta-icon\"&g...
[ { "answer_id": 75867, "author": "rwzdoorn", "author_id": 20548, "author_profile": "https://wordpress.stackexchange.com/users/20548", "pm_score": 0, "selected": false, "text": "<p>Problem solved,</p>\n\n<pre><code> echo the_post_thumbnail($post-&gt;post_id, array('class' =&...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75863", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20548/" ]
For some reason the following isn't loaded anymore in wordpress 3.5. Does anyone know how to fix the `get_the_post_thumbnail()` ? I'm using the follow code: ``` echo "<div class='meta_apps'>"; echo "<a href='"; the_permalink(); echo "'>"; echo "<div class=\"meta-icon\">".get_the_post_thumbnail($post->post_id, 'thumbn...
I could be mistaken, but I don't think `$post->post_id` works to retrieve the post's ID. I believe you want `$post->ID`. So that was probably your issue to begin with, though without seeing your `$attr` array, it's hard to say. Here's a reference for [`$post`'s properties](http://codex.wordpress.org/Function_Reference/...
75,874
<p>I'm using <code>wp_list_pages('title_li=')</code> on my site.</p> <p>Some of my pages do have subpages, however I don't want to list them unitl I'm on an actual parent page that has subpages.</p> <p>So imagine my front-page:</p> <pre><code>— About Us — Gallery — Kitchen — Disclaimer </code></pre> <p>When clickin...
[ { "answer_id": 75890, "author": "Andy Adams", "author_id": 6816, "author_profile": "https://wordpress.stackexchange.com/users/6816", "pm_score": 3, "selected": true, "text": "<p>This would probably be better achieved using CSS. First, you hide all .children:</p>\n\n<pre><code>.page_item ...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75874", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3529/" ]
I'm using `wp_list_pages('title_li=')` on my site. Some of my pages do have subpages, however I don't want to list them unitl I'm on an actual parent page that has subpages. So imagine my front-page: ``` — About Us — Gallery — Kitchen — Disclaimer ``` When clicking on Gallery (and Gallery has two subpages) I want ...
This would probably be better achieved using CSS. First, you hide all .children: ``` .page_item .children { display: none; } ``` Then, you show the current\_page\_item's children: ``` .current_page_item .children { display: block; } ```
75,887
<p>I have some folder with images in <code>/wp-content/uploads</code>. I also have a plugin file in <code>/wp-content/plugins</code>. I want to retrieve the images stored in <code>/wp-content/uploads</code> and use them in the plugin file.</p> <p>I have tried</p> <pre><code>echo'&lt;img src="../../USER_PHOTOS/ronny'"...
[ { "answer_id": 75888, "author": "Ronny K", "author_id": 12918, "author_profile": "https://wordpress.stackexchange.com/users/12918", "pm_score": 1, "selected": false, "text": "<p>I found the answer. I used <code>wp_upload_dir();</code> <a href=\"http://codex.wordpress.org/Function_Referen...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75887", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12918/" ]
I have some folder with images in `/wp-content/uploads`. I also have a plugin file in `/wp-content/plugins`. I want to retrieve the images stored in `/wp-content/uploads` and use them in the plugin file. I have tried ``` echo'<img src="../../USER_PHOTOS/ronny'" href="#"></img>'; ``` can someone show me how I can ge...
If I'm not mistaken, you may want to try the [wp\_uploads\_dir](http://codex.wordpress.org/Function_Reference/wp_upload_dir) function, like so: ``` $uploads = wp_upload_dir(); echo '<img src="' . esc_url( $uploads['baseurl'] . '/USER_PHOTOS/ronny/' ) . '" href="#">'; ```
75,906
<p>How in the world can I check if a product is in a certain product category on the <em>single-product.php</em>?</p> <pre><code>&lt;?php if (is_product_category('audio')) { echo 'In audio'; woocommerce_get_template_part( 'content', 'single-product' ); } elseif (is_product_category('el...
[ { "answer_id": 75922, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 0, "selected": false, "text": "<p>I'd look at using the <code>get_categories()</code> function of the WC_Product class.</p>\n\n<p>You can find the...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75906", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24740/" ]
How in the world can I check if a product is in a certain product category on the *single-product.php*? ``` <?php if (is_product_category('audio')) { echo 'In audio'; woocommerce_get_template_part( 'content', 'single-product' ); } elseif (is_product_category('elektro')) { ...
I don't think `get_categories()` is the best option for you in this case because it returns a string with all the categories listed as anchor tags, fine for displaying, but not great for figuring out in code what the categories are. Ok, so the first thing you need to do is grab the product/post object for the current p...
75,912
<p>I am trying to do a tax-query on a hierarchical taxonomy with no tags. I want to show results for the dealer state and brand being viewed by the user. For instance dealers in texas that also carry honda. I only want to show the results if the meta key value of wpcf-paid is 1 for the dealers.</p> <p>I have the be...
[ { "answer_id": 75922, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 0, "selected": false, "text": "<p>I'd look at using the <code>get_categories()</code> function of the WC_Product class.</p>\n\n<p>You can find the...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75912", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24439/" ]
I am trying to do a tax-query on a hierarchical taxonomy with no tags. I want to show results for the dealer state and brand being viewed by the user. For instance dealers in texas that also carry honda. I only want to show the results if the meta key value of wpcf-paid is 1 for the dealers. I have the below code, but...
I don't think `get_categories()` is the best option for you in this case because it returns a string with all the categories listed as anchor tags, fine for displaying, but not great for figuring out in code what the categories are. Ok, so the first thing you need to do is grab the product/post object for the current p...
75,919
<p>Whenever I change my permalink option from the default to /%postname%/, it results into my page cannot be found.</p> <p>Wordpress would complain that it cannot modify the .htaccess (because there was none), so I created it in /var/www/. The .htaccess has the same owner / permissions as my wordpress folder.</p> <p>...
[ { "answer_id": 75922, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 0, "selected": false, "text": "<p>I'd look at using the <code>get_categories()</code> function of the WC_Product class.</p>\n\n<p>You can find the...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75919", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24744/" ]
Whenever I change my permalink option from the default to /%postname%/, it results into my page cannot be found. Wordpress would complain that it cannot modify the .htaccess (because there was none), so I created it in /var/www/. The .htaccess has the same owner / permissions as my wordpress folder. Please help, I've...
I don't think `get_categories()` is the best option for you in this case because it returns a string with all the categories listed as anchor tags, fine for displaying, but not great for figuring out in code what the categories are. Ok, so the first thing you need to do is grab the product/post object for the current p...
75,921
<p>We purchased an SSL certificat from network solutions (would never recommend them to my worst enemy, btw).</p> <p>Apparently it's activated... did a few checks that says it's activated for our domain. But when I put in <a href="https://www.texasshredderclassic.com" rel="noreferrer">https://www.texasshredderclassic....
[ { "answer_id": 75926, "author": "webaware", "author_id": 24260, "author_profile": "https://wordpress.stackexchange.com/users/24260", "pm_score": 0, "selected": false, "text": "<p>Have you tried running <a href=\"http://wordpress.org/extend/plugins/ssl-insecure-content-fixer/\" rel=\"nofo...
2012/12/12
[ "https://wordpress.stackexchange.com/questions/75921", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24745/" ]
We purchased an SSL certificat from network solutions (would never recommend them to my worst enemy, btw). Apparently it's activated... did a few checks that says it's activated for our domain. But when I put in <https://www.texasshredderclassic.com> the entire site breaks. To be more specific, by "breaks," I mean it ...
For the login part, this works for me ... Paste the following line in your wp-config.php ``` if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on'; ``` but make sure that you do it before the following line ``` require_once(ABSPATH . 'wp-settings.php'); ``` By doing so you can get your admin ...
75,937
<p>I have a custom post type "Article" which has a custom field "issue" that is the id number of a "issue" post type that i am selecting using a simple select box. </p> <p>I want to add a drop down of issues to filter the article listing found here:</p> <pre><code>edit.php?post_type=article </code></pre> <p>Is this...
[ { "answer_id": 75971, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 2, "selected": false, "text": "<p>Place following code in your theme <code>functions.php</code>.</p>\n\n<pre><code>function articlesIssuesRequ...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/75937", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19935/" ]
I have a custom post type "Article" which has a custom field "issue" that is the id number of a "issue" post type that i am selecting using a simple select box. I want to add a drop down of issues to filter the article listing found here: ``` edit.php?post_type=article ``` Is this possible? Is this sort of thing d...
I had to modify max answer to get the filter working. Renaming the select to issue\_restrict\_articles stopped it incorrectly filtering & kept the filter controls on the screen. posts\_where filter and a SQL query to actually filter. ``` function restrict_articles_by_issue() { global $wpdb; $issues = $wpdb->g...
75,939
<p>I am currently modifying a theme. This theme doesn't had a category.php I needed a custom category page. So, I made one. It works on my local server, but when I uploaded it to a real server, this page doesn't work. It always redirect to frontpage. It has a front-page.php and other pages include archive.php, index.ph...
[ { "answer_id": 91800, "author": "Jaypee", "author_id": 15574, "author_profile": "https://wordpress.stackexchange.com/users/15574", "pm_score": 1, "selected": false, "text": "<p>Check that your category.php file has no errors first.</p>\n\n<p>Go to Settings -> Permalinks and save it again...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/75939", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23214/" ]
I am currently modifying a theme. This theme doesn't had a category.php I needed a custom category page. So, I made one. It works on my local server, but when I uploaded it to a real server, this page doesn't work. It always redirect to frontpage. It has a front-page.php and other pages include archive.php, index.php, ...
Check that your category.php file has no errors first. Go to Settings -> Permalinks and save it again to rebuild your permalink structure just in case.
75,940
<p>I have my query set up like this:</p> <pre><code>$article_query = new WP_Query(array( 'meta_key' =&gt; 'issue', 'meta_value' =&gt; $post-&gt;ID , 'post_type' =&gt; 'article', 'orderby' =&gt; 'order_number', 'order' =&gt; 'desc' )); ...
[ { "answer_id": 91800, "author": "Jaypee", "author_id": 15574, "author_profile": "https://wordpress.stackexchange.com/users/15574", "pm_score": 1, "selected": false, "text": "<p>Check that your category.php file has no errors first.</p>\n\n<p>Go to Settings -> Permalinks and save it again...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/75940", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19935/" ]
I have my query set up like this: ``` $article_query = new WP_Query(array( 'meta_key' => 'issue', 'meta_value' => $post->ID , 'post_type' => 'article', 'orderby' => 'order_number', 'order' => 'desc' )); ``` I want all the artic...
Check that your category.php file has no errors first. Go to Settings -> Permalinks and save it again to rebuild your permalink structure just in case.
75,941
<p>have a simple plugin that inserts text (a Google ad) partway through the content of a single post. I'm trying to create a settings page that will let users change the ad code, and change after which paragraph the ad appears.</p> <p>I have spent all day reading tutorials and code, and I have a lovely settings page,...
[ { "answer_id": 76071, "author": "Morgan Kay", "author_id": 16808, "author_profile": "https://wordpress.stackexchange.com/users/16808", "pm_score": 0, "selected": false, "text": "<p>I started all over using the Plugin Options Starter Kit plugin - <a href=\"http://www.presscoders.com/plugi...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/75941", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16808/" ]
have a simple plugin that inserts text (a Google ad) partway through the content of a single post. I'm trying to create a settings page that will let users change the ad code, and change after which paragraph the ad appears. I have spent all day reading tutorials and code, and I have a lovely settings page, but I can'...
While you are using Settins API, that's why you don't need to use `update_option` or `add_option` functions. Settings API would handle that by self. There were few issues that's why your code is not working. **1.** ``` add_settings_section( 'wpa_ad_insert_main', 'Ad Insertion Settings', 'wpa_ad_insert_se...
75,956
<p>Assume we have blank WP site and we want to setup SMTP settings programmatically in our plugin or theme. What's the easiest way to do it without changing core files?</p>
[ { "answer_id": 75957, "author": "Eugene Manuilov", "author_id": 8170, "author_profile": "https://wordpress.stackexchange.com/users/8170", "pm_score": 6, "selected": true, "text": "<p>First of all, if we take a look at implementation of <code>wp_mail</code> function, we will see that this...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/75956", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8170/" ]
Assume we have blank WP site and we want to setup SMTP settings programmatically in our plugin or theme. What's the easiest way to do it without changing core files?
First of all, if we take a look at implementation of `wp_mail` function, we will see that this function uses [**`PHPMailer`**](http://core.trac.wordpress.org/browser/tags/3.5/wp-includes/class-phpmailer.php) class to send emails. Also we could notice that there is hard coded function call `$phpmailer->IsMail();`, which...
75,958
<p>I have my menu set up like so:</p> <ul> <li><strong>Shop Online</strong> (WPeC 'Products Page' page) <ul> <li><strong>Product Category</strong> (WPeC Category)</li> <li><strong>Product Category</strong> (WPeC Category) <ul> <li><strong>Product Sub Category</strong> (WPeC Category)</li> <li><strong>Product Sub Categ...
[ { "answer_id": 76337, "author": "Jarryd", "author_id": 21104, "author_profile": "https://wordpress.stackexchange.com/users/21104", "pm_score": -1, "selected": false, "text": "<p>As explained by a support tech over at <a href=\"http://getshopped.org\" rel=\"nofollow\">getshopped.org</a>:<...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/75958", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21104/" ]
I have my menu set up like so: * **Shop Online** (WPeC 'Products Page' page) + **Product Category** (WPeC Category) + **Product Category** (WPeC Category) - **Product Sub Category** (WPeC Category) - **Product Sub Category** (WPeC Category) + ... Single product pages are viewable from any category or sub categ...
Looking for a solution for the same problem, I came across this: ``` add_filter( 'nav_menu_css_class', 'add_parent_url_menu_class', 10, 2 ); function add_parent_url_menu_class( $classes = array(), $item = false ) { // Get current URL $current_url = current_url(); // Get homepage URL $homepage_url = t...
75,981
<p>I'm using simple code to show user social link in author bio. <strong>in functions.php</strong></p> <pre><code>&lt;?php function add_remove_contactmethods( $contactmethods ) { // Add Twitter $contactmethods['twitter'] = 'Twitter'; //Add Facebook $contactmethods['facebook'] = 'Facebook'; // Remove C...
[ { "answer_id": 75984, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": 3, "selected": true, "text": "<p>You need to check, if the field is empty or not before printing link using the <a href=\"http://codex.wordpress.org...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/75981", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24762/" ]
I'm using simple code to show user social link in author bio. **in functions.php** ``` <?php function add_remove_contactmethods( $contactmethods ) { // Add Twitter $contactmethods['twitter'] = 'Twitter'; //Add Facebook $contactmethods['facebook'] = 'Facebook'; // Remove Contact Methods unset($cont...
You need to check, if the field is empty or not before printing link using the [get\_the\_author\_meta](http://codex.wordpress.org/Function_Reference/get_the_author_meta) function. ``` <?php if(!empty(get_the_author_meta('twitter'))) { ?> <a href="<?php the_author_meta('twitter'); ?>" title="Twitter" target="_blank...
76,004
<p>I am trying to order by post meta name which I added for post. Post meta is "_merchant_id" an I know how to sort by merchan_id but I don't know how to sort by merchant name.</p> <p>I am sorting by merchant id like this:</p> <pre><code>public function column_orderby( $vars ) { if ( isset( $vars['orderby'] )...
[ { "answer_id": 76027, "author": "kristina childs", "author_id": 31938, "author_profile": "https://wordpress.stackexchange.com/users/31938", "pm_score": 2, "selected": false, "text": "<p>I assume merchant name is another meta field and not the title for that post type? If so, here is a wa...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/76004", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22500/" ]
I am trying to order by post meta name which I added for post. Post meta is "\_merchant\_id" an I know how to sort by merchan\_id but I don't know how to sort by merchant name. I am sorting by merchant id like this: ``` public function column_orderby( $vars ) { if ( isset( $vars['orderby'] ) && is_admin() ) {...
I hope that my solution will be useful to somebody. ``` public function column_orderby( $vars ) { if ( isset( $vars['orderby'] ) && is_admin() ) { switch ( $vars['orderby'] ) { ... case 'merchant': GLOBAL $wpdb, $query; $vars = array_mer...
76,007
<p>You write a plugin which requires PHP 5.1. Someone tries to install it on a server with PHP 4. How do you deal with that in a safe and user-friendly manner?</p>
[ { "answer_id": 76008, "author": "Geert", "author_id": 4936, "author_profile": "https://wordpress.stackexchange.com/users/4936", "pm_score": 4, "selected": true, "text": "<pre><code>/**\n * Plugin Name: Foo\n */\n\n// Check for required PHP version\nif ( version_compare( PHP_VERSION, '5.1...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/76007", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4936/" ]
You write a plugin which requires PHP 5.1. Someone tries to install it on a server with PHP 4. How do you deal with that in a safe and user-friendly manner?
``` /** * Plugin Name: Foo */ // Check for required PHP version if ( version_compare( PHP_VERSION, '5.1', '<' ) ) { exit( sprintf( 'Foo requires PHP 5.1 or higher. You’re still on %s.', PHP_VERSION ) ); } // The rest of your plugin code follows ``` I'm not sure since which WP version this happened, but in 3.5...
76,014
<p>I have a blog which I sometimes use for audio clips. I want to put an Audio Player on the frontpage of my blog. </p> <p>How can I put the player after the title or make its code part of post excerpts?</p>
[ { "answer_id": 76017, "author": "Ronny K", "author_id": 12918, "author_profile": "https://wordpress.stackexchange.com/users/12918", "pm_score": -1, "selected": false, "text": "<p>you can use a free plugin <a href=\"http://wordpress.org/extend/plugins/audio-player/\" rel=\"nofollow\">Audi...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/76014", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24777/" ]
I have a blog which I sometimes use for audio clips. I want to put an Audio Player on the frontpage of my blog. How can I put the player after the title or make its code part of post excerpts?
Plugin option ------------- When searching for a plugin, it is important to check: * **Compatible up to**, supports current WordPress version? * **Last updated**, too long ago? * **Support**, too many bug reports? Level of support in the forum or in the official plugin page. * **Compatibility**, if the plugin hasn't ...
76,028
<p>I am using a page hierarchy and I want to show the title of the parents and grand parents page (if there is any).</p> <p>The structure is something like</p> <p>Startpage</p> <p>Startpage > Second page</p> <p>Startpage > Second page > Third page</p> <p>Startpage > Second page > Third page > Fourth page</p> <p>T...
[ { "answer_id": 76042, "author": "Michael", "author_id": 4884, "author_profile": "https://wordpress.stackexchange.com/users/4884", "pm_score": 4, "selected": true, "text": "<p>possibly build on <a href=\"http://codex.wordpress.org/Function_Reference/get_ancestors\" rel=\"noreferrer\"><cod...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/76028", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24083/" ]
I am using a page hierarchy and I want to show the title of the parents and grand parents page (if there is any). The structure is something like Startpage Startpage > Second page Startpage > Second page > Third page Startpage > Second page > Third page > Fourth page The title should be something like On the Four...
possibly build on [`get_ancestors()`;](http://codex.wordpress.org/Function_Reference/get_ancestors) example: ``` if( is_page() ) : echo $post->post_title; if( $ancs = get_ancestors($post->ID,'page') ) { foreach( $ancs as $anc ) { echo ' -> ' . get_page( $anc )->post_title; } } e...
76,032
<p>I'm on <code>single-work.php</code> for a custom post type called <code>work</code>, inside the loop.</p> <p>Trying to make two links to the previous and next post.</p> <p>Using this code:</p> <pre><code>&lt;?php previous_post_link(); ?&gt; </code></pre> <p>and</p> <pre><code>&lt;?php next_post_link(); ?&gt; </...
[ { "answer_id": 76033, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 0, "selected": false, "text": "<p>The functions are right; set the params</p>\n\n<p><code>&lt;?php next_post_link('%link', 'Next post »'); ?&gt;</co...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/76032", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9026/" ]
I'm on `single-work.php` for a custom post type called `work`, inside the loop. Trying to make two links to the previous and next post. Using this code: ``` <?php previous_post_link(); ?> ``` and ``` <?php next_post_link(); ?> ``` But nothing shows up. Am I missing something Here is my code, very straightforw...
What I see in your code is that your next post and previous post codes are appearing within the while loop which shouldn't be within the loop and it should appear like this: ``` <?php get_header(); ?> <div class="full" > <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <?php endwhile; // end of the lo...
76,034
<p>I have been tasked with creating a theme that will be a base to list the site owners ebay store products.</p> <p>I have fleshed most of the project out in plain old php to get everything working as regards to adding the listings via the ebay api, right now im integrating the code into functions.php of the custom th...
[ { "answer_id": 76038, "author": "K Themes", "author_id": 24783, "author_profile": "https://wordpress.stackexchange.com/users/24783", "pm_score": 5, "selected": true, "text": "<p>In functions.php you can create \"your_set_tables_function()\" and then hook it in the \"after_switch_theme\" ...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/76034", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3710/" ]
I have been tasked with creating a theme that will be a base to list the site owners ebay store products. I have fleshed most of the project out in plain old php to get everything working as regards to adding the listings via the ebay api, right now im integrating the code into functions.php of the custom theme. What...
In functions.php you can create "your\_set\_tables\_function()" and then hook it in the "after\_switch\_theme" hook. Example: ``` add_action("after_switch_theme", "your_set_tables_function"); ```
76,037
<p>Right now, when I perform "Empty All Caches" it doesn't send a PURGE request to varnish. The result is that varnish isn't being refreshed. Is there a way that I can make varnish purge it's cache when choosing "Empty All Caches"? Is there a way that I can hook into W3 Total Cache "Empty All Caches"?</p>
[ { "answer_id": 76806, "author": "Pontus Abrahamsson", "author_id": 16722, "author_profile": "https://wordpress.stackexchange.com/users/16722", "pm_score": 3, "selected": true, "text": "<p>A simple solution could be to check when you click the \"empty all cache\" Button with <code>$_GET</...
2012/12/13
[ "https://wordpress.stackexchange.com/questions/76037", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4284/" ]
Right now, when I perform "Empty All Caches" it doesn't send a PURGE request to varnish. The result is that varnish isn't being refreshed. Is there a way that I can make varnish purge it's cache when choosing "Empty All Caches"? Is there a way that I can hook into W3 Total Cache "Empty All Caches"?
A simple solution could be to check when you click the "empty all cache" Button with `$_GET` Like this: ``` function wpse_16722_purge_varnish() { // Is the button submitted, Get the value $purge = isset( $_GET['w3tc_note'] ) ? trim( $_GET['w3tc_note'] ) : ''; // Security-check, user can edit settings ...
76,056
<p>I have a hierarchical custom taxonomy ("photos"), with 3 parent terms</p> <ul> <li>color</li> <li>location</li> <li>year</li> </ul> <p>Each parent term has several children terms. I have associated the "photos" taxonomy with pages and have tagged a bunch of pages with the relevant terms for each page.</p> <p>For ...
[ { "answer_id": 76103, "author": "K Themes", "author_id": 24783, "author_profile": "https://wordpress.stackexchange.com/users/24783", "pm_score": 0, "selected": false, "text": "<p>Suppose your Color term has ID = 10. Replace \"10\" with your desired ID</p>\n\n<pre><code>&lt;?php\n$termID ...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76056", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24795/" ]
I have a hierarchical custom taxonomy ("photos"), with 3 parent terms * color * location * year Each parent term has several children terms. I have associated the "photos" taxonomy with pages and have tagged a bunch of pages with the relevant terms for each page. For example, one page has terms: * red (child of "c...
I may suggest not combining each of these into hierarchical taxonomies, but setting up 3 distinct taxonomies. It seems like they are 3 unrelated properties of the photos, and thus, I would separate the code for them. Then you're not trying to code around nested taxonomy terms, but you can access them each individually....
76,075
<p>I am running into a problem where I have no idea where to add in a description so it will show up on the widget dashboard. It just keeps displaying the title. </p> <p>Something else I would love some help with is to add functionality to display the 5 most recent post titles (all categories) and I also do not know h...
[ { "answer_id": 76103, "author": "K Themes", "author_id": 24783, "author_profile": "https://wordpress.stackexchange.com/users/24783", "pm_score": 0, "selected": false, "text": "<p>Suppose your Color term has ID = 10. Replace \"10\" with your desired ID</p>\n\n<pre><code>&lt;?php\n$termID ...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76075", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24800/" ]
I am running into a problem where I have no idea where to add in a description so it will show up on the widget dashboard. It just keeps displaying the title. Something else I would love some help with is to add functionality to display the 5 most recent post titles (all categories) and I also do not know how to do t...
I may suggest not combining each of these into hierarchical taxonomies, but setting up 3 distinct taxonomies. It seems like they are 3 unrelated properties of the photos, and thus, I would separate the code for them. Then you're not trying to code around nested taxonomy terms, but you can access them each individually....
76,082
<p>How do I get the code below to display just the current post that corresponds to the current URL and not all the post from the same category? Barakadam, It works but it brings all the posts in the category instead of the one that was clicked on.</p> <pre><code>&lt;?php $category = end(get_the_category()); $curren...
[ { "answer_id": 76083, "author": "markcbain", "author_id": 24573, "author_profile": "https://wordpress.stackexchange.com/users/24573", "pm_score": 0, "selected": false, "text": "<p>Not sure what you mean by </p>\n\n<blockquote>\n <p>\"just the current post that corresponds to the current...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76082", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22594/" ]
How do I get the code below to display just the current post that corresponds to the current URL and not all the post from the same category? Barakadam, It works but it brings all the posts in the category instead of the one that was clicked on. ``` <?php $category = end(get_the_category()); $current_name = $categor...
What you probably want is this: 1) A main page that displays a list of all posts in a certain category. 2) A page showing the individual post in this list on which the user has clicked. To create page number, you don't have to do anything. WordPress has an automatic scheme for URLs for you. Just use : ``` http:...
76,084
<p>I would like to be able to force any un-registered users to the /welcome page - Currently I have set up the following:</p> <pre><code>if ( trim( $_SERVER['REQUEST_URI'], '/' ) != 'welcome' &amp;&amp; ! is_user_logged_in() ) { wp_redirect( home_url( 'welcome' ), 301 ); exit; } </code></pre> <p>This automatically...
[ { "answer_id": 76083, "author": "markcbain", "author_id": 24573, "author_profile": "https://wordpress.stackexchange.com/users/24573", "pm_score": 0, "selected": false, "text": "<p>Not sure what you mean by </p>\n\n<blockquote>\n <p>\"just the current post that corresponds to the current...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76084", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24572/" ]
I would like to be able to force any un-registered users to the /welcome page - Currently I have set up the following: ``` if ( trim( $_SERVER['REQUEST_URI'], '/' ) != 'welcome' && ! is_user_logged_in() ) { wp_redirect( home_url( 'welcome' ), 301 ); exit; } ``` This automatically re-directs visitors to the /welco...
What you probably want is this: 1) A main page that displays a list of all posts in a certain category. 2) A page showing the individual post in this list on which the user has clicked. To create page number, you don't have to do anything. WordPress has an automatic scheme for URLs for you. Just use : ``` http:...
76,095
<p>I'm creating a setting to set a logo. It works but there is a problem.<br> I only need one image to be set so the gallery item should be disabled / hidden. Of course this should only effect this page, of even better this setting.</p> <pre><code>&lt;?php // above this I do a simple settings api ?&gt; &lt;input id="s...
[ { "answer_id": 76083, "author": "markcbain", "author_id": 24573, "author_profile": "https://wordpress.stackexchange.com/users/24573", "pm_score": 0, "selected": false, "text": "<p>Not sure what you mean by </p>\n\n<blockquote>\n <p>\"just the current post that corresponds to the current...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76095", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10911/" ]
I'm creating a setting to set a logo. It works but there is a problem. I only need one image to be set so the gallery item should be disabled / hidden. Of course this should only effect this page, of even better this setting. ``` <?php // above this I do a simple settings api ?> <input id="set_logo" type="text" siz...
What you probably want is this: 1) A main page that displays a list of all posts in a certain category. 2) A page showing the individual post in this list on which the user has clicked. To create page number, you don't have to do anything. WordPress has an automatic scheme for URLs for you. Just use : ``` http:...
76,102
<p>after updating to WordPress 3.5 my automatic embeds are limited to a width of 500px, and the settings for this size have been removed with WordPress 3.5</p> <p>Also, I can't find the Values in the <code>wp_options</code> table.</p> <p>Does anyone know how to change them again?</p> <p>Cheers, fischi</p>
[ { "answer_id": 76106, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": true, "text": "<p>See the function <code>wp_embed_defaults()</code> in <code>wp-includes/media.php</code>:</p>\n\n<pre><code>function wp_...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76102", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15680/" ]
after updating to WordPress 3.5 my automatic embeds are limited to a width of 500px, and the settings for this size have been removed with WordPress 3.5 Also, I can't find the Values in the `wp_options` table. Does anyone know how to change them again? Cheers, fischi
See the function `wp_embed_defaults()` in `wp-includes/media.php`: ``` function wp_embed_defaults() { if ( ! empty( $GLOBALS['content_width'] ) ) $width = (int) $GLOBALS['content_width']; if ( empty( $width ) ) $width = 500; $height = min( ceil( $width * 1.5 ), 1000 ); return apply_f...
76,117
<p>On every site where I updated Wordpress to version 3.5, two error messages flashed onto the screen, only to be immediately replaced by the Wordpress About page. The messages don't stay on the screen long enough to read, but I managed to hit PrintScreen and read them that way.</p> <p>Note: this has happened with pr...
[ { "answer_id": 76118, "author": "Chris", "author_id": 24761, "author_profile": "https://wordpress.stackexchange.com/users/24761", "pm_score": 0, "selected": false, "text": "<p>Give your files/folders the right CHMOD (I assume 755 for folders)\nEdit: This answer should answer all your que...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76117", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3675/" ]
On every site where I updated Wordpress to version 3.5, two error messages flashed onto the screen, only to be immediately replaced by the Wordpress About page. The messages don't stay on the screen long enough to read, but I managed to hit PrintScreen and read them that way. Note: this has happened with previous upda...
The issue is that the files cannot be written to by the web/php process due to permissions. This is: * Good! Those files can't be updated with malware and other nasty surprises * Bad! The updater cant update them either So, I'd advise you do the following: * Follow these chmod settings religiously [What is true chm...
76,125
<p>When inserting media into a post, is there a way to change the default-view of the Media-Library from "All media items" to "Uploaded to this post"?</p> <p><img src="https://i.stack.imgur.com/HnfW7.png" alt="borrowed Screenshot"></p> <p>There is another thread where this question was extracted from: <a href="https:...
[ { "answer_id": 76213, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 6, "selected": true, "text": "<p>There were two minor mistakes in my previous answer:</p>\n\n<ol>\n<li>I forgot to trigger the <code>change</code> event...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76125", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24832/" ]
When inserting media into a post, is there a way to change the default-view of the Media-Library from "All media items" to "Uploaded to this post"? ![borrowed Screenshot](https://i.stack.imgur.com/HnfW7.png) There is another thread where this question was extracted from: [How to manage attachment relationships](https...
There were two minor mistakes in my previous answer: 1. I forgot to trigger the `change` event for the parent. 2. I called the function on every AJAX call, making other selections impossible. Here is the fixed code: ``` <?php /** * Plugin Name: Pre-select post specific attachments */ add_action( 'admin_footer-pos...
76,128
<p>This is essentially a repeat of <a href="https://wordpress.stackexchange.com/questions/70519/shared-members-between-two-different-wordpress-installations-with-different-data">this question</a>, but it has not been answered.</p> <p>I am trying to create an SSO system between two separate WordPress installs that are ...
[ { "answer_id": 76213, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 6, "selected": true, "text": "<p>There were two minor mistakes in my previous answer:</p>\n\n<ol>\n<li>I forgot to trigger the <code>change</code> event...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76128", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6556/" ]
This is essentially a repeat of [this question](https://wordpress.stackexchange.com/questions/70519/shared-members-between-two-different-wordpress-installations-with-different-data), but it has not been answered. I am trying to create an SSO system between two separate WordPress installs that are on different servers ...
There were two minor mistakes in my previous answer: 1. I forgot to trigger the `change` event for the parent. 2. I called the function on every AJAX call, making other selections impossible. Here is the fixed code: ``` <?php /** * Plugin Name: Pre-select post specific attachments */ add_action( 'admin_footer-pos...
76,145
<p>I have a plugin that currently doesn't support network activation. The best fix for this of course is to fix it :) which I plan to do. However I wonder if there is a temporary solution I can use to prevent network activation in the meantime, perhaps a workflow similar to:</p> <ol> <li>Detect if the activation is ne...
[ { "answer_id": 76148, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": false, "text": "<p>A plugin header <code>Network: false</code> will be ignored by WordPress … unfortunately. But the activation hook gets...
2012/12/14
[ "https://wordpress.stackexchange.com/questions/76145", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14642/" ]
I have a plugin that currently doesn't support network activation. The best fix for this of course is to fix it :) which I plan to do. However I wonder if there is a temporary solution I can use to prevent network activation in the meantime, perhaps a workflow similar to: 1. Detect if the activation is network-wide (h...
The answers here are overthought and too complex. Why deactivating the plugin instead of preventing activation? Something as simple as calling die('your error message here) upon activation will do the job. ``` function activate($networkwide) { if (is_multisite() && $networkwide) die('This plugin can\'t be ...
76,209
<p>The last update broke my workflow, as the method of using custom image size inside the media manager has definitely changed.</p> <p>i'm trying to add my previously registered image sizes to the new dropdown.</p>
[ { "answer_id": 76218, "author": "Christine Cooper", "author_id": 24875, "author_profile": "https://wordpress.stackexchange.com/users/24875", "pm_score": 2, "selected": false, "text": "<p>You will need to paste your code in order for us to review where the issue is, however, I can demonst...
2012/12/15
[ "https://wordpress.stackexchange.com/questions/76209", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3603/" ]
The last update broke my workflow, as the method of using custom image size inside the media manager has definitely changed. i'm trying to add my previously registered image sizes to the new dropdown.
You will need to paste your code in order for us to review where the issue is, however, I can demonstrate how I accomplish this in Wordpress v3.5 Please observe the comments in `my_insert_custom_image_sizes`: ``` function my_insert_custom_image_sizes( $sizes ) { // get the custom image sizes global $_wp_addit...
76,212
<p>How do I remove the <code>Insert from URL</code> link in the new Wordpress 3.5 Add Media popup page? In earlier versions of Wordpress, this worked fine:</p> <pre><code>// removes URL tab in image upload for post function remove_media_library_tab($tabs) { if (isset($_REQUEST['post_id'])) { $post_type = ...
[ { "answer_id": 76237, "author": "Maciej Płusa", "author_id": 24882, "author_profile": "https://wordpress.stackexchange.com/users/24882", "pm_score": 2, "selected": false, "text": "<p>The code of default tabs array in new WP is in media.php and looks like this:</p>\n\n<pre><code>/**\n * D...
2012/12/15
[ "https://wordpress.stackexchange.com/questions/76212", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24875/" ]
How do I remove the `Insert from URL` link in the new Wordpress 3.5 Add Media popup page? In earlier versions of Wordpress, this worked fine: ``` // removes URL tab in image upload for post function remove_media_library_tab($tabs) { if (isset($_REQUEST['post_id'])) { $post_type = get_post_type($_REQUEST['...
This should work: ``` add_filter( 'media_view_strings', 'cor_media_view_strings' ); /** * Removes the media 'From URL' string. * * @see wp-includes|media.php */ function cor_media_view_strings( $strings ) { unset( $strings['insertFromUrlTitle'] ); return $strings; } ```
76,214
<p>In the Media upload popup page, how do I set the attachment link to none and hide it in Wordpress version 3.5? The following filter worked fine in earlier versions of WP:</p> <pre><code>function my_attachment_fields_edit($form_fields,$post){ // Set attachment link to none and hide it. $html = "&lt;input ty...
[ { "answer_id": 77462, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 4, "selected": true, "text": "<p>Include this small plugin, activate and test.</p>\n\n<p>A tested version in 3.6-alpha, works only on click on a thu...
2012/12/15
[ "https://wordpress.stackexchange.com/questions/76214", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24875/" ]
In the Media upload popup page, how do I set the attachment link to none and hide it in Wordpress version 3.5? The following filter worked fine in earlier versions of WP: ``` function my_attachment_fields_edit($form_fields,$post){ // Set attachment link to none and hide it. $html = "<input type='hidden' name=...
Include this small plugin, activate and test. A tested version in 3.6-alpha, works only on click on a thumbnail. ``` <?php /** * Plugin Name: Remove Attachment Link-To and set to value 'none' */ add_action( 'admin_footer-post-new.php', 'wpse_76214_script' ); add_action( 'admin_footer-post.php', 'wpse_76214_script...
76,219
<p>In previous version i set a new check field into the media window with a simple code</p> <pre><code> function ab_prettyphoto_attachment_fields_to_edit( $form_fields, $post ) { $my_form_fields = array( 'ab_prettyphoto' =&gt; array( 'label' =&gt; __('Automatic Zoom on click', 'ab_prettyphoto'), ...
[ { "answer_id": 76259, "author": "webaware", "author_id": 24260, "author_profile": "https://wordpress.stackexchange.com/users/24260", "pm_score": 0, "selected": false, "text": "<p>Your isset() needs to be:</p>\n\n<pre><code>isset($_POST['attachments'][$send_id]['ab_prettyphoto'])\n</code>...
2012/12/15
[ "https://wordpress.stackexchange.com/questions/76219", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14550/" ]
In previous version i set a new check field into the media window with a simple code ``` function ab_prettyphoto_attachment_fields_to_edit( $form_fields, $post ) { $my_form_fields = array( 'ab_prettyphoto' => array( 'label' => __('Automatic Zoom on click', 'ab_prettyphoto'), 'input' ...
So, there are some things which work differently (now). I. What you've noticed, when you click the checkbox Wordpress sends an Ajax request to 'wp\_ajax\_save\_attachment\_compat()' with some form data, if your checkbox is checked, this information will be part of the form data. 'wp\_ajax\_save\_attachment\_compat()'...
76,220
<p>Bare with me. I want to have a custom image size selected by default in the Media upload popup page. In Wordpress v3.4.2 and prior, this elegant code worked fine:</p> <pre><code>function my_insert_custom_image_sizes( $sizes ) { // get the custom image sizes global $_wp_additional_image_sizes; // if ther...
[ { "answer_id": 77367, "author": "Selva Balaji", "author_id": 25011, "author_profile": "https://wordpress.stackexchange.com/users/25011", "pm_score": 0, "selected": false, "text": "<p>Add the function to theme's functions.php file.</p>\n\n<pre><code>if ( function_exists( 'add_theme_suppo...
2012/12/15
[ "https://wordpress.stackexchange.com/questions/76220", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24875/" ]
Bare with me. I want to have a custom image size selected by default in the Media upload popup page. In Wordpress v3.4.2 and prior, this elegant code worked fine: ``` function my_insert_custom_image_sizes( $sizes ) { // get the custom image sizes global $_wp_additional_image_sizes; // if there are none, ju...
Try this out. Your [add\_filter()'s](http://codex.wordpress.org/Function_Reference/add_filter) second argument is a function, that will affect the current option via a return: ``` function theme_default_image_size() { return 'custom-image-size-2'; } add_filter( 'pre_option_image_default_size', 'theme_default_image...
76,229
<p>Is there a way to count all published posts from a custom taxonomy?</p> <p>While looking around I found <a href="http://code.hyperspatial.com/1290/count-posts-in-taxonomy/" rel="noreferrer">this snippet</a> but I didn’t manage to get it to work …</p> <pre><code>global $wpdb; $query = " SELECT COUNT( DISTIN...
[ { "answer_id": 76235, "author": "Upeksha", "author_id": 19683, "author_profile": "https://wordpress.stackexchange.com/users/19683", "pm_score": 4, "selected": true, "text": "<p>Use an instance of <strong>WP_Query</strong> to query the database.\n<a href=\"http://codex.wordpress.org/Class...
2012/12/15
[ "https://wordpress.stackexchange.com/questions/76229", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21110/" ]
Is there a way to count all published posts from a custom taxonomy? While looking around I found [this snippet](http://code.hyperspatial.com/1290/count-posts-in-taxonomy/) but I didn’t manage to get it to work … ``` global $wpdb; $query = " SELECT COUNT( DISTINCT cat_posts.ID ) AS post_count FROM wp_t...
Use an instance of **WP\_Query** to query the database. <http://codex.wordpress.org/Class_Reference/WP_Query> To query database for custom taxonomies use, ``` $query = new WP_Query( array( 'people' => 'bob' ) ); ``` For more details on available options see: **Taxonomy Parameters** <http://codex.wordpress.org/Class...
76,231
<p>Done my research and found this is how to call the built-in <a href="https://wordpress.stackexchange.com/questions/59411/enqueue-jquery-ui-tabs-in-admin-area?lq=1">ui tabs jquery script</a> in wp for the admin area but I'm stuck on implementing the other jquery scripts needed that I believe are built into wp. I know...
[ { "answer_id": 76238, "author": "Maciej Płusa", "author_id": 24882, "author_profile": "https://wordpress.stackexchange.com/users/24882", "pm_score": 4, "selected": true, "text": "<p>If there is problem only with html markup you should check example from official jQuery UI site here: <a h...
2012/12/15
[ "https://wordpress.stackexchange.com/questions/76231", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24880/" ]
Done my research and found this is how to call the built-in [ui tabs jquery script](https://wordpress.stackexchange.com/questions/59411/enqueue-jquery-ui-tabs-in-admin-area?lq=1) in wp for the admin area but I'm stuck on implementing the other jquery scripts needed that I believe are built into wp. I know how to add th...
If there is problem only with html markup you should check example from official jQuery UI site here: <http://jqueryui.com/tabs/> It looks like yours, but for work you must check if your site include stuff like jquery and jquery ui script, jquery css is important too. After that you should have script with: ``` $( "#...
76,246
<p>In my attempt to alter navigations current-menu-item class, I found a possible solution <a href="https://stackoverflow.com/a/7941864/520265">https://stackoverflow.com/a/7941864/520265</a> , </p> <pre><code>add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1); </code></pre> <p>He makes use of a filt...
[ { "answer_id": 76247, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": true, "text": "<p>There are multiple was to find filters:</p>\n\n<ol>\n<li><p>Use an IDE (see <a href=\"https://wordpress.stackexchange.c...
2012/12/15
[ "https://wordpress.stackexchange.com/questions/76246", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24884/" ]
In my attempt to alter navigations current-menu-item class, I found a possible solution <https://stackoverflow.com/a/7941864/520265> , ``` add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1); ``` He makes use of a filter who is called with a tag 'nav\_menu\_css\_class' , But it got me wondering, wh...
There are multiple was to find filters: 1. Use an IDE (see [Eclipse example](https://wordpress.stackexchange.com/a/14495/73)), set WordPress as a separate project and search in this project for `apply_filters` or `do_action`. 2. Get a program to search in all files of a directory (grep, Notepad++) and do the same sear...
76,261
<p>I display one post per author with function below and works fine, but is possible order by custom field?</p> <pre><code>&lt;?php add_filter('posts_groupby', 'author_groupby'); function author_groupby($groupby) { global $wpdb; $author_groupby = "{$wpdb-&gt;posts}.post_author"; if(preg_match("/$author_groupby/"...
[ { "answer_id": 76247, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": true, "text": "<p>There are multiple was to find filters:</p>\n\n<ol>\n<li><p>Use an IDE (see <a href=\"https://wordpress.stackexchange.c...
2012/12/16
[ "https://wordpress.stackexchange.com/questions/76261", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22472/" ]
I display one post per author with function below and works fine, but is possible order by custom field? ``` <?php add_filter('posts_groupby', 'author_groupby'); function author_groupby($groupby) { global $wpdb; $author_groupby = "{$wpdb->posts}.post_author"; if(preg_match("/$author_groupby/", $groupby)) { /...
There are multiple was to find filters: 1. Use an IDE (see [Eclipse example](https://wordpress.stackexchange.com/a/14495/73)), set WordPress as a separate project and search in this project for `apply_filters` or `do_action`. 2. Get a program to search in all files of a directory (grep, Notepad++) and do the same sear...
76,262
<p>I'd like to understand the difference between:</p> <pre><code>&lt;?php bloginfo( 'stylesheet_url' ); ?&gt; </code></pre> <p>and</p> <pre><code>&lt;?php bloginfo('template_url'); ?&gt;/style.css </code></pre> <p>because I think the second one is more flexible (is i decide to move the file in a subdirectory, for e...
[ { "answer_id": 76263, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>There are two differences between both methods:</p>\n\n<ol>\n<li><code>'stylesheet_url'</code> refers always to the di...
2012/12/16
[ "https://wordpress.stackexchange.com/questions/76262", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16580/" ]
I'd like to understand the difference between: ``` <?php bloginfo( 'stylesheet_url' ); ?> ``` and ``` <?php bloginfo('template_url'); ?>/style.css ``` because I think the second one is more flexible (is i decide to move the file in a subdirectory, for example. or if I have more stylesheet to add.. the second one ...
`bloginfo('stylesheet_url')` will always return the current theme's stylesheet. If current theme is a [child theme](http://codex.wordpress.org/Child_Themes), for example, it will return `style.css` relative to the child theme's root rather than the parent theme's root. `bloginfo('template_url')` will **always** return...
76,294
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://wordpress.stackexchange.com/questions/76072/wpdb-prepare-warning-in-wordpress-3-5">$wpdb-&gt;prepare() warning in WordPress 3.5</a> </p> </blockquote> <p>Im facing with a error after updated Wordpress to 3.5, Im aware of error but I cant ...
[ { "answer_id": 76295, "author": "Mamaduka", "author_id": 888, "author_profile": "https://wordpress.stackexchange.com/users/888", "pm_score": 1, "selected": false, "text": "<p>Because you're missing second argument, for more information see this post - <a href=\"http://make.wordpress.org/...
2012/12/16
[ "https://wordpress.stackexchange.com/questions/76294", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24903/" ]
> > **Possible Duplicate:** > > [$wpdb->prepare() warning in WordPress 3.5](https://wordpress.stackexchange.com/questions/76072/wpdb-prepare-warning-in-wordpress-3-5) > > > Im facing with a error after updated Wordpress to 3.5, Im aware of error but I cant fix it. This is code: ``` $wpdb->prepare("INSERT IN...
Because you're missing second argument, for more information see this post - <http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/>. Also you're doing it wrong, for security reason you shouldn't pass variables into query directly that's why you should use `prepare()` method - see ...
76,325
<p>I'm trying to get an image for I previously assigned to a category using ACF.</p> <p>here's what I'm doing:</p> <pre><code>$category_image = the_field('cat_small', $linkedcat); </code></pre> <p>where $linkedcat is something like category_280</p> <p>When I echo $category_image, i see an array, like so:</p> <pre>...
[ { "answer_id": 78467, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 2, "selected": true, "text": "<p>Whenever in doubt, consult the documentation and nice plugins like ACF are very well documented.</p>\n\n<p>It...
2012/12/16
[ "https://wordpress.stackexchange.com/questions/76325", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14378/" ]
I'm trying to get an image for I previously assigned to a category using ACF. here's what I'm doing: ``` $category_image = the_field('cat_small', $linkedcat); ``` where $linkedcat is something like category\_280 When I echo $category\_image, i see an array, like so: ``` 261, , catsmall, , , http://localhost/curre...
Whenever in doubt, consult the documentation and nice plugins like ACF are very well documented. It depends on how you set the image field, but from this page [*Field Types -> Image*](http://www.advancedcustomfields.com/docs/field-types/image/), looks like you set you field to return an object. Instead of using `the_...
76,329
<p>Here's my site: <a href="http://dev.shoeporn.com/" rel="nofollow">http://dev.shoeporn.com/</a></p> <p>I'm running WP 3.5 and using this plugin: <a href="http://wordpress.org/support/plugin/responsive-select-menu" rel="nofollow">http://wordpress.org/support/plugin/responsive-select-menu</a></p> <p>It is supposed ...
[ { "answer_id": 78467, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 2, "selected": true, "text": "<p>Whenever in doubt, consult the documentation and nice plugins like ACF are very well documented.</p>\n\n<p>It...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76329", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24911/" ]
Here's my site: <http://dev.shoeporn.com/> I'm running WP 3.5 and using this plugin: <http://wordpress.org/support/plugin/responsive-select-menu> It is supposed to allow you to select which menus you want to be responsive, but it doesn't seem to work. I only want the `<div id="header-bar">` menu to be displayed to m...
Whenever in doubt, consult the documentation and nice plugins like ACF are very well documented. It depends on how you set the image field, but from this page [*Field Types -> Image*](http://www.advancedcustomfields.com/docs/field-types/image/), looks like you set you field to return an object. Instead of using `the_...
76,341
<p>I'm building a landing page and want to remove the navigation menu from the page. The navigation menu is in header.php which is of course in the page template. Is there a WordPress function I can use to remove the navigation menu from this specific page? I know I could do it with jQuery and do display:none for the n...
[ { "answer_id": 76343, "author": "Jeremy Jared", "author_id": 5339, "author_profile": "https://wordpress.stackexchange.com/users/5339", "pm_score": 3, "selected": true, "text": "<h2>Use a conditional tag:</h2>\n<p>Codex References:</p>\n<p><a href=\"http://codex.wordpress.org/Function_Ref...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76341", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10413/" ]
I'm building a landing page and want to remove the navigation menu from the page. The navigation menu is in header.php which is of course in the page template. Is there a WordPress function I can use to remove the navigation menu from this specific page? I know I could do it with jQuery and do display:none for the nav ...
Use a conditional tag: ---------------------- Codex References: [Function Reference (is\_page)](http://codex.wordpress.org/Function_Reference/is_page) [Function Reference (Conditional Tags)](http://codex.wordpress.org/Conditional_Tags) You can specify the landing page by Page ID, Page Title or Page Slug. Here is a...
76,359
<p>How can I disable access non registered users? If the user is not logged in I would like to redirect them to a custom registration/login page. Is it possible this using below code as I dont want to use plugin.</p> <pre><code>&lt;?php if ( is_user_logged_in() ) { echo 'Welcome, registered user!'; } else { ec...
[ { "answer_id": 76362, "author": "Mike Madern", "author_id": 24806, "author_profile": "https://wordpress.stackexchange.com/users/24806", "pm_score": 0, "selected": false, "text": "<p>You probably just have to put the following in your <code>functions.php</code>:</p>\n\n<pre><code>if ( is_...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76359", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19619/" ]
How can I disable access non registered users? If the user is not logged in I would like to redirect them to a custom registration/login page. Is it possible this using below code as I dont want to use plugin. ``` <?php if ( is_user_logged_in() ) { echo 'Welcome, registered user!'; } else { echo 'Welcome, visi...
Write this into a plugin: ``` add_action( 'template_redirect', 'auth_redirect' ); ``` As [plugin on GitHub](https://gist.github.com/3521964). This will force all visitors login if they aren’t already. In some cases, this is asking for a log-in *every time*. This might work better: ``` is_admin() || add_action( 't...
76,360
<p>I have some images uploaded in wordpress posts (eg. post#1, and post#2). Now I've created a new post (eg. Post#3), and in this post I have inserted the WordPress 3.5 gallery, I did not upload any image in the post#3, instead I used the images from the post#1 and post#2. Now in the post#3, I would like to get the lin...
[ { "answer_id": 77579, "author": "bosco", "author_id": 25324, "author_profile": "https://wordpress.stackexchange.com/users/25324", "pm_score": 0, "selected": false, "text": "<p>I must admit I haven't had the time to play with 3.5's new media galleries and the like, but working off of the ...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76360", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24715/" ]
I have some images uploaded in wordpress posts (eg. post#1, and post#2). Now I've created a new post (eg. Post#3), and in this post I have inserted the WordPress 3.5 gallery, I did not upload any image in the post#3, instead I used the images from the post#1 and post#2. Now in the post#3, I would like to get the links ...
I had the same problem - how can I display all the images from a post containing a gallery where some of the images are not attached to the post, or are attached to different posts? The new media interface in WP3.5 allows you to add any of the images in the media library to a gallery, regardless of whether they are "a...
76,361
<p>I'm using this code to generate all my custom field values from all posts for custom field named "autor".</p> <pre><code>&lt;?php $autor = $wpdb-&gt;get_results("SELECT meta_value AS autor FROM wp_posts, wp_postmeta WHERE post_status = 'publish' AND meta_key = 'autor' GROUP BY meta_value ORDER BY meta_value") ?&gt;...
[ { "answer_id": 77579, "author": "bosco", "author_id": 25324, "author_profile": "https://wordpress.stackexchange.com/users/25324", "pm_score": 0, "selected": false, "text": "<p>I must admit I haven't had the time to play with 3.5's new media galleries and the like, but working off of the ...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76361", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24922/" ]
I'm using this code to generate all my custom field values from all posts for custom field named "autor". ``` <?php $autor = $wpdb->get_results("SELECT meta_value AS autor FROM wp_posts, wp_postmeta WHERE post_status = 'publish' AND meta_key = 'autor' GROUP BY meta_value ORDER BY meta_value") ?> <ol> <?php foreach( $a...
I had the same problem - how can I display all the images from a post containing a gallery where some of the images are not attached to the post, or are attached to different posts? The new media interface in WP3.5 allows you to add any of the images in the media library to a gallery, regardless of whether they are "a...
76,370
<p>I have a blog here <strong>/www.mysite.com/section/news/</strong> that only shows news in a specific category. When I use <strong>wp_get_recent_posts()</strong> and <strong>get_permalink($recent["ID"])</strong> the link goes here <strong>/www.mysite.com/the-post-title/</strong></p> <pre><code>&lt;?php $args = ...
[ { "answer_id": 76392, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 0, "selected": false, "text": "<p>Those function are going to return URLs based on your permalink settings. If the only place you want to chang...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76370", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22783/" ]
I have a blog here **/www.mysite.com/section/news/** that only shows news in a specific category. When I use **wp\_get\_recent\_posts()** and **get\_permalink($recent["ID"])** the link goes here **/www.mysite.com/the-post-title/** ``` <?php $args = array( 'numberposts' => 2, 'category' => 14 ); ...
The permalinks by default are output relative to the site's **blog posts index** (aka `'page-for-posts'`, aka **posts page**). You're using a *custom page template* for the static page `Section/News`. That static page is unrelated to the site blog posts index. That's why the permalinks don't reference that page. If yo...
76,374
<p>How to fire on bulk actions inside of an extended WP_List_Table. </p> <p>I have been adding the following bulk actions to may table's select box but on Apply won't really happens anything</p> <p>here are how I added my bulk actions</p> <pre><code>function get_bulk_actions() { $actions = array( 'delete...
[ { "answer_id": 78416, "author": "Jan", "author_id": 25626, "author_profile": "https://wordpress.stackexchange.com/users/25626", "pm_score": 1, "selected": false, "text": "<p>this is what I have found on several websites. It still isn't working for me, but it used to work when I still had...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76374", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23759/" ]
How to fire on bulk actions inside of an extended WP\_List\_Table. I have been adding the following bulk actions to may table's select box but on Apply won't really happens anything here are how I added my bulk actions ``` function get_bulk_actions() { $actions = array( 'delete' => 'Delete', ...
If you add a bulk-action, then you have to react on this action. Simply adding a function doesn't do anything, you have to call it: ``` class WPSE_List_Table extends WP_List_Table { public function __construct() { parent::__construct( array( 'singular' => 'singular_form', ...
76,379
<p>I´d like to echo the post name instead post id. My code shows just the id.</p> <pre><code>&lt;?php global $post; $customlink = get_post_meta( $post-&gt;ID, 'clink', true ); echo $customlink; ?&gt; </code></pre> <p>Thanks<br> Ogni</p>
[ { "answer_id": 78416, "author": "Jan", "author_id": 25626, "author_profile": "https://wordpress.stackexchange.com/users/25626", "pm_score": 1, "selected": false, "text": "<p>this is what I have found on several websites. It still isn't working for me, but it used to work when I still had...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76379", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12521/" ]
I´d like to echo the post name instead post id. My code shows just the id. ``` <?php global $post; $customlink = get_post_meta( $post->ID, 'clink', true ); echo $customlink; ?> ``` Thanks Ogni
If you add a bulk-action, then you have to react on this action. Simply adding a function doesn't do anything, you have to call it: ``` class WPSE_List_Table extends WP_List_Table { public function __construct() { parent::__construct( array( 'singular' => 'singular_form', ...
76,383
<p>I am working on a wordpress navigation menu and trying to simlpy (of course, dynamically) add number inside a span tag for each menu li item. </p> <p>So I created a "top menu" using the wordpress custom menu function then I used a simple jquery function to add a "span" tag inside each tag like so:</p> <pre><code...
[ { "answer_id": 76384, "author": "Xavi Ivars", "author_id": 6334, "author_profile": "https://wordpress.stackexchange.com/users/6334", "pm_score": 0, "selected": false, "text": "<p>You should need something like that</p>\n\n<pre><code>var menuIndex = 0; \njQuery('#top .menu ul li a span')....
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76383", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7730/" ]
I am working on a wordpress navigation menu and trying to simlpy (of course, dynamically) add number inside a span tag for each menu li item. So I created a "top menu" using the wordpress custom menu function then I used a simple jquery function to add a "span" tag inside each tag like so: ``` $("#top .menu ul li a"...
``` $("#top .menu ul li").each(function(i, el) { $(this).children('a').prepend("<span>" + (i+1) + "</span>"); }); ``` or much better ``` $("#top2 .menu ul li").each(function() { var $this = $(this); $this.children('a').prepend("<span>" + ($this.index()+1) + "</span>"); }); ``` check this out for the di...
76,405
<p>Wordpress appears to let content be addressed by many URIs in an MU install. For example:</p> <pre><code> example.com/wp-content/blogs.dir/5/files/picture.jpg example.com/bob/files/picture.jpg example.com/bob/wp-content/blogs.dir/5/files/pictures.jpg </code></pre> <p>All appear to route to the same place. Are th...
[ { "answer_id": 76811, "author": "Matthew Boynes", "author_id": 12324, "author_profile": "https://wordpress.stackexchange.com/users/12324", "pm_score": 3, "selected": true, "text": "<h1>Short Answer</h1>\n\n<p><strong>example.com/bob/files/picture.jpg is the preferred, canonical URL for i...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76405", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24938/" ]
Wordpress appears to let content be addressed by many URIs in an MU install. For example: ``` example.com/wp-content/blogs.dir/5/files/picture.jpg example.com/bob/files/picture.jpg example.com/bob/wp-content/blogs.dir/5/files/pictures.jpg ``` All appear to route to the same place. Are there more aliases? Which on...
Short Answer ============ **example.com/bob/files/picture.jpg is the preferred, canonical URL for images in a WordPress Multisite installation**. The two URLs with `blogs.dir` in the URL are essentially identical, and both leverage the filesystem structure. The path with 'bob' exists because you did a sub-directory in...
76,415
<p>After upgrading to 3.5, I discovered that navigation has disappeared outside of the main index page. Theme is TwentyEleven and I've verified that this still occurs after disabling all plugins.</p> <pre><code>&lt;?php if ( $wp_query-&gt;have_posts() ) : ?&gt; &lt;?php twentyeleven_content_nav( 'nav-above' ); ?&...
[ { "answer_id": 76811, "author": "Matthew Boynes", "author_id": 12324, "author_profile": "https://wordpress.stackexchange.com/users/12324", "pm_score": 3, "selected": true, "text": "<h1>Short Answer</h1>\n\n<p><strong>example.com/bob/files/picture.jpg is the preferred, canonical URL for i...
2012/12/17
[ "https://wordpress.stackexchange.com/questions/76415", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1697/" ]
After upgrading to 3.5, I discovered that navigation has disappeared outside of the main index page. Theme is TwentyEleven and I've verified that this still occurs after disabling all plugins. ``` <?php if ( $wp_query->have_posts() ) : ?> <?php twentyeleven_content_nav( 'nav-above' ); ?> <?php /* Start the L...
Short Answer ============ **example.com/bob/files/picture.jpg is the preferred, canonical URL for images in a WordPress Multisite installation**. The two URLs with `blogs.dir` in the URL are essentially identical, and both leverage the filesystem structure. The path with 'bob' exists because you did a sub-directory in...
76,453
<p>I'm trying to get post excerpt and title by specific post ID. My post ID is 6 and my code as follows</p> <pre><code>&lt;?php $id = 6; $post = get_post( $id ); $excerpt = get_excerpt( $id); $excerpt = $post-&gt;post_excerpt; ?&gt; &lt;h6&gt;&lt;?php the_title(); ?&gt;&lt;/h6&gt; &lt;?php echo get_ex...
[ { "answer_id": 76456, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 1, "selected": false, "text": "<p><code>&lt;?php echo get_excerpt(190); ?&gt;</code> this part is wrong. You are printing excerpt from <code>id = 19...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76453", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16951/" ]
I'm trying to get post excerpt and title by specific post ID. My post ID is 6 and my code as follows ``` <?php $id = 6; $post = get_post( $id ); $excerpt = get_excerpt( $id); $excerpt = $post->post_excerpt; ?> <h6><?php the_title(); ?></h6> <?php echo get_excerpt(190); ?> ``` It shows the title of p...
Your `get_excerpt()` function uses the `global` `$post` variable, which is out of scope inside your function. ``` // Changing excerpt length function get_excerpt($count){ $permalink = get_permalink($post->ID); $excerpt = get_the_content(); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0,...
76,459
<p>The below is the menu code used in the default WordPress theme of "Allure Real Estate Theme for Placester".</p> <pre><code> `&lt;li&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="&lt;?php echo @get_permalink(get_page_by_title('About')-&gt;ID); ? &gt;"&gt;About&lt;/a&gt; ...
[ { "answer_id": 76456, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 1, "selected": false, "text": "<p><code>&lt;?php echo get_excerpt(190); ?&gt;</code> this part is wrong. You are printing excerpt from <code>id = 19...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76459", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22928/" ]
The below is the menu code used in the default WordPress theme of "Allure Real Estate Theme for Placester". ``` `<li><a href="/">Home</a></li> <li><a href="<?php echo @get_permalink(get_page_by_title('About')->ID); ? >">About</a> </li> <li><a href="<?php echo @get_permalink(get_page_...
Your `get_excerpt()` function uses the `global` `$post` variable, which is out of scope inside your function. ``` // Changing excerpt length function get_excerpt($count){ $permalink = get_permalink($post->ID); $excerpt = get_the_content(); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0,...
76,465
<p>I have a command line script for maintaining a wordpress plugin and have to load the wordpress core to be able to access wordpress functions.</p> <p>This problem is very similar to <a href="https://wordpress.stackexchange.com/questions/23990/initialize-wordpress-environment-to-use-in-a-real-cron-script">Initialize ...
[ { "answer_id": 76466, "author": "xaedes", "author_id": 9518, "author_profile": "https://wordpress.stackexchange.com/users/9518", "pm_score": 6, "selected": true, "text": "<p>I came up with following solution. The script have to start with the following code.</p>\n\n<pre><code>&lt;?php\n ...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76465", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9518/" ]
I have a command line script for maintaining a wordpress plugin and have to load the wordpress core to be able to access wordpress functions. This problem is very similar to [Initialize WordPress environment to use in a real cron script](https://wordpress.stackexchange.com/questions/23990/initialize-wordpress-environm...
I came up with following solution. The script have to start with the following code. ``` <?php if( php_sapi_name() !== 'cli' ) { die("Meant to be run from command line"); } function find_wordpress_base_path() { $dir = dirname(__FILE__); do { //it is possible to check fo...
76,477
<p>I have created a custom post type for a property rental site created with WordPress. In it I want to have the input section as checkboxes:</p> <p><img src="https://i.stack.imgur.com/leqBP.jpg" alt="image one"></p> <p>and get the output like this: </p> <p><img src="https://i.stack.imgur.com/aHNDX.jpg" alt="image t...
[ { "answer_id": 76466, "author": "xaedes", "author_id": 9518, "author_profile": "https://wordpress.stackexchange.com/users/9518", "pm_score": 6, "selected": true, "text": "<p>I came up with following solution. The script have to start with the following code.</p>\n\n<pre><code>&lt;?php\n ...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76477", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24967/" ]
I have created a custom post type for a property rental site created with WordPress. In it I want to have the input section as checkboxes: ![image one](https://i.stack.imgur.com/leqBP.jpg) and get the output like this: ![image two](https://i.stack.imgur.com/aHNDX.jpg)
I came up with following solution. The script have to start with the following code. ``` <?php if( php_sapi_name() !== 'cli' ) { die("Meant to be run from command line"); } function find_wordpress_base_path() { $dir = dirname(__FILE__); do { //it is possible to check fo...
76,485
<p>Putting this up after having hit a brick wall for possible solutions.</p> <p>Have a site with quite a few custom post types and associated custom taxonomies. To help make things easy, I'm using a unified <code>taxonomy.php</code> template.</p> <p>Within that template there are three loops. I would like all of them...
[ { "answer_id": 76496, "author": "Steve Claridge", "author_id": 1941, "author_profile": "https://wordpress.stackexchange.com/users/1941", "pm_score": 1, "selected": false, "text": "<p>Do you have the \"paged\" parameter in the URL of the page(s) that you are trying to use get_query_var wi...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76485", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17780/" ]
Putting this up after having hit a brick wall for possible solutions. Have a site with quite a few custom post types and associated custom taxonomies. To help make things easy, I'm using a unified `taxonomy.php` template. Within that template there are three loops. I would like all of them to run on the first page, a...
Try to use the following: ``` $paged = (get_query_var('page')) ? get_query_var('page') : 1; ``` Instead of using: ``` $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ``` I had the same issue and it works for me.
76,500
<p>All the sources mention this as if it worked. </p> <p>Medium size is set to 635x194, but I still get this out:</p> <pre><code>&lt;img width="100" height="100" title="fjaril" alt="fjaril" class="attachment-thumbnail" src="http://blogg.nassjo.se/klassblogg/files/2012/12/fjaril-100x100.jpg"&gt; </code></pre> <p>As y...
[ { "answer_id": 76502, "author": "janw", "author_id": 10911, "author_profile": "https://wordpress.stackexchange.com/users/10911", "pm_score": 0, "selected": false, "text": "<p>Does <code>medium</code> size exist? you can check by vardumping the global:<br>\n<code>global $_wp_additional_im...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76500", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24829/" ]
All the sources mention this as if it worked. Medium size is set to 635x194, but I still get this out: ``` <img width="100" height="100" title="fjaril" alt="fjaril" class="attachment-thumbnail" src="http://blogg.nassjo.se/klassblogg/files/2012/12/fjaril-100x100.jpg"> ``` As you see, it hard-links to the shrunken t...
Install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/). Run it once, and see if your images are being generated. Feel free to keep the plugin installed for future use. (it won't break anything if you *do* uninstall it after you're done)
76,501
<p>Using get_terms I've created three lists of term links. What currently happens if I click on a term is to see the archive for that term, what I'm attempting to achieve now is when I click a second term I want to see an archive for both terms not just the latest term. Basically creating some level of filtering posts....
[ { "answer_id": 76502, "author": "janw", "author_id": 10911, "author_profile": "https://wordpress.stackexchange.com/users/10911", "pm_score": 0, "selected": false, "text": "<p>Does <code>medium</code> size exist? you can check by vardumping the global:<br>\n<code>global $_wp_additional_im...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76501", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4090/" ]
Using get\_terms I've created three lists of term links. What currently happens if I click on a term is to see the archive for that term, what I'm attempting to achieve now is when I click a second term I want to see an archive for both terms not just the latest term. Basically creating some level of filtering posts. ...
Install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/). Run it once, and see if your images are being generated. Feel free to keep the plugin installed for future use. (it won't break anything if you *do* uninstall it after you're done)
76,515
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://wordpress.stackexchange.com/questions/4696/pagination-not-working-with-custom-loop">Pagination not working with custom loop</a> </p> </blockquote> <p>Any ideas why this paged <code>wp_query</code> doesn't seem to want to work?</p> <p>I'v...
[ { "answer_id": 76502, "author": "janw", "author_id": 10911, "author_profile": "https://wordpress.stackexchange.com/users/10911", "pm_score": 0, "selected": false, "text": "<p>Does <code>medium</code> size exist? you can check by vardumping the global:<br>\n<code>global $_wp_additional_im...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76515", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18547/" ]
> > **Possible Duplicate:** > > [Pagination not working with custom loop](https://wordpress.stackexchange.com/questions/4696/pagination-not-working-with-custom-loop) > > > Any ideas why this paged `wp_query` doesn't seem to want to work? I've tried replacing the `pt_pagination` function with the default next/...
Install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/). Run it once, and see if your images are being generated. Feel free to keep the plugin installed for future use. (it won't break anything if you *do* uninstall it after you're done)
76,524
<p>I am trying to calculate the sum total from two custom sub-fields using ACF. The custom field is called 'repeater' and the sub-field is called 'space_avail'. I've tried the code below but it just lists the numbers individually rather than adding them up to a total. Please help.</p> <pre><code>&lt;?php $total = 0...
[ { "answer_id": 76525, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 2, "selected": false, "text": "<pre><code>&lt;?php \n $total = 0;\n while(the_repeater_field('repeater' )): \n the_sub_field('spa...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76524", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24978/" ]
I am trying to calculate the sum total from two custom sub-fields using ACF. The custom field is called 'repeater' and the sub-field is called 'space\_avail'. I've tried the code below but it just lists the numbers individually rather than adding them up to a total. Please help. ``` <?php $total = 0; while(the_re...
``` <?php $total = 0; while(the_repeater_field('repeater' )): the_sub_field('space_avail' ); $total += intval( get_sub_field('space_avail' ) ); endwhile; echo $total; ?> ``` Notice the `intval`. It tells php to consider the result as an number, not as a string
76,529
<p>I installed latest WordPress 3.5 in my CentOS server. When I tried accessing <code>http://example.com/wp-includes/</code>, I received a listing of the directory: (<strong>Index of wp-includes</strong>).</p> <p>I added the following code at the top of <code>.htaccess</code> file, and it fixed the issue:</p> <pre><c...
[ { "answer_id": 76567, "author": "shea", "author_id": 19726, "author_profile": "https://wordpress.stackexchange.com/users/19726", "pm_score": 4, "selected": true, "text": "<p>The PHP files in the <code>wp-includes</code> directory will do nothing when accessed directly. They are designed ...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76529", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24982/" ]
I installed latest WordPress 3.5 in my CentOS server. When I tried accessing `http://example.com/wp-includes/`, I received a listing of the directory: (**Index of wp-includes**). I added the following code at the top of `.htaccess` file, and it fixed the issue: ``` Options -Indexes IndexIgnore .htaccess */.??* *~ *# ...
The PHP files in the `wp-includes` directory will do nothing when accessed directly. They are designed to be `include()`'d in an existing PHP script, such as on the front-end or in the dashboard. Your `Options -Indexes` entry in the `.htaccess` file simply prevents a list of the files in a directory when no `index.php...
76,536
<p>I have tried to apply filters to the_post_thumbnail() function using </p> <pre><code>apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr ); </code></pre> <p>Here's the code I have come up with but doesn't seem to work completely</p> <pre><code> function red_adjust_image_sche...
[ { "answer_id": 76560, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 3, "selected": true, "text": "<p>You've simply the wrong arguments (incl. the list of them).</p>\n\n<pre><code>$caption, $title, $align, $url, $alt\n...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76536", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6027/" ]
I have tried to apply filters to the\_post\_thumbnail() function using ``` apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr ); ``` Here's the code I have come up with but doesn't seem to work completely ``` function red_adjust_image_schema($html, $id, $caption, $title, $a...
You've simply the wrong arguments (incl. the list of them). ``` $caption, $title, $align, $url, $alt ``` are too much in there. And `$attr` is missing. Not that it matters how you name the vars (as long as they start with a character), but it's easier to read for later readers. ``` function wpse76536_image_schema(...
76,538
<p>I have put together a custom registration form on my WordPress site and one of the items on the registration form is an ability to select an interest.</p> <p>Essentially I have the following code from the registration form...</p> <pre><code> update_usermeta( $user_id, 'interests', $_POST['interests'] ); </code></p...
[ { "answer_id": 76545, "author": "Brooke.", "author_id": 2204, "author_profile": "https://wordpress.stackexchange.com/users/2204", "pm_score": 1, "selected": false, "text": "<p>Why reinvent the wheel? You should be able to hook into <a href=\"http://codex.wordpress.org/Function_Reference/...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76538", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24984/" ]
I have put together a custom registration form on my WordPress site and one of the items on the registration form is an ability to select an interest. Essentially I have the following code from the registration form... ``` update_usermeta( $user_id, 'interests', $_POST['interests'] ); ``` I would need a code that ...
See this example on the [question 19259](https://wordpress.stackexchange.com/questions/18839/custom-post-type-without-editor-or-revisions-notify-on-update/19259#19259). The function was init on publish a post, change the hook to your post type or use on default `post` - Hook `publish_post`. Before you send check in th...
76,549
<p>Can you help me figure out why my RSS feeds do not work? I have a very standard Wordpress 3.4.2 install for this Solar Blog, however none of the RSS, RSS2, or Atom feeds will function. I am using permalinks in the following format:</p> <p><a href="http://blog.paramountsolar.com/2012/12/18/sample-post/" rel="nofollo...
[ { "answer_id": 76545, "author": "Brooke.", "author_id": 2204, "author_profile": "https://wordpress.stackexchange.com/users/2204", "pm_score": 1, "selected": false, "text": "<p>Why reinvent the wheel? You should be able to hook into <a href=\"http://codex.wordpress.org/Function_Reference/...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76549", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24983/" ]
Can you help me figure out why my RSS feeds do not work? I have a very standard Wordpress 3.4.2 install for this Solar Blog, however none of the RSS, RSS2, or Atom feeds will function. I am using permalinks in the following format: <http://blog.paramountsolar.com/2012/12/18/sample-post/> (day and name, option #2) Thi...
See this example on the [question 19259](https://wordpress.stackexchange.com/questions/18839/custom-post-type-without-editor-or-revisions-notify-on-update/19259#19259). The function was init on publish a post, change the hook to your post type or use on default `post` - Hook `publish_post`. Before you send check in th...
76,553
<p>I have the following query which I call in my taxonomy.php template via <code>query_brands_geo('dealers', 'publish', '1', $taxtype, $geo, $brands);</code></p> <p>This function works perfectly. However after reading codex for query posts it mentioned pre_get_posts as a preferred way to alter the default query. Woul...
[ { "answer_id": 76573, "author": "M-R", "author_id": 17061, "author_profile": "https://wordpress.stackexchange.com/users/17061", "pm_score": 5, "selected": true, "text": "<p><code>pre_get_posts</code> will run the same query, so both will take same time. But, If you utilize <code>pre_get_...
2012/12/18
[ "https://wordpress.stackexchange.com/questions/76553", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24439/" ]
I have the following query which I call in my taxonomy.php template via `query_brands_geo('dealers', 'publish', '1', $taxtype, $geo, $brands);` This function works perfectly. However after reading codex for query posts it mentioned pre\_get\_posts as a preferred way to alter the default query. Would the pre\_get\_post...
`pre_get_posts` will run the same query, so both will take same time. But, If you utilize `pre_get_posts` action you will save one or more SQL queries. Right now, WordPress is running default query and then you run your query with this function which replace the results of the default query (resulting, default query is...
76,580
<p>I have found a tutorial online for creating a custom categories template for my archived posts within a particular category. This however is targetting a specific category ID (see below), is there anyway of creating a template that targets all rather than one specific ID?</p> <pre><code>&lt;?php /* Template Name: C...
[ { "answer_id": 76581, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 2, "selected": false, "text": "<p>Remove the <code>cat</code> parameter from your query and name your template file <code>category.php</code></p>\n...
2012/12/19
[ "https://wordpress.stackexchange.com/questions/76580", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23874/" ]
I have found a tutorial online for creating a custom categories template for my archived posts within a particular category. This however is targetting a specific category ID (see below), is there anyway of creating a template that targets all rather than one specific ID? ``` <?php /* Template Name: Category-Tutorials...
Remove the `cat` parameter from your query and name your template file `category.php` From the WordPress Codex on [Template Hierarchy](http://codex.wordpress.org/Template_Hierarchy); ```html 1. category-{slug}.php - If the category's slug were news, WordPress would look for category-news.php 2. category-{id}.php -...
76,593
<p>in my header and other sections I would like to use </p> <pre><code>&lt;script src="/incs/js/script.js"&gt;&lt;/script&gt; </code></pre> <p>While maintaining the default theme folder structure in server as below</p> <pre><code>/wp-content/themes/theme-name/incs/js/script.js </code></pre> <p>file need to be acces...
[ { "answer_id": 76595, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 3, "selected": false, "text": "<p>The easiest way to move your theme folder is only via constant; include the wp-content folder.\nYou can set a cons...
2012/12/19
[ "https://wordpress.stackexchange.com/questions/76593", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16419/" ]
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
The easiest way to move your theme folder is only via constant; include the wp-content folder. You can set a constant for the plugin folder and wp-content folder. Then is your plugins and themes in separete url, also in the include in the source of the frontend. like this example for my dev installs: ``` define( 'WP_...
76,600
<p>For our school, we use a wordpress network. The main domain gives access to general information and sub-sites are specific projects managed by students.</p> <p>I would like that all sub-sites have their url appended with a fake folder name.</p> <p><strong>example</strong></p> <p>Say the main domain is school.edu<...
[ { "answer_id": 76611, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": false, "text": "<p>I had a similar issue with another client, entering something like projects/project1 would error as the / wou...
2012/12/19
[ "https://wordpress.stackexchange.com/questions/76600", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82/" ]
For our school, we use a wordpress network. The main domain gives access to general information and sub-sites are specific projects managed by students. I would like that all sub-sites have their url appended with a fake folder name. **example** Say the main domain is school.edu My sub-sites are ``` school.edu/pr...
I had a similar issue with another client, entering something like projects/project1 would error as the / would fail validation. After failing to find an override or filter, instead I found a loophole. If you make projectsproject1, then afterwards edit the site so its url is projects/project1 and save, update the home...
76,602
<p><strong>Case:</strong> I have a client that doesn't know much about the digital world. However what she does know is how to get the photo's from her camera on to the computer and in WordPress. However she doesn't know how to downsize the photo's to a normal size. </p> <p><strong>Solution:</strong> I like WordPress ...
[ { "answer_id": 76606, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": false, "text": "<p>Resizing is already done to create the large/medium/thumb sizes, but the problem your facing is that the imag...
2012/12/19
[ "https://wordpress.stackexchange.com/questions/76602", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8757/" ]
**Case:** I have a client that doesn't know much about the digital world. However what she does know is how to get the photo's from her camera on to the computer and in WordPress. However she doesn't know how to downsize the photo's to a normal size. **Solution:** I like WordPress to automatically downsize those phot...
I was able to solve it using the following code: ``` function my_handle_upload ( $params ) { $filePath = $params['file']; if ( (!is_wp_error($params)) && file_exists($filePath) && in_array($params['type'], array('image/png','image/gif','image/jpeg'))) { $quality = 90; ...
76,603
<p>I have a site at <a href="http://iqonline.eu" rel="noreferrer">http://iqonline.eu</a> which uses w3 total cache for all its caching and minifying purposes and everything is working nicely as per normal. However when checking the site on Google page speed it still says that leverage browser caching isn't being used a...
[ { "answer_id": 77423, "author": "Pontus Abrahamsson", "author_id": 16722, "author_profile": "https://wordpress.stackexchange.com/users/16722", "pm_score": 2, "selected": false, "text": "<p>I recommend you to read this article W3 Total Cache -Plugin: <a href=\"http://zemalf.com/1443/w3-to...
2012/12/19
[ "https://wordpress.stackexchange.com/questions/76603", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23226/" ]
I have a site at <http://iqonline.eu> which uses w3 total cache for all its caching and minifying purposes and everything is working nicely as per normal. However when checking the site on Google page speed it still says that leverage browser caching isn't being used and to extend the freshness time of certain media it...
I recommend you to read this article W3 Total Cache -Plugin: [The Complete Settings Guide](http://zemalf.com/1443/w3-total-cache/), it's a great tutorial to manually setup your w3tc. And when you saving your settings remember to flush your cache because if you don't Google Pagespeed will test it on the old cached file...