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
17,663
<p>I want my to reach my website's main page when entering an url like:</p> <p><a href="http://example.com/blog" rel="nofollow">http://example.com/blog</a></p> <p>However, I can't seem to get it to work with a typical rewrite rule:</p> <pre><code>RewriteRule ^/blog$ / </code></pre> <p>I'm always taken to my site's ...
[ { "answer_id": 17694, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 3, "selected": false, "text": "<p>I'd try something simple, before messing around with an endless sea of possibilites/hosting setups: </p>\n\n<pre><c...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17663", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4534/" ]
I want my to reach my website's main page when entering an url like: <http://example.com/blog> However, I can't seem to get it to work with a typical rewrite rule: ``` RewriteRule ^/blog$ / ``` I'm always taken to my site's 404 page. Works fine if I specify a specific file (e.g. "/foo.html") instead of "/", but "...
`wp-content/uploads/` should be writable for the server (otherwise it would be impossible to upload a file, no?). If you are going to create something under this directory, it is safe to use `wp_mkdir_p()`. I would only use `WP_Filesystem` if there is a chance the server does not have permissions to write to the locat...
17,669
<p>If anyone can help me I would be gratefull!</p> <hr> <p>I got a <em>gravity form</em> with the post_type fields including the submit image when submited it displays the: </p> <ul> <li>title</li> <li>content </li> <li>image </li> <li>tags</li> </ul> <p><strong>So my question is:</strong></p> <p>When I go to sing...
[ { "answer_id": 17677, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 0, "selected": false, "text": "<p>You can find all the functions you need <a href=\"http://codex.wordpress.org/Function_Reference/wp_get_attachment_u...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17669", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5499/" ]
If anyone can help me I would be gratefull! --- I got a *gravity form* with the post\_type fields including the submit image when submited it displays the: * title * content * image * tags **So my question is:** When I go to single.php I posted a code: `get_related_author_posts();` which calls the authors last tw...
I would use `wp_get_attachment_image()` ([Codex ref](http://codex.wordpress.org/Function_Reference/wp_get_attachment_image)), which returns a fully-formed HTML IMG tag: ``` <?php wp_get_attachment_image( $attachment_id, $size, $icon ); ?> ``` I assume you already know how to get the attachment image ID? The defau...
17,681
<p>Is it possible to include or exclude specific named widgets that are assigned to a named dynamic_sidebar call?</p> <p>For example, if I've registered a sidebar named "my_sidebar" and the user had placed a "Links" widget into it, I want to be able to include or exclude it based on a custom setting in my theme option...
[ { "answer_id": 17687, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 4, "selected": true, "text": "<p><code>dynamic_sidebar()</code> calls <code>wp_get_sidebars_widgets()</code> to get all widgets per sidebar. I think f...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17681", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
Is it possible to include or exclude specific named widgets that are assigned to a named dynamic\_sidebar call? For example, if I've registered a sidebar named "my\_sidebar" and the user had placed a "Links" widget into it, I want to be able to include or exclude it based on a custom setting in my theme options panel....
`dynamic_sidebar()` calls `wp_get_sidebars_widgets()` to get all widgets per sidebar. I think filtering this output is the best way to remove a widget from an sidebar. ``` add_filter( 'sidebars_widgets', 'wpse17681_sidebars_widgets' ); function wpse17681_sidebars_widgets( $sidebars_widgets ) { if ( is_page() /* Or...
17,689
<p>I'm trying to add items to the admin bar but only for users with certain capabilities, such as <code>add_movies</code> in a plugin. The problem is that, according to <a href="https://wordpress.stackexchange.com/questions/14041/current-user-can-on-wordpress-3-1-1">@toscho</a> and <a href="https://wordpress.stackexcha...
[ { "answer_id": 17691, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 0, "selected": false, "text": "<p>Try it with <code>if ( current_user_can('capability') ) : /* your code */; endif;</code></p>\n\n<p>EDIT: Haven't re...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17689", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
I'm trying to add items to the admin bar but only for users with certain capabilities, such as `add_movies` in a plugin. The problem is that, according to [@toscho](https://wordpress.stackexchange.com/questions/14041/current-user-can-on-wordpress-3-1-1) and [@TheDeadMedic](https://wordpress.stackexchange.com/questions/...
The check will be called too early if you just write it in your plugin file like this: ``` if ( current_user_can( 'add_movies' ) ) { add_action( 'admin_bar_menu', 'wpse17689_admin_bar_menu' ); } function wpse17689_admin_bar_menu( &$wp_admin_bar ) { $wp_admin_bar->add_menu( /* ... */ ); } ``` Because it will ...
17,700
<p>I have the following code generated by wordpress for my nav1:</p> <pre><code>&lt;div id="nav1"&gt; &lt;ul class="menusm"&gt; &lt;li class="page_item page-item-6"&gt;&lt;a title="Inicio" href="http://localhost/road/" class="top_level"&gt;Inicio&lt;/a&gt;&lt;/li&gt; &lt;li class="page_item page-item-11"&gt;&l...
[ { "answer_id": 17702, "author": "chrisjlee", "author_id": 5149, "author_profile": "https://wordpress.stackexchange.com/users/5149", "pm_score": 2, "selected": true, "text": "<p><strong>jQuery Solution</strong></p>\n\n<p>if you're using jQuery you can use: </p>\n\n<p><code>var $li = jQuer...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17700", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5057/" ]
I have the following code generated by wordpress for my nav1: ``` <div id="nav1"> <ul class="menusm"> <li class="page_item page-item-6"><a title="Inicio" href="http://localhost/road/" class="top_level">Inicio</a></li> <li class="page_item page-item-11"><a title="Quienes Somos" href="http://localhost/road/quien...
**jQuery Solution** if you're using jQuery you can use: `var $li = jQuery('ul > li:last-child','#nav1');` to select your last menu child. Then after you select it you can chain it with another function: `$li.wrapInner('<input type="button" value="My Button!">');` Then all together: ``` jQuery(document).ready(fu...
17,704
<p>I am working on a new version our site. Today I was going to put the blog on the new version.</p> <p>Our current website and the successor I am building are on different servers and accessed by different domain names.</p> <p>So what I did was import the database the blog uses into the dev site. Then I copied all t...
[ { "answer_id": 17706, "author": "MZAweb", "author_id": 5223, "author_profile": "https://wordpress.stackexchange.com/users/5223", "pm_score": 3, "selected": true, "text": "<p>If you didn't hand-change the wpurl in the dev database, what probably happened is that you entered your url, and ...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17704", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3689/" ]
I am working on a new version our site. Today I was going to put the blog on the new version. Our current website and the successor I am building are on different servers and accessed by different domain names. So what I did was import the database the blog uses into the dev site. Then I copied all the files and put ...
If you didn't hand-change the wpurl in the dev database, what probably happened is that you entered your url, and WP made a 301 redirect to the live site. Then, without realizing it, you changed the url config in your live site. To make it work: Put this in your wp-config.php ``` define('WP_SITEURL', 'http://your-wp...
17,709
<p>I would like to be able to change the text on the Log In button in wp-login.php - however, it's a bit more complicated than that. I want to be able to change it in the theme, rather than editing the core file directly, so that a) It doesn’t get overwritten when WordPress updates, and b) It'll transfer over if I dis...
[ { "answer_id": 17711, "author": "alexndm", "author_id": 4678, "author_profile": "https://wordpress.stackexchange.com/users/4678", "pm_score": 0, "selected": false, "text": "<p>Just replace \"login\" button with an image in logins.css</p>\n" }, { "answer_id": 17724, "author": ...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17709", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5514/" ]
I would like to be able to change the text on the Log In button in wp-login.php - however, it's a bit more complicated than that. I want to be able to change it in the theme, rather than editing the core file directly, so that a) It doesn’t get overwritten when WordPress updates, and b) It'll transfer over if I distri...
The *"Log In"* string is passed to the translation function, and you can filter that. To prevent needing to filter every little string, you can activate this filter right before the login form is printed. ``` add_action( 'login_form', 'wpse17709_login_form' ); function wpse17709_login_form() { add_filter( 'gettext...
17,710
<p>I'm trying to create a rather large and extensive settings page with various options of very similar type.</p> <p>Since there will be about 20 different fields, and the differences between most of those being simply their ID, I'd like to avoid creating a separate callback for each one.</p> <p>Is it possible to mak...
[ { "answer_id": 17713, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": true, "text": "<p>The last optional <code>$args</code> argument the you can pass to <a href=\"https://wordpress.stackexchange.com/quest...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17710", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5513/" ]
I'm trying to create a rather large and extensive settings page with various options of very similar type. Since there will be about 20 different fields, and the differences between most of those being simply their ID, I'd like to avoid creating a separate callback for each one. Is it possible to make a callback with...
The last optional `$args` argument the you can pass to [`add_settings_fields()`](https://wordpress.stackexchange.com/questions/17710/add-settings-field-parameterizing-callback) is passed to callback. So it seems you can use same callback just fine. Hope I am right because I just stumbled onto this two minutes ago beca...
17,717
<p>The code below is the function for pagination in my wordpress blog. Presently it outputs 7 pages and then the .. last page number.</p> <p>How can I reduce this number so it shows only 5 pages and then ... last page number?</p> <pre><code>function emm_paginate_loop($start, $max, $page = 0) { $output = ""; f...
[ { "answer_id": 17713, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": true, "text": "<p>The last optional <code>$args</code> argument the you can pass to <a href=\"https://wordpress.stackexchange.com/quest...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17717", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5411/" ]
The code below is the function for pagination in my wordpress blog. Presently it outputs 7 pages and then the .. last page number. How can I reduce this number so it shows only 5 pages and then ... last page number? ``` function emm_paginate_loop($start, $max, $page = 0) { $output = ""; for ($i = $start; $i <...
The last optional `$args` argument the you can pass to [`add_settings_fields()`](https://wordpress.stackexchange.com/questions/17710/add-settings-field-parameterizing-callback) is passed to callback. So it seems you can use same callback just fine. Hope I am right because I just stumbled onto this two minutes ago beca...
17,726
<p>I want to create dynamic capabilities using <a href="http://wpdocs.labs.dxw.com/classes/WP_Role.html#method-i-add_cap" rel="noreferrer">WP_Role::add_cap()</a>, something like</p> <pre><code>$author_role = get_role('author'); foreach ($sections as $section) { $author_role-&gt;add_cap( "edit_{$section}_pages", /...
[ { "answer_id": 17730, "author": "Matthew Muro", "author_id": 1511, "author_profile": "https://wordpress.stackexchange.com/users/1511", "pm_score": 1, "selected": false, "text": "<p>Capabilities are permissions for roles. Those roles are then extended to the users, which determines what ...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17726", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5519/" ]
I want to create dynamic capabilities using [WP\_Role::add\_cap()](http://wpdocs.labs.dxw.com/classes/WP_Role.html#method-i-add_cap), something like ``` $author_role = get_role('author'); foreach ($sections as $section) { $author_role->add_cap( "edit_{$section}_pages", /* grant= */ false ); } ``` and then let a...
you can assign capabilities directly to user using the class [`WP_user::add_cap()`](http://codex.wordpress.org/Class_Reference/WP_User#add_cap.28.24cap_.5B.2C_.24grant_.5D_.29) ``` //to remove capability from user $user = new WP_User( $user_id ); $user->remove_cap( 'can_email'); //to add capability to user $user = ne...
17,727
<p>I'm developing a plugin that I'll install for all my clients to make WordPress slightly easier to use for them. One of the things it will change is name of the W3 Total Cache Admin menu from "Performance" to "Ytelse (avansert)". </p> <p>I know how to rename the default admin menus. The code below changes "Posts" to...
[ { "answer_id": 17761, "author": "Lee Peterson", "author_id": 5525, "author_profile": "https://wordpress.stackexchange.com/users/5525", "pm_score": 2, "selected": false, "text": "<p>You may be able to use the WordPress filter 'gettext':</p>\n\n<p><a href=\"http://codex.wordpress.org/Plugi...
2011/05/19
[ "https://wordpress.stackexchange.com/questions/17727", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5508/" ]
I'm developing a plugin that I'll install for all my clients to make WordPress slightly easier to use for them. One of the things it will change is name of the W3 Total Cache Admin menu from "Performance" to "Ytelse (avansert)". I know how to rename the default admin menus. The code below changes "Posts" to "Nyheter"...
You may be able to use the WordPress filter 'gettext': <http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext> ``` add_filter( 'gettext', 'rename_menu_item' ); function rename_menu_item( $translated ) { $translated = str_replace( 'Performance', 'Ytelse', $translated ); return $translated; } ```
17,745
<p>I have 1 important taxonomy that contains 2 different custom post type content. I want somehow show them in same taxonomy page with both paging. Well.. i am not sure i can do that or not. Is it possible to paging 2 different CPT in same taxonomy?</p>
[ { "answer_id": 17754, "author": "Lee Peterson", "author_id": 5525, "author_profile": "https://wordpress.stackexchange.com/users/5525", "pm_score": 0, "selected": false, "text": "<p>I think you're saying you have 2 post types which each share the same taxonomy term.</p>\n\n<p>Create a tem...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17745", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1372/" ]
I have 1 important taxonomy that contains 2 different custom post type content. I want somehow show them in same taxonomy page with both paging. Well.. i am not sure i can do that or not. Is it possible to paging 2 different CPT in same taxonomy?
You can create two separate loops with pagination - and place them in side by side div containers - with pagination links inside each div. You would include the pagination links in each div, because you might have more of one post type then the other, and therefor more pages than the other. The columns will paginate ...
17,748
<p>I've been looking for a solution to my problem for some time now, and I can't seem to find one.</p> <p>I have created a submenu using the following code from the Codex:</p> <pre><code>&lt;?php if($post-&gt;post_parent) { $children = wp_list_pages("title_li=&amp;child_of=".$post-&gt;post_parent."&amp;echo=0"); $...
[ { "answer_id": 17753, "author": "Lee Peterson", "author_id": 5525, "author_profile": "https://wordpress.stackexchange.com/users/5525", "pm_score": 0, "selected": false, "text": "<p>You could try the wp_nav_menu function and create menus in order to get the depth you want.</p>\n\n<p><a hr...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17748", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4395/" ]
I've been looking for a solution to my problem for some time now, and I can't seem to find one. I have created a submenu using the following code from the Codex: ``` <?php if($post->post_parent) { $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); $titlenamer = get_the_title($post->post...
I think you need to use `depth=1` rather than `depth=2`. You are specifying, via the `child_of` argument, that you want to display *children of the current Page's parent Page*. That means that the first level of hierarchy is the current Page (and any of its siblings). The *second* level of hierarchy would be *child* p...
17,773
<p>Im trying to build a function which grabs the feedburner "readers" using <code>wp_remote_get()</code>. I noticed that it frequently returned a value of <code>0</code>. </p> <p>I assumed at first that it was a WordPress error (handled by <code>is_wp_error()</code>) or a flaw with <code>wp_remote_get()</code>. Wrong ...
[ { "answer_id": 17775, "author": "Norcross", "author_id": 403, "author_profile": "https://wordpress.stackexchange.com/users/403", "pm_score": -1, "selected": false, "text": "<p>To grab Feedburner stats, I've always used <code>wp_cache_get</code>. Here's a function I've had success with</p...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17773", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5018/" ]
Im trying to build a function which grabs the feedburner "readers" using `wp_remote_get()`. I noticed that it frequently returned a value of `0`. I assumed at first that it was a WordPress error (handled by `is_wp_error()`) or a flaw with `wp_remote_get()`. Wrong of-course.. Feedburner just kept crashing, so I used ...
WordPress can be inconsistent as to when is returns a `WP_Error` object and when it just returns `false` or `string(0)` when actually there was an error. I am not sure exactly what feedburner is returning that is not triggering a `WP_Error` from `wp_remote_get()` - but if you know `wp_remote_get()` will return an WP\_E...
17,781
<p>Hey everyone, I can't se the image of the post (it is attached through gravity form as a post-image) with this function I see the missing image icon with the title and the working link but no thumbnail image.? It is suposed to be more or less ( authors last 2 posts in the widget area) I suspect the problem is here :...
[ { "answer_id": 17812, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": true, "text": "<p>Do I understand right that you mean featured thumbnail image for a post and not just any attached image?</p>\n\n<p>Se...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17781", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5499/" ]
Hey everyone, I can't se the image of the post (it is attached through gravity form as a post-image) with this function I see the missing image icon with the title and the working link but no thumbnail image.? It is suposed to be more or less ( authors last 2 posts in the widget area) I suspect the problem is here : `...
Do I understand right that you mean featured thumbnail image for a post and not just any attached image? See [`get_the_post_thumbnail()`](http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail) function and your usage will be something like this: ``` $output .= get_the_post_thumbnail( $authors_post->ID ...
17,786
<p>I am trying to add a TinyMCE editor in my frontend from where users can post but have had no luck so far. Here is the code:</p> <p><strong>PHP:</strong></p> <pre><code>add_action('wp_print_scripts', 'my_enqueue_scripts'); function my_enqueue_scripts() { wp_enqueue_script( 'tiny_mce' ); if (f...
[ { "answer_id": 21053, "author": "maryisdead", "author_id": 2637, "author_profile": "https://wordpress.stackexchange.com/users/2637", "pm_score": 2, "selected": false, "text": "<p><code>editor_selector</code> is for targeting classes, not ids.</p>\n\n<p>Also, when using <code>editor_selec...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17786", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3094/" ]
I am trying to add a TinyMCE editor in my frontend from where users can post but have had no luck so far. Here is the code: **PHP:** ``` add_action('wp_print_scripts', 'my_enqueue_scripts'); function my_enqueue_scripts() { wp_enqueue_script( 'tiny_mce' ); if (function_exists('wp_tiny_mce')) wp_...
Well, Thanks to wp 3.3 now we have [`wp_editor()`](https://developer.wordpress.org/reference/functions/wp_editor/) function to do that :)
17,787
<p>I am learning development of plugins, I am stuck into saving the plugin options form data.</p> <p>I have a plugin options page, where three fields asking for number of videos, height and width are coded.</p> <p>When I enter the values into it, and hit on save its just saving one value, that is, number of videos.</...
[ { "answer_id": 17795, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 0, "selected": false, "text": "<p>WordPress will do the work for you.</p>\n\n<p>Quick example of an option page containing a form with 1 field.</p>\...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17787", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1743/" ]
I am learning development of plugins, I am stuck into saving the plugin options form data. I have a plugin options page, where three fields asking for number of videos, height and width are coded. When I enter the values into it, and hit on save its just saving one value, that is, number of videos. Here is my code ...
First, you really should be storing your options as an array in `wp_options`. But should you choose not to, you really should change the names of your second and third options; "height" and "width" are entirely too generic, and almost assuredly will cause conflicts. You're passing `name="height"` and `name="width"`, re...
17,788
<p>I want to embed my code at BitBucket in wp post, anyone can suggest me, a good plugin or anytrick to do it?</p>
[ { "answer_id": 17809, "author": "Hameedullah Khan", "author_id": 5337, "author_profile": "https://wordpress.stackexchange.com/users/5337", "pm_score": 2, "selected": false, "text": "<p>Here try the below code, it should give you a good start.</p>\n\n<pre><code>// requrires 3 arguments\n/...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17788", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2286/" ]
I want to embed my code at BitBucket in wp post, anyone can suggest me, a good plugin or anytrick to do it?
Here try the below code, it should give you a good start. ``` // requrires 3 arguments // user, project, path // usage e.g: [bitbucket user="jespern" project="django-piston" path="piston/utils.py"] function bitbucket_code( $atts ) { extract( $atts ); global $post; $path_to_name = str_replace("/", "_", $pat...
17,805
<p>First, Here is the full error:</p> <pre><code>PHP Fatal error: Call to undefined function download_url() in /path/to/wordpress/wp-admin/includes/media.php on line 562 </code></pre> <p>I have also posted the related functions at the bottom of my question.</p> <p>I am modifying a script for my company's website wh...
[ { "answer_id": 17807, "author": "Horttcore", "author_id": 1379, "author_profile": "https://wordpress.stackexchange.com/users/1379", "pm_score": 4, "selected": true, "text": "<p>You have to include /path/to/wordpress/wp-admin/includes/file.php this file also,\nas the media.php uses the fu...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17805", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4990/" ]
First, Here is the full error: ``` PHP Fatal error: Call to undefined function download_url() in /path/to/wordpress/wp-admin/includes/media.php on line 562 ``` I have also posted the related functions at the bottom of my question. I am modifying a script for my company's website which allows us to automate the ret...
You have to include /path/to/wordpress/wp-admin/includes/file.php this file also, as the media.php uses the function download\_url() from that file.
17,808
<p>I've assigned a specific html page (let's call it an author bio page) to each user in the 'website' field within the user admin area. How do I get that URL to display within a single page post? I'm assuming that I'm to use $curauth->user_url but it returns a blank page.</p>
[ { "answer_id": 17810, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>use <a href=\"http://codex.wordpress.org/Function_Reference/the_author_link\" rel=\"nofollow\"><code>the_author_lin...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17808", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5278/" ]
I've assigned a specific html page (let's call it an author bio page) to each user in the 'website' field within the user admin area. How do I get that URL to display within a single page post? I'm assuming that I'm to use $curauth->user\_url but it returns a blank page.
you need to assign `$curauth` and since you are not on an author archive but on a regular page you can use [get\_userdata](http://codex.wordpress.org/Function_Reference/get_userdata) function and pass the user ID like so: ``` $curauth = get_userdata(1); //and then use echo $curauth->user_url; ``` or if you are in t...
17,826
<p>I tried to add thumbnail support to my theme</p> <pre><code>add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size(133, 133, true); add_theme_support( 'post-thumbnails', array( 'post' ) ); add_theme_support( 'post-thumbnails', array( 'page' ) ); </code></pre> <p>So this isnt working, or at least I'm not s...
[ { "answer_id": 17820, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 1, "selected": false, "text": "<p>WordPress does not patch older versions, so you will have to upgrade or manually apply patches yourself.</p>\n" }...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17826", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3976/" ]
I tried to add thumbnail support to my theme ``` add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size(133, 133, true); add_theme_support( 'post-thumbnails', array( 'post' ) ); add_theme_support( 'post-thumbnails', array( 'page' ) ); ``` So this isnt working, or at least I'm not sure how this should work, ...
WordPress backports security updates usually 1-3 versions back but they don't promise anything. The WordPress [LTS](https://wiki.ubuntu.com/LTS) philosophy is that LTS = "[Long Term Suckage](http://lists.automattic.com/pipermail/wp-hackers/2010-June/032483.html)" The Long Term Suckage theory is: > > While I like th...
17,837
<p>Okay so the website I webmaster for <a href="http://www.detroitdungeon.com" rel="nofollow">http://www.detroitdungeon.com</a> has been having some analytic issues as of lately. I have the google analytics plugin installed and it was working fine for quite sometime. All of a sudden the plugin caused IE users to crash ...
[ { "answer_id": 17843, "author": "NW Tech", "author_id": 5295, "author_profile": "https://wordpress.stackexchange.com/users/5295", "pm_score": 0, "selected": false, "text": "<p>I'm not able to install plugins atm to test, but maybe this plugin would work for the files you FTP - <a href=\"...
2011/05/20
[ "https://wordpress.stackexchange.com/questions/17837", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5544/" ]
Okay so the website I webmaster for <http://www.detroitdungeon.com> has been having some analytic issues as of lately. I have the google analytics plugin installed and it was working fine for quite sometime. All of a sudden the plugin caused IE users to crash after the page had loaded. So instead of using the plug in I...
Why not just add `.txt` to the file? It's probably the safest thing to do. If you need the file name to display without the extension, you can always filter the string.
17,863
<p>Here's what I'd like to do: </p> <p>a) Create a custom post type and write panel for a menu item called "My Stuff."</p> <p>b) "My Stuff" will behave like a category -- but the content will not appear in the main blog. It will only appear under "My Stuff."</p> <p>So, what do I need to do? Create another loop? If s...
[ { "answer_id": 17865, "author": "Chris", "author_id": 5555, "author_profile": "https://wordpress.stackexchange.com/users/5555", "pm_score": 0, "selected": false, "text": "<p>I just had to do something similar. My solution was to create a template php file and then create a Page that use...
2011/05/21
[ "https://wordpress.stackexchange.com/questions/17863", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5486/" ]
Here's what I'd like to do: a) Create a custom post type and write panel for a menu item called "My Stuff." b) "My Stuff" will behave like a category -- but the content will not appear in the main blog. It will only appear under "My Stuff." So, what do I need to do? Create another loop? If so, where would I put the...
> > a) Create a custom post type and write panel for a menu item called "My Stuff." > > > Simple. The [Codex](http://codex.wordpress.org/Function_Reference/register_post_type) should tell you everything you need to know. But here is another example: ``` add_action( 'init', 'wpse_17863' ); /** * Creates a visib...
17,885
<p>I am trying to make a custom message instead of the default message when i save a post, does anybody know how to do it!</p>
[ { "answer_id": 29254, "author": "Ünsal Korkmaz", "author_id": 1372, "author_profile": "https://wordpress.stackexchange.com/users/1372", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/register_post_type\">http://codex.wordpress.org/Fu...
2011/05/21
[ "https://wordpress.stackexchange.com/questions/17885", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5564/" ]
I am trying to make a custom message instead of the default message when i save a post, does anybody know how to do it!
<http://codex.wordpress.org/Function_Reference/register_post_type> example: ``` //add filter to ensure the text Book, or book, is displayed when user updates a book add_filter('post_updated_messages', 'codex_book_updated_messages'); function codex_book_updated_messages( $messages ) { global $post, $post_ID; ...
17,894
<p>I'm trying to create an advertisement block to be placed on a single post (single.php) such that the div class or id is left aligned and the post content wrapped around it. I checked the single.php and this is the only piece of code I notice is what displays the post.</p> <pre><code>&lt;div class="entry entry-conte...
[ { "answer_id": 17895, "author": "Roman", "author_id": 3817, "author_profile": "https://wordpress.stackexchange.com/users/3817", "pm_score": 3, "selected": true, "text": "<p>You have to put your advertisement block just before <code>&lt;?php the_content(); ?&gt;</code> in a separate div-l...
2011/05/21
[ "https://wordpress.stackexchange.com/questions/17894", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5411/" ]
I'm trying to create an advertisement block to be placed on a single post (single.php) such that the div class or id is left aligned and the post content wrapped around it. I checked the single.php and this is the only piece of code I notice is what displays the post. ``` <div class="entry entry-content"> ...
You have to put your advertisement block just before `<?php the_content(); ?>` in a separate div-layer and add some css to it. E.g. single.php ---------- ``` <div class="entry entry-content"> <div class="advertisement"> <p>Your advertisement</p> </div> <?php the_content(); ?> </div> ``` CSS ---...
17,897
<p>I am using WordPress, and when I post some post data into my WordPress post, including some html code, as follows:</p> <pre><code>&lt;code&gt;&lt;div id="access"&gt;&lt;/div&gt;&lt;/code&gt; </code></pre> <p>I want the code to be displayed, but the code is not displayed. </p> <p>How can I make it work?</p>
[ { "answer_id": 17898, "author": "Blender", "author_id": 1582, "author_profile": "https://wordpress.stackexchange.com/users/1582", "pm_score": 2, "selected": false, "text": "<p>You have to escape the <code>&lt;</code> and <code>&gt;</code> signs with their HTML entities:</p>\n\n<pre><code...
2011/05/21
[ "https://wordpress.stackexchange.com/questions/17897", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11893/" ]
I am using WordPress, and when I post some post data into my WordPress post, including some html code, as follows: ``` <code><div id="access"></div></code> ``` I want the code to be displayed, but the code is not displayed. How can I make it work?
You have to escape the `<` and `>` signs with their HTML entities: ``` &lt;div id="access"&gt;&lt;/div&gt; ``` Now, the browser doesn't render the code inside of the `<code>` blocks.
17,907
<p>I want to load a .js file only on a specific page in Wordpress 3.1.2 So I use in functions.php</p> <pre><code>function my_init_method() { if (is_page('myinfopage')){ echo "yeeessssssss"; //wp_register_script('RGraph',get_stylesheet_directory_uri() . '/js/RGraph/RGraph.common.core.js' ); } } add_action('ini...
[ { "answer_id": 17908, "author": "Vijay", "author_id": 4452, "author_profile": "https://wordpress.stackexchange.com/users/4452", "pm_score": 0, "selected": false, "text": "<p>add_action just hooks a function call to an event. In order to originally call the action you should use do_action...
2011/05/18
[ "https://wordpress.stackexchange.com/questions/17907", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I want to load a .js file only on a specific page in Wordpress 3.1.2 So I use in functions.php ``` function my_init_method() { if (is_page('myinfopage')){ echo "yeeessssssss"; //wp_register_script('RGraph',get_stylesheet_directory_uri() . '/js/RGraph/RGraph.common.core.js' ); } } add_action('init', 'my_init_m...
You probably want to drop the conditional during init. You are just registering the script here, not enqueueing it. Once registered, you should be able to call the script later in the action sequence. Please try something like this: ``` function myplugin_css() { if ( is_page( 'myinfopage' ) ) { wp_enqueue_...
17,914
<p>Ok so i have added a custom field inside of the WordPress edit profile field where a contributor and above can add a custom image if they do not use gravatar. Now i am trying to write a if else statement and this is what i have </p> <pre><code>&lt;? $hasauthorpic = (the_author_meta('author_pic')); if (funct...
[ { "answer_id": 17915, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 2, "selected": false, "text": "<p>Your <code>if</code> will always return true and bypass your custom author pic.</p>\n\n<p>Run the if on the custom...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17914", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4998/" ]
Ok so i have added a custom field inside of the WordPress edit profile field where a contributor and above can add a custom image if they do not use gravatar. Now i am trying to write a if else statement and this is what i have ``` <? $hasauthorpic = (the_author_meta('author_pic')); if (function_exists('get_a...
You need to use get\_the\_author\_meta() instead of the\_author\_meta() ``` <?php $authorpic = get_the_author_meta('author_pic'); if ($authorpic) echo $authorpic; else echo get_avatar( get_the_author_email(), '80' ); ?> ```
17,918
<p>I have a series of pages for individual products. I'd like to page between them using a navigation that sits outside of the loop.</p> <pre><code> | | ( &lt;= prev ) | &lt;loop&gt; | ( next =&gt; ) | | </code></pre> <p>I've tried <code>posts_nav_lin...
[ { "answer_id": 17928, "author": "OneFishTaco", "author_id": 4194, "author_profile": "https://wordpress.stackexchange.com/users/4194", "pm_score": 0, "selected": false, "text": "<p>Not entirely clear on the question. But If it's navigation OUTSIDE the loop that you want. Then get <a href=...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17918", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5525/" ]
I have a series of pages for individual products. I'd like to page between them using a navigation that sits outside of the loop. ``` | | ( <= prev ) | <loop> | ( next => ) | | ``` I've tried `posts_nav_link`. I've tried `is_paged` conditionals with...
I use `previous_post_link()` and `next_post_link()` (Codex [previous\_post\_link()](http://codex.wordpress.org/Function_Reference/previous_post_link)/[next\_post\_link()](http://codex.wordpress.org/Function_Reference/next_post_link)) outside of the Loop, with no problems. Note that the Codex entries indicate that thes...
17,924
<p>I generally use Nginx to serve static content on my server, with Apache handling PHP content using PHP-FPM. However, I'm not able to get a Wordpress blog homepage to display and I've tried all the configuration examples I can find on the web without much luck.</p> <p>Here is my Nginx config:</p> <pre><code>server ...
[ { "answer_id": 17927, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 2, "selected": false, "text": "<p>Both servers are listening to the same port. You have Nginx set to listen to 80 and nothing is set for Apache unl...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17924", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5572/" ]
I generally use Nginx to serve static content on my server, with Apache handling PHP content using PHP-FPM. However, I'm not able to get a Wordpress blog homepage to display and I've tried all the configuration examples I can find on the web without much luck. Here is my Nginx config: ``` server { listen X...
Both servers are listening to the same port. You have Nginx set to listen to 80 and nothing is set for Apache unless it's in your ports.conf. Your also proxy passing to Apache port 80 in your Nginx conf. In the Nginx conf change `proxy_pass <http://127.0.0.1:80>;` to `proxy_pass <http://127.0.0.1:9000>;` change `...
17,930
<p>What favicon plugin should I use in order to define favicons for Wordpress when I run in multi-site mode.</p> <p>Uploading favicon.ico files is not an option for multi-site wordpress instances.</p> <p>I am looking for something simple that will not pollute the generated pages with hidden advertising.</p> <p><stro...
[ { "answer_id": 17927, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 2, "selected": false, "text": "<p>Both servers are listening to the same port. You have Nginx set to listen to 80 and nothing is set for Apache unl...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17930", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/944/" ]
What favicon plugin should I use in order to define favicons for Wordpress when I run in multi-site mode. Uploading favicon.ico files is not an option for multi-site wordpress instances. I am looking for something simple that will not pollute the generated pages with hidden advertising. **EDIT:** Looking to be able ...
Both servers are listening to the same port. You have Nginx set to listen to 80 and nothing is set for Apache unless it's in your ports.conf. Your also proxy passing to Apache port 80 in your Nginx conf. In the Nginx conf change `proxy_pass <http://127.0.0.1:80>;` to `proxy_pass <http://127.0.0.1:9000>;` change `...
17,935
<p>I basically want to create a table (preferably AJAXified) that lets the user enter a line of information, and be able to add new lines of information, and delete selected ones.</p> <p>I've found <a href="https://wordpress.stackexchange.com/questions/1413/creating-a-table-in-the-admin-style">this post</a> and <a hre...
[ { "answer_id": 17938, "author": "Squiggs.", "author_id": 5578, "author_profile": "https://wordpress.stackexchange.com/users/5578", "pm_score": 4, "selected": true, "text": "<p>I pretty much started in the same place as you a while back, and have created something similar. Here's what I t...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17935", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5581/" ]
I basically want to create a table (preferably AJAXified) that lets the user enter a line of information, and be able to add new lines of information, and delete selected ones. I've found [this post](https://wordpress.stackexchange.com/questions/1413/creating-a-table-in-the-admin-style) and [this post](https://wordpre...
I pretty much started in the same place as you a while back, and have created something similar. Here's what I think you need to know. 1) Work out how to create your basic hello world first and foremost. A simple plugin will consist of a few comments at the top of a PHP file dropped into your plugins directory. Notice...
17,944
<p>Say I want to add this link: <a href="http://localhost/taiwantalk2/user-login/" rel="nofollow">http://localhost/taiwantalk2/user-login/</a> Which is a Page with a template called <strong>page user-login.php</strong>:</p> <pre><code>&lt;?php /** * Template Name: bbPress - User Login * * @package bbPress * @subp...
[ { "answer_id": 17953, "author": "maryisdead", "author_id": 2637, "author_profile": "https://wordpress.stackexchange.com/users/2637", "pm_score": 0, "selected": false, "text": "<p>I don't quite get what you're trying to achieve. Do you want to create a link to a page that is using your lo...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17944", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
Say I want to add this link: <http://localhost/taiwantalk2/user-login/> Which is a Page with a template called **page user-login.php**: ``` <?php /** * Template Name: bbPress - User Login * * @package bbPress * @subpackage Theme */ // No logged in users bbp_logged_in_redirect(); // Begin Template get_header();...
From what I understand, you want a URL to your page, that will work even if you change the page slug? You can do this by linking to the **default permalink** for that particular page, for example <http://localhost/taiwantalk2/?page_id=139>. This URL will always work even if your permalinks are updated. WordPress han...
17,947
<p>I have no problem doing this in a comment, as an administrator:</p> <pre><code>&lt;b&gt;bold test&lt;/b&gt; &lt;i&gt;italics test&lt;/i&gt; &lt;u&gt;underline test&lt;/u&gt; &lt;font color="#ff9900"&gt; color test&lt;/font&gt; </code></pre> <p>But the subscribers can't underline, add color to words nor add images....
[ { "answer_id": 18513, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 3, "selected": true, "text": "<p>The tags that are allowed in comments are stored in <a href=\"http://core.trac.wordpress.org/browser/tags/3.1.3/wp-in...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17947", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I have no problem doing this in a comment, as an administrator: ``` <b>bold test</b> <i>italics test</i> <u>underline test</u> <font color="#ff9900"> color test</font> ``` But the subscribers can't underline, add color to words nor add images. Is it that only the admin can use more HTML tags than those suggested un...
The tags that are allowed in comments are stored in [the `$allowedtags` global variable](http://core.trac.wordpress.org/browser/tags/3.1.3/wp-includes/kses.php#L397). You can try adding elements to that list (the key is the tag name, the value is an array of allowed attributes). If you have problems with the timing you...
17,948
<p>I have a class inside a file that i <code>include_once()</code> from the functions.php of my theme. The class can be used as stand alone plugin, or integrated in a theme. </p> <p>Inside the class i want to fill a class variable (inside the <code>__construct()</code> function) with the native wordpress function <cod...
[ { "answer_id": 17950, "author": "mfields", "author_id": 11019, "author_profile": "https://wordpress.stackexchange.com/users/11019", "pm_score": 4, "selected": true, "text": "<p>get_plugin_data() is only defined in the administration section. What info did you need to get from the plugin'...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17948", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/385/" ]
I have a class inside a file that i `include_once()` from the functions.php of my theme. The class can be used as stand alone plugin, or integrated in a theme. Inside the class i want to fill a class variable (inside the `__construct()` function) with the native wordpress function `get_plugin_data()`. Fun as it is, i...
get\_plugin\_data() is only defined in the administration section. What info did you need to get from the plugin's header that you would need to display in the theme? If the answer is none, I would suggest that you place a conditional call in your constructor. Something like: ``` if ( is_admin() ) { $var = get_plu...
17,952
<p>I'm currently extending my pagination plugin, after a hint by @toscho. So the plugin will now use the same filters, hooks and arguments as the native wordpress pagination functions.</p> <p>My problem is that the different wp functions name their arguments ... different.</p> <h3>Example:</h3> <p><em>This is how yo...
[ { "answer_id": 17964, "author": "supajb", "author_id": 3493, "author_profile": "https://wordpress.stackexchange.com/users/3493", "pm_score": 1, "selected": false, "text": "<p>Since both of them need to exist to get in to the first if statement, couldn't you do something like this?</p>\n\...
2011/05/22
[ "https://wordpress.stackexchange.com/questions/17952", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/385/" ]
I'm currently extending my pagination plugin, after a hint by @toscho. So the plugin will now use the same filters, hooks and arguments as the native wordpress pagination functions. My problem is that the different wp functions name their arguments ... different. ### Example: *This is how you change the text for the...
`wp_link_pages()` and `paginate_links()` work in different contexts: The first on a single paginated page, the latter on an archive. So `is_archive()` should be your criterion to decide which text you use, or better: which filter you use in `apply_filters()`.
17,965
<p>I have been using wordpress for my projects. For my homepage of the site I need to display limited text from the post content and the content contains images as well. To display the 100 text i have used substr function of php. What happens here is that the text as well as image is dispalayed. I want to display only ...
[ { "answer_id": 17966, "author": "Satish Gandham", "author_id": 2193, "author_profile": "https://wordpress.stackexchange.com/users/2193", "pm_score": 2, "selected": false, "text": "<p>use strip_tags + substr</p>\n\n<pre><code>substr( strip_tags( get_the_excerpt() ),0,235);\n</code></pre>...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/17965", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/478/" ]
I have been using wordpress for my projects. For my homepage of the site I need to display limited text from the post content and the content contains images as well. To display the 100 text i have used substr function of php. What happens here is that the text as well as image is dispalayed. I want to display only the...
use strip\_tags + substr ``` substr( strip_tags( get_the_excerpt() ),0,235); ```
17,969
<p>I'm using the WordPress database and back end to administer the news for my band's website and everything is working great however I'd like to disable the front end of WordPress itself.</p> <p>I have the WordPress installation installed in <code>/wordpress/</code> and obviously the admin section is under <code>/wor...
[ { "answer_id": 17970, "author": "supajb", "author_id": 3493, "author_profile": "https://wordpress.stackexchange.com/users/3493", "pm_score": 1, "selected": false, "text": "<p>add this to the .htaccess in your root directory</p>\n\n<pre><code>redirect 301 /wordpress http://www.domain.com\...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/17969", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5059/" ]
I'm using the WordPress database and back end to administer the news for my band's website and everything is working great however I'd like to disable the front end of WordPress itself. I have the WordPress installation installed in `/wordpress/` and obviously the admin section is under `/wordpress/wp-admin/`. What w...
To make sure only the front end redirects to `domain.com`, make a theme that uses the PHP header() function. * Create a folder called redirect or something. * Add two files to the folder: `style.css` and `index.php` (necessary for a valid WP theme) * In `style.css`, add something like this: ```css /* Theme Name:...
17,980
<p>The function <a href="http://codex.wordpress.org/WPMU_Functions/get_current_site" rel="nofollow"><code>get_current_site()</code></a> that's in my themes' footer.php file doesn't return the 'site name' property as specified in the docs (and expected in the theme). The purpose of the function is to return all details ...
[ { "answer_id": 17985, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>Try using <code>get_current_site_name()</code> to insure you get the site name so something like this:</p>\n\n...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/17980", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3669/" ]
The function [`get_current_site()`](http://codex.wordpress.org/WPMU_Functions/get_current_site) that's in my themes' footer.php file doesn't return the 'site name' property as specified in the docs (and expected in the theme). The purpose of the function is to return all details about the parent site on a multi-site se...
Try using `get_current_site_name()` to insure you get the site name so something like this: `echo get_current_site_name(get_current_site());`
17,989
<p>I've given the task of moving several well established blogs from wordpress.com into an independent hosting using Wordpress. Wordpress.com uses a special parser for taking stuff like this:</p> <pre><code>[youtube=http://youtu.be/JN3n34dS] </code></pre> <p>and converting this to a YouTube embed (for example, this h...
[ { "answer_id": 18019, "author": "Matthew Muro", "author_id": 1511, "author_profile": "https://wordpress.stackexchange.com/users/1511", "pm_score": 1, "selected": false, "text": "<p>There's a few ways that I can think of</p>\n\n<ol>\n<li>Find a plugin that is compatible with that shortcod...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/17989", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5593/" ]
I've given the task of moving several well established blogs from wordpress.com into an independent hosting using Wordpress. Wordpress.com uses a special parser for taking stuff like this: ``` [youtube=http://youtu.be/JN3n34dS] ``` and converting this to a YouTube embed (for example, this happens with other links to...
you could use phpMyAdmin to do a search&replace on the wordpress database for the old youtube embed string and then replace with the new one. Should be possible since the syntax is similar enough. **edit:** to add [from this other stackexchange question](https://webmasters.stackexchange.com/questions/8237/embeddables-...
17,994
<p>I'm trying to add a Javascript slide show to my WordPress home page. In my theme folder I have a js folder and then in that I have <code>jquery.cross-slide.min.js</code> and <code>jquery.min.js</code>.</p> <p>This is what I have and what I'm pasting into my post area:</p> <pre><code>&lt;script type="text/javascrip...
[ { "answer_id": 17997, "author": "zina", "author_id": 1619, "author_profile": "https://wordpress.stackexchange.com/users/1619", "pm_score": 0, "selected": false, "text": "<p>@michael - hi,\nyou just forgot to connect this function to an element as you do in jQuery </p>\n\n<pre><code> $('#...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/17994", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5595/" ]
I'm trying to add a Javascript slide show to my WordPress home page. In my theme folder I have a js folder and then in that I have `jquery.cross-slide.min.js` and `jquery.min.js`. This is what I have and what I'm pasting into my post area: ``` <script type="text/javascript" src="js/jquery.min.js"></script> <script ty...
You pasted this in the regular post editor, where you also type your post content? This will not work, the editor filters out invalid HTML, like Javascript. I recommend you install one of the numerous slider gallery plugins and add your images via the existing gallery functionality.
18,013
<p>I have a client who's site will be making heavy use of custom post types to configure their site. But I'm between a rock and a hard place for their requested home page.</p> <p>In reality, the home page will be a stack of specific "pages" within WordPress. Basically, there will be pages for: <strong>Intro</strong>...
[ { "answer_id": 18015, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": false, "text": "<p>Maybe so? Refined version of <a href=\"https://wordpress.stackexchange.com/questions/3927/how-to-add-a-post-from-a-cus...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18013", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/46/" ]
I have a client who's site will be making heavy use of custom post types to configure their site. But I'm between a rock and a hard place for their requested home page. In reality, the home page will be a stack of specific "pages" within WordPress. Basically, there will be pages for: **Intro**, **Blog**, **About Us**,...
Thanks to @toscho for the useful answer, but it felt a bit hackish to me, so I poked around a bit and figured out I could add a filter instead: ``` function wpa18013_add_pages_to_dropdown( $pages, $r ){ if('page_on_front' == $r['name']){ $args = array( 'post_type' => 'stack' ); ...
18,017
<p>I have declared a scheduled event in a plugin like this :</p> <pre><code>function shedule_email_alerts() { if ( !wp_next_scheduled( 'send_email_alerts_hook' ) ) { wp_schedule_event(time(), 'hourly', 'send_email_alerts_hook'); } } </code></pre> <p>Then i wanted to change the frequency to 'daily', by...
[ { "answer_id": 18030, "author": "Marek Tuchalski", "author_id": 4744, "author_profile": "https://wordpress.stackexchange.com/users/4744", "pm_score": 3, "selected": false, "text": "<p>It looks for me that you are adding this event only when there is no such event 'send_email_alerts_hook'...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18017", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1381/" ]
I have declared a scheduled event in a plugin like this : ``` function shedule_email_alerts() { if ( !wp_next_scheduled( 'send_email_alerts_hook' ) ) { wp_schedule_event(time(), 'hourly', 'send_email_alerts_hook'); } } ``` Then i wanted to change the frequency to 'daily', by doing so, replacing the o...
Ok, I could solve the problem by using `wp_clear_scheduled_hook()` I commented out my schedule declaration and added `wp_clear_scheduled_hook('send_email_alerts_hook')` at the end. Then deactivate - reactivate my plugin, which removed my scheduled hook. Then removed `wp_clear_scheduled_hook()` and uncommented my code,...
18,036
<p>I am excluding comments from specific categories. However, when I try to exclude more than one, it doesn't work. </p> <p>This works: <code>&lt;?php if (!in_category('7')) comments_template(); ?&gt;</code></p> <p>This does not work: </p> <pre><code>&lt;?php if (!in_category('7 , 9')) comments_template(); ?&gt; </c...
[ { "answer_id": 18037, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 1, "selected": false, "text": "<p>Put the IDs into an array, like this:</p>\n\n<p><code>&lt;?php if (!in_category(array(7, 9))) comments_template()...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18036", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2883/" ]
I am excluding comments from specific categories. However, when I try to exclude more than one, it doesn't work. This works: `<?php if (!in_category('7')) comments_template(); ?>` This does not work: ``` <?php if (!in_category('7 , 9')) comments_template(); ?> ``` or ``` <?php if (!in_category('7')) comments_te...
I would suggest using category slugs instead of ids. Please try something like this: ``` if ( ! in_category( array( 'bunnies', 'tacos', 'banana-pirates' ) ) ) { comments_template(); } ```
18,044
<p>Is there a way to disable image attachment links trought a filter in functions.php or something ? I know it's possible to do it manually when you add an image to a post but I want to disable this functionality by default.</p> <p><strong>UPDATE</strong></p> <p>What I want to do is set the "Link URL" option to "none...
[ { "answer_id": 18058, "author": "edzillion", "author_id": 4675, "author_profile": "https://wordpress.stackexchange.com/users/4675", "pm_score": 1, "selected": false, "text": "<p>I think you would have to edit the loop-attachment.php in your theme, specifically lines 50-61:</p>\n\n<pre><c...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18044", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3925/" ]
Is there a way to disable image attachment links trought a filter in functions.php or something ? I know it's possible to do it manually when you add an image to a post but I want to disable this functionality by default. **UPDATE** What I want to do is set the "Link URL" option to "none" and remove / hide it from th...
If anybody is interested in do the trick, my solution is this: ``` function remove_media_link( $form_fields, $post ) { unset( $form_fields['url'] ); return $form_fields; } add_filter( 'attachment_fields_to_edit', 'remove_media_link', 10, 2 ); ```
18,045
<p>For single posts and pages, I would like to add certain <code>rel</code> attributes to all the images on the contained therein added with the "Add Image" functionality on the edit screen.</p> <p>The attribute would be <code>rel="lightbox[post id]"</code></p> <p>What function would I filter to accomplish this most ...
[ { "answer_id": 18052, "author": "Dave Konopka", "author_id": 3837, "author_profile": "https://wordpress.stackexchange.com/users/3837", "pm_score": 3, "selected": true, "text": "<p><strong>image_send_to_editor</strong></p>\n\n<pre><code>function insert_img_rel_attrib( $html, $id, $caption...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18045", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4258/" ]
For single posts and pages, I would like to add certain `rel` attributes to all the images on the contained therein added with the "Add Image" functionality on the edit screen. The attribute would be `rel="lightbox[post id]"` What function would I filter to accomplish this most effectively?
**image\_send\_to\_editor** ``` function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url, $size, $alt ) { /* Run your magic on the image $html to insert rel attrib */ return $html; } add_filter( 'image_send_to_editor', 'insert_img_rel_attrib' ); ```
18,047
<p>I figured out how to exclude the current post from displaying in my single-post view sidebar, but now I want to exclude parent categories and display only children. Any ideas how to do this? Much obliged!! </p> <pre><code>&lt;div id="sidebar" class="grid_4"&gt; &lt;div class="item portfolio"&gt;&lt;hr&gt;&lt;...
[ { "answer_id": 18057, "author": "Will Ashworth", "author_id": 5449, "author_profile": "https://wordpress.stackexchange.com/users/5449", "pm_score": 2, "selected": false, "text": "<p>Comments inline:</p>\n\n<pre><code>&lt;?php\n global $wp_query;\n //* first let's get current post ...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18047", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5617/" ]
I figured out how to exclude the current post from displaying in my single-post view sidebar, but now I want to exclude parent categories and display only children. Any ideas how to do this? Much obliged!! ``` <div id="sidebar" class="grid_4"> <div class="item portfolio"><hr></hr> <h4>Similar Items</h4> <?php ...
I spent almost two months building and debugging [Total Widget Control](http://codecongo.com/items/1) to do exactly this for all of a sites widgets. Bear with me as I strip the code out of Total Widget Control and try to make it usable for you. ``` global $wp_query $twc_menu_item_object = $wp_query->object_id;...
18,053
<p>I have a custom taxonomy, and would like to force the user to select at least one term from that taxonomy when creating a post in the WordPress admin back-end. Is this possible?</p>
[ { "answer_id": 18057, "author": "Will Ashworth", "author_id": 5449, "author_profile": "https://wordpress.stackexchange.com/users/5449", "pm_score": 2, "selected": false, "text": "<p>Comments inline:</p>\n\n<pre><code>&lt;?php\n global $wp_query;\n //* first let's get current post ...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18053", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5620/" ]
I have a custom taxonomy, and would like to force the user to select at least one term from that taxonomy when creating a post in the WordPress admin back-end. Is this possible?
I spent almost two months building and debugging [Total Widget Control](http://codecongo.com/items/1) to do exactly this for all of a sites widgets. Bear with me as I strip the code out of Total Widget Control and try to make it usable for you. ``` global $wp_query $twc_menu_item_object = $wp_query->object_id;...
18,056
<p>I uploaded the "uploads" folder to my wordpress install manually from a backup with the exact domain. All of the media properties for height and with are the same and they are all visible on the site. The only problem is that I can't see them in the media tab. Any fix for this?</p>
[ { "answer_id": 18057, "author": "Will Ashworth", "author_id": 5449, "author_profile": "https://wordpress.stackexchange.com/users/5449", "pm_score": 2, "selected": false, "text": "<p>Comments inline:</p>\n\n<pre><code>&lt;?php\n global $wp_query;\n //* first let's get current post ...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18056", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5396/" ]
I uploaded the "uploads" folder to my wordpress install manually from a backup with the exact domain. All of the media properties for height and with are the same and they are all visible on the site. The only problem is that I can't see them in the media tab. Any fix for this?
I spent almost two months building and debugging [Total Widget Control](http://codecongo.com/items/1) to do exactly this for all of a sites widgets. Bear with me as I strip the code out of Total Widget Control and try to make it usable for you. ``` global $wp_query $twc_menu_item_object = $wp_query->object_id;...
18,064
<p>Ok so i have added a custom field into the users edit profile page where they can add a link to a url of an image they want. I am currently using this for contribitors and above but i also have a small little profile box on my site that gets a users avatar from gravatar. I used the code from before but changed it ar...
[ { "answer_id": 18067, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>From the core:</p>\n\n<pre><code>function get_user_meta($user_id, $key, $single = false) {\n return get_metadata('u...
2011/05/23
[ "https://wordpress.stackexchange.com/questions/18064", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4998/" ]
Ok so i have added a custom field into the users edit profile page where they can add a link to a url of an image they want. I am currently using this for contribitors and above but i also have a small little profile box on my site that gets a users avatar from gravatar. I used the code from before but changed it aroun...
Ok so i got it working like i want. Now all i have to do is figure out if i want a user to be able to upload there own image or not. ``` <? $userpiccur = wp_get_current_user(); $userpicloc = 'http://avatars.mydomain.com/'; $userpictyp = '.png'; $userpicurl = $userpicloc.$userpiccur->user_login.$userpictyp; $userpicbe...
18,072
<p>I have a client who uses PDF files for their newsletter, I don't think that this is a good idea personally, but it's not negotiable. They have a news page where they put real time news and they'd like to add a sidebar to this page where there would be links to download these PDF files which would update automaticall...
[ { "answer_id": 18076, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>Queries for something that doesn’t exist are … tricky and probably inefficient. I would suggest another route:</p>\n\n...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18072", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5625/" ]
I have a client who uses PDF files for their newsletter, I don't think that this is a good idea personally, but it's not negotiable. They have a news page where they put real time news and they'd like to add a sidebar to this page where there would be links to download these PDF files which would update automatically w...
You could also use 'post\_parent' => 0. All unattached attachments are assigned 'post\_parent' = 0. [Here](https://github.com/bainternet/Tax-Meta-Class/issues/33) is where I found that. I'm sure that there is a more authoritative resource somewhere, but this worked for me. :)
18,073
<p>I currently have this,</p> <pre><code>&lt;?php $meta = get_post_meta(get_the_ID(), 'rw_agentPhone', true); echo "office:"; echo $meta; // if you want to show ?&gt; </code></pre> <p>Which is fine provided there is a value for rw_agentPhone, but if the profile has no value entered it still displays office:, how can ...
[ { "answer_id": 18075, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 2, "selected": true, "text": "<p>This is <strong>very</strong> basic. Invest some time in a PHP tutorial. It’s fun! :)</p>\n\n<p>Anyway …</p>\n\n<pre><c...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18073", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4090/" ]
I currently have this, ``` <?php $meta = get_post_meta(get_the_ID(), 'rw_agentPhone', true); echo "office:"; echo $meta; // if you want to show ?> ``` Which is fine provided there is a value for rw\_agentPhone, but if the profile has no value entered it still displays office:, how can I rewrite this so that office: ...
This is **very** basic. Invest some time in a PHP tutorial. It’s fun! :) Anyway … ``` <?php $meta = get_post_meta( get_the_ID(), 'rw_agentPhone', TRUE ); // get_post_meta() returns an empty string if it doesn’t find anything. // We just test for this. If the string is not empty, we print it out. '' != $meta and print...
18,079
<p>Here is my function:</p> <pre><code>function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url ) { $postID = ??? $rel = "&lt;a rel='shadowbox[".$postID."]'"; if ($url) {$html = str_replace("&lt;a",$rel,$html);} return $html; } add_filter( 'image_send_to_editor', 'insert_img_rel_attrib', 10,...
[ { "answer_id": 18085, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 0, "selected": false, "text": "<p>Your global should work, what happens when you echo <code>$postID</code> ( you should probably use a more unique na...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18079", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4258/" ]
Here is my function: ``` function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url ) { $postID = ??? $rel = "<a rel='shadowbox[".$postID."]'"; if ($url) {$html = str_replace("<a",$rel,$html);} return $html; } add_filter( 'image_send_to_editor', 'insert_img_rel_attrib', 10, 6 ); ``` How do I...
This should work within your function: ``` get_post_field( 'post_parent', $id ) ```
18,080
<p>Ok = I've looked around a lot for a clear answer to this, but find very few real answers. I would really appreciate some info from experienced individuals.</p> <p>A tiny bit of background. I've worked content generation (among other thing) on a largeish website for many years, and it follows the pretty basic file s...
[ { "answer_id": 18094, "author": "Klian", "author_id": 4984, "author_profile": "https://wordpress.stackexchange.com/users/4984", "pm_score": 0, "selected": false, "text": "<p>I prefer using dynamic WP pages. So I feel more organized and I dont break the structure.</p>\n\n<p>Just my opinio...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18080", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5430/" ]
Ok = I've looked around a lot for a clear answer to this, but find very few real answers. I would really appreciate some info from experienced individuals. A tiny bit of background. I've worked content generation (among other thing) on a largeish website for many years, and it follows the pretty basic file system and ...
Put everything into WordPress. This way, you can **search** your entire content from the built-in search engine, and you can edit each piece. If you need pages with special markup create templates for your theme. Naked Template -------------- ``` <?php /* * Template Name: Naked * * That’s the complete template! ...
18,090
<p>I see that there are hooks for manipulating WP_Query before it gets its posts (parse_query, pre_get_posts), but I can't seem to find any hooks for <strong>after</strong> the WP_Query object is populated. I have a custom table for my plugin-specific post-associated meta data that I would like to fetch from after a WP...
[ { "answer_id": 18093, "author": "Klian", "author_id": 4984, "author_profile": "https://wordpress.stackexchange.com/users/4984", "pm_score": -1, "selected": false, "text": "<p>Try with <strong>publish_post</strong>, <strong>save_post</strong> or <strong>wp_insert_post</strong></p>\n\n<p>r...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18090", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1571/" ]
I see that there are hooks for manipulating WP\_Query before it gets its posts (parse\_query, pre\_get\_posts), but I can't seem to find any hooks for **after** the WP\_Query object is populated. I have a custom table for my plugin-specific post-associated meta data that I would like to fetch from after a WP\_Query obj...
As you haven't stated what you are trying to achieve and have just mentioned you need to fetch associated data. You have two options to query your custom table: 1. You need to do a custom query separately using the post id from the post object while iterating over the posts. 2. Modify the joins of main WordPress query...
18,096
<p>I have featured images switched on in my theme:</p> <pre><code>add_theme_support('post-thumbnails'); set_post_thumbnail_size(256,128, true); add_image_size('icon', 128, 128, true); </code></pre> <p>but the Featured Image box isn't showing up anywhere when I edit a page. What's confusing is that the exact same them...
[ { "answer_id": 18098, "author": "VicePrez", "author_id": 5018, "author_profile": "https://wordpress.stackexchange.com/users/5018", "pm_score": 3, "selected": true, "text": "<p>Have you checked the \"Featured Image\" check-box within the \"Screen Options\" drop down menu beneath \"Howdy, ...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18096", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3828/" ]
I have featured images switched on in my theme: ``` add_theme_support('post-thumbnails'); set_post_thumbnail_size(256,128, true); add_image_size('icon', 128, 128, true); ``` but the Featured Image box isn't showing up anywhere when I edit a page. What's confusing is that the exact same theme, the same set of plugins...
Have you checked the "Featured Image" check-box within the "Screen Options" drop down menu beneath "Howdy, your username"? If that's not the case, we can look into it even further. **Update:** WordPress MU users: Try going into "Network Admin", then click on settings, then enable image upload box, and save.
18,101
<p>Ive created a custom post type and I want to hide the main textarea content in the publish/edit page.</p> <p>Is it possible ?</p> <p>Thanks!</p>
[ { "answer_id": 18102, "author": "Azizur Rahman", "author_id": 3797, "author_profile": "https://wordpress.stackexchange.com/users/3797", "pm_score": 4, "selected": false, "text": "<p>When registering your custom post type don't specify support for editor.</p>\n\n<pre><code> $args = array(...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18101", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4984/" ]
Ive created a custom post type and I want to hide the main textarea content in the publish/edit page. Is it possible ? Thanks!
Yes, remove the editor support from your custom post type. You can do it in two ways. 1. While registering your custom post type: Example: ``` $args = array( 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'capability_type' => 'post', 'has_archive...
18,121
<p>Is there a way to delete a Post From Front-End and it's attachments permanently? This is a snippet that moves the post to the trash can, but it doesn't remove attached images (they remain on the server) and it doesn't remove the post permanently? Could someone please help? </p> <pre><code>&lt;?php $url = get_bl...
[ { "answer_id": 18162, "author": "two7s_clash", "author_id": 4258, "author_profile": "https://wordpress.stackexchange.com/users/4258", "pm_score": 3, "selected": true, "text": "<p>Try:</p>\n\n<pre><code>&lt;?php if (current_user_can('edit_post', $post-&gt;ID)) echo \"&lt;a href='\" . wp_n...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18121", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5499/" ]
Is there a way to delete a Post From Front-End and it's attachments permanently? This is a snippet that moves the post to the trash can, but it doesn't remove attached images (they remain on the server) and it doesn't remove the post permanently? Could someone please help? ``` <?php $url = get_bloginfo('url'); if (c...
Try: ``` <?php if (current_user_can('edit_post', $post->ID)) echo "<a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "'>Delete post</a>" ?> ``` You can decide when to empty the WordPress trash by adding this code to the wp-config.php file in your WordPress root ...
18,122
<p>I'd like to have a custom field interface show up <em>only</em> when a certain template is assigned to a particular WordPress page.</p> <p>Any ideas?</p>
[ { "answer_id": 18133, "author": "Geert", "author_id": 4936, "author_profile": "https://wordpress.stackexchange.com/users/4936", "pm_score": 6, "selected": true, "text": "<p>The best way to approach this situation is via JavaScript. That way, whenever the selected value changes, you can i...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18122", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1766/" ]
I'd like to have a custom field interface show up *only* when a certain template is assigned to a particular WordPress page. Any ideas?
The best way to approach this situation is via JavaScript. That way, whenever the selected value changes, you can instantly hide/show the related metabox. Use [`wp_enqueue_script()`](http://codex.wordpress.org/Function_Reference/wp_enqueue_script) in `functions.php` to load a custom JavaScript file in the admin area: ...
18,132
<p>i'm hoping i'd find some help in regards to inserting ads into wordpress default rss feeds (i do not use feedburner)</p> <pre><code>&lt;?php function insertAds($content) { $content = $content.'&lt;hr /&gt;&lt;a href="http://www.wprecipes.com"&gt;Have you visited WpRecipes today?&lt;/a&gt;&lt;hr /&gt;'; retu...
[ { "answer_id": 18134, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>Those filters aren’t deprecated. They are used in <code>wp-includes/default-filters.php</code> too.</p>\n\n<p>But you ...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18132", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5411/" ]
i'm hoping i'd find some help in regards to inserting ads into wordpress default rss feeds (i do not use feedburner) ``` <?php function insertAds($content) { $content = $content.'<hr /><a href="http://www.wprecipes.com">Have you visited WpRecipes today?</a><hr />'; return $content; } add_filter('the_excerpt_rs...
Take a look at [the\_content\_feed](http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content_feed) as a replacement for the\_content\_rss.
18,154
<p>I'm new to Wordpress and I'm trying to edit the Twenty Ten theme so that my template for basic pages (basic-template.php) does not show the comments box. I do want the comments box to show up on other pages, such as blog posts. I'm pretty sure that changes need to be made in loop.php, but my doesn't seem to be havin...
[ { "answer_id": 18158, "author": "NW Tech", "author_id": 5295, "author_profile": "https://wordpress.stackexchange.com/users/5295", "pm_score": 1, "selected": true, "text": "<p>You can turn off the discussion per post/page when you're creating new posts/pages. this option is usually below ...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18154", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5616/" ]
I'm new to Wordpress and I'm trying to edit the Twenty Ten theme so that my template for basic pages (basic-template.php) does not show the comments box. I do want the comments box to show up on other pages, such as blog posts. I'm pretty sure that changes need to be made in loop.php, but my doesn't seem to be having t...
You can turn off the discussion per post/page when you're creating new posts/pages. this option is usually below the text editor and is often hidden. In order to bring it up, you might have to click on "Screen Options" at the top of the page and check the box next to "Discussion"
18,163
<p>Anyone can recognize the current Wordpress backend, but I don't want that. I want to change it using my own design and I want to have a seamless navigating experience for my users. How can I change the dashboard appearance? I googled a lot of posts and questions, and it seems like you can only change the CSS of most...
[ { "answer_id": 18168, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 0, "selected": false, "text": "<p>what you described above sounds right. Check out the link below</p>\n\n<p><a href=\"http://codex.wordpress...
2011/05/24
[ "https://wordpress.stackexchange.com/questions/18163", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5652/" ]
Anyone can recognize the current Wordpress backend, but I don't want that. I want to change it using my own design and I want to have a seamless navigating experience for my users. How can I change the dashboard appearance? I googled a lot of posts and questions, and it seems like you can only change the CSS of most th...
I use a custom include file that I created to modify the dashboard. Some of the hooks and filters are commented out by default but most of the stuff is here to remove menus, change wp logos, remove meta boxes, remove dashboard widgets, etc... ``` <?php /* File: cleanup-dashboard.php Description: Clean up and customi...
18,176
<p><br> I'm trying to use get_the_term_list to catch the name of the current taxonomy of the page, and then use it with get_terms and a foreach method, to show the result of all the "elements" from the same taxonomy, but i only got an empty result. (for example, this is to have the related articles of the page).</p> <...
[ { "answer_id": 18168, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 0, "selected": false, "text": "<p>what you described above sounds right. Check out the link below</p>\n\n<p><a href=\"http://codex.wordpress...
2011/05/25
[ "https://wordpress.stackexchange.com/questions/18176", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5644/" ]
I'm trying to use get\_the\_term\_list to catch the name of the current taxonomy of the page, and then use it with get\_terms and a foreach method, to show the result of all the "elements" from the same taxonomy, but i only got an empty result. (for example, this is to have the related articles of the page). Do you kn...
I use a custom include file that I created to modify the dashboard. Some of the hooks and filters are commented out by default but most of the stuff is here to remove menus, change wp logos, remove meta boxes, remove dashboard widgets, etc... ``` <?php /* File: cleanup-dashboard.php Description: Clean up and customi...
18,180
<p>I am trying to implement a single sign-on solution between a Wordpress and a non-WP site, under different domains. I am aiming to setup a ghost WP install on the non_WP site domain, to be able to load WP in the background, and facilitate cross-domain cookie sharing and authentication</p> <p>Basically I have setup a...
[ { "answer_id": 18168, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 0, "selected": false, "text": "<p>what you described above sounds right. Check out the link below</p>\n\n<p><a href=\"http://codex.wordpress...
2011/05/25
[ "https://wordpress.stackexchange.com/questions/18180", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5653/" ]
I am trying to implement a single sign-on solution between a Wordpress and a non-WP site, under different domains. I am aiming to setup a ghost WP install on the non\_WP site domain, to be able to load WP in the background, and facilitate cross-domain cookie sharing and authentication Basically I have setup a fresh in...
I use a custom include file that I created to modify the dashboard. Some of the hooks and filters are commented out by default but most of the stuff is here to remove menus, change wp logos, remove meta boxes, remove dashboard widgets, etc... ``` <?php /* File: cleanup-dashboard.php Description: Clean up and customi...
18,199
<p>How do I override the search template i.e. used inside a theme with a custom search page inside a plugin? Please point our any relevant action/filter hooks which can be used to do this.</p> <p>Any help is highly appreciated.</p>
[ { "answer_id": 18202, "author": "MartinJJ", "author_id": 3710, "author_profile": "https://wordpress.stackexchange.com/users/3710", "pm_score": 0, "selected": false, "text": "<p>If i read your question correctly then it has been answered on <a href=\"https://stackoverflow.com/questions/46...
2011/05/25
[ "https://wordpress.stackexchange.com/questions/18199", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5667/" ]
How do I override the search template i.e. used inside a theme with a custom search page inside a plugin? Please point our any relevant action/filter hooks which can be used to do this. Any help is highly appreciated.
You can use `template_include` filter hook ``` add_filter('template_include','my_custom_search_template'); function my_custom_search_template($template){ global $wp_query; if (!$wp_query->is_search) return $template; return dirname( __FILE__ ) . '/my_search_template.php'; } /*UPDATE: there was a...
18,204
<p>I've just installed Wordpress for a travel blog. I want the visitors to be able to comment with their facebook account or sign up as a subscriber to the blog (my mom for example doesn't have facebook).</p> <p>I installed the "Facebook Comments for WordPress" plugin but the problem is that now the visitors can eithe...
[ { "answer_id": 18202, "author": "MartinJJ", "author_id": 3710, "author_profile": "https://wordpress.stackexchange.com/users/3710", "pm_score": 0, "selected": false, "text": "<p>If i read your question correctly then it has been answered on <a href=\"https://stackoverflow.com/questions/46...
2011/03/08
[ "https://wordpress.stackexchange.com/questions/18204", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I've just installed Wordpress for a travel blog. I want the visitors to be able to comment with their facebook account or sign up as a subscriber to the blog (my mom for example doesn't have facebook). I installed the "Facebook Comments for WordPress" plugin but the problem is that now the visitors can either comment ...
You can use `template_include` filter hook ``` add_filter('template_include','my_custom_search_template'); function my_custom_search_template($template){ global $wp_query; if (!$wp_query->is_search) return $template; return dirname( __FILE__ ) . '/my_search_template.php'; } /*UPDATE: there was a...
18,236
<p>I am trying to implement a front end posting system which shows taxonomy data in several dropdown select fields. Each of the dropdowns is named by using the "name" <code>$arg</code> in <a href="https://codex.wordpress.org/Function_Reference/wp_dropdown_categories" rel="noreferrer"><code>wp_dropdown_categories()</cod...
[ { "answer_id": 18237, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 6, "selected": true, "text": "<p>Use <a href=\"http://codex.wordpress.org/Function_Reference/wp_set_object_terms\" rel=\"noreferrer\"><code>wp_...
2011/05/25
[ "https://wordpress.stackexchange.com/questions/18236", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3710/" ]
I am trying to implement a front end posting system which shows taxonomy data in several dropdown select fields. Each of the dropdowns is named by using the "name" `$arg` in [`wp_dropdown_categories()`](https://codex.wordpress.org/Function_Reference/wp_dropdown_categories). ``` wp_dropdown_categories( array( 'taxo...
Use [`wp_set_object_terms`](http://codex.wordpress.org/Function_Reference/wp_set_object_terms) after you have the post id for each taxonomy: ``` ... $post_id = wp_insert_post( $my_post ); wp_set_object_terms( $post_id, $location, 'location' ); wp_set_object_terms( $post_id, $sale_rental, 'sale_rental' ); wp_set_object...
18,288
<p>I have a custom post I am looking to categorize via a custom taxonomy. The taxonomy itself I want to be dependent on the items of another custom post type. Is it possible to populate a taxonomy via the items of a custom post type, or is it something I have to do manually?</p> <p>Plugins, snippets, guidance on alter...
[ { "answer_id": 18297, "author": "MZAweb", "author_id": 5223, "author_profile": "https://wordpress.stackexchange.com/users/5223", "pm_score": 3, "selected": true, "text": "<p>I always use something like:</p>\n\n<pre><code>add_action('save_post', 'mdz_correlate_casos_taxonomy');\nfunction ...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18288", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5664/" ]
I have a custom post I am looking to categorize via a custom taxonomy. The taxonomy itself I want to be dependent on the items of another custom post type. Is it possible to populate a taxonomy via the items of a custom post type, or is it something I have to do manually? Plugins, snippets, guidance on alternat method...
I always use something like: ``` add_action('save_post', 'mdz_correlate_casos_taxonomy'); function mdz_correlate_casos_taxonomy( $post_id ){ if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id; if ( 'YOUR CUSTOM POST TYPE' == $_POST['post_type'] ){ if (!wp_is_post_revision($po...
18,290
<p>This might be kind of simple, but I couldn't find a way to do so in the WP docs. My plugin currently uses custom fields for things I could just have radio buttons/check boxes for each post. How do I add a little section where I can have such options rather than custom fields?</p>
[ { "answer_id": 18295, "author": "Hameedullah Khan", "author_id": 5337, "author_profile": "https://wordpress.stackexchange.com/users/5337", "pm_score": 3, "selected": true, "text": "<p>Below is the example of a couple of checkboxes to set custom field values:</p>\n<pre><code>// register t...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18290", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3269/" ]
This might be kind of simple, but I couldn't find a way to do so in the WP docs. My plugin currently uses custom fields for things I could just have radio buttons/check boxes for each post. How do I add a little section where I can have such options rather than custom fields?
Below is the example of a couple of checkboxes to set custom field values: ``` // register the meta box add_action( 'add_meta_boxes', 'my_custom_field_checkboxes' ); function my_custom_field_checkboxes() { add_meta_box( 'my_meta_box_id', // this is HTML id of the box on edit screen 'My Plu...
18,292
<p>I have a function which is used to display a video, I want this video to be shown after the post, It should display the video when the post ends.</p> <p>I have added filter to it, but then too, the video is shown before the post.</p> <p>Here is the filter which I am using:</p> <pre><code>function append_the_video...
[ { "answer_id": 18294, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>Try containing the content and the video inside different div's:</p>\n\n<pre><code>function append_the_video(...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18292", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1743/" ]
I have a function which is used to display a video, I want this video to be shown after the post, It should display the video when the post ends. I have added filter to it, but then too, the video is shown before the post. Here is the filter which I am using: ``` function append_the_video($content) { glo...
2 options: 1) Edit your youtube\_video() function so it return a string instead of printing the code 2) The easiest way... if you can edit your theme, place the youtube\_video() call after showing your post content Edit: ``` <?php function youtube_video() { $ret = ""; $ret .= "<div class='post'>"; $newvar = urle...
18,301
<p>In Buddypress, after Registration first step, users are redirected to Change Avatar step. Im trying to find a way to redirect to an alternate page, for example: <a href="http://www.mysite.com/yeah" rel="nofollow">http://www.mysite.com/yeah</a> Im using the following code, but Im continuously redirected to Change Ava...
[ { "answer_id": 18302, "author": "José Pablo Orozco Marín", "author_id": 2011, "author_profile": "https://wordpress.stackexchange.com/users/2011", "pm_score": 3, "selected": true, "text": "<p>Yeah I ge it:</p>\n\n<pre><code>function bp_redirect($user) {\n\n $redirect_url = 'http://www....
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18301", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2011/" ]
In Buddypress, after Registration first step, users are redirected to Change Avatar step. Im trying to find a way to redirect to an alternate page, for example: <http://www.mysite.com/yeah> Im using the following code, but Im continuously redirected to Change Avatar page. ``` function custom_filter_bp_signup() { ...
Yeah I ge it: ``` function bp_redirect($user) { $redirect_url = 'http://www.mysite.com/yeah'; bp_core_redirect($redirect_url); } add_action('bp_core_signup_user', 'bp_redirect', 100, 1); ```
18,303
<p>This is the piece of code I use to get event posts whom date metadata is newer than today : </p> <pre><code> &lt;?php query_posts( array( 'post_type' =&gt; 'concerts', 'meta_key' =&gt; 'numericdate', 'posts_per_page' =&gt; -1, 'orderby' =&gt; 'meta_value', 'order' ...
[ { "answer_id": 18398, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p>I believe MySQL date format should be YYYY-MM-DD. Also I think orderby should be meta_value_num, otherwise the valu...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18303", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5702/" ]
This is the piece of code I use to get event posts whom date metadata is newer than today : ``` <?php query_posts( array( 'post_type' => 'concerts', 'meta_key' => 'numericdate', 'posts_per_page' => -1, 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query...
I have exact the same problem here, except i use the std. post type (post) and a category in my query. everything works except the sort order. ``` $d = date("Y-m-d"); $args = array( 'post_type' => 'post', 'category_name' => 'events', 'post_status' => 'publish,draft,pending,future,private'...
18,305
<p>I just installed a WPML, but my custom post types is showing just in default language, if I am switching to other languages, it will show the same posts as default language, but in wordpress panel they are translated. </p> <p>Part of my code in function.php</p> <pre><code>$args = array( 'labels' =&gt; $la...
[ { "answer_id": 18307, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 0, "selected": false, "text": "<p>Did you activate WPML support for your custom post type?</p>\n\n<ul>\n<li>WPML > Translation Options</li>\n</ul>\n\n<p...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18305", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3820/" ]
I just installed a WPML, but my custom post types is showing just in default language, if I am switching to other languages, it will show the same posts as default language, but in wordpress panel they are translated. Part of my code in function.php ``` $args = array( 'labels' => $labels, 'public' =...
Which versions of WPML and WordPress are you using? I'm sure that you noticed that the old versions of WPML from wp.org only run on old WordPress versions (up to 3.0.5).
18,310
<p>I've encountered some issues on a clients site since upgrading to WP 3.1.2, and have this evening updated to version 3.1.3, only to find that the problems still persist.</p> <p><a href="http://www.harmonyreins.com.au" rel="nofollow">http://www.harmonyreins.com.au</a></p> <p>The website is for a local animal shelte...
[ { "answer_id": 18363, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 0, "selected": false, "text": "<p>Your <code>query_posts()</code> should also contain information about the page you are on, for example by passing th...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18310", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5704/" ]
I've encountered some issues on a clients site since upgrading to WP 3.1.2, and have this evening updated to version 3.1.3, only to find that the problems still persist. <http://www.harmonyreins.com.au> The website is for a local animal shelter, and each post represents a different animal that lives at the shelter. T...
are you using `global $query_string;` before the query? so that the full line looks like: ``` <?php global $query_string; query_posts($query_string . '&cat=-10,-12'); ?> ``` alternatively, you could try: ``` <?php query_posts('cat=-10,-12&paged='.get_query_var('paged')); ?> ```
18,314
<p>I'm working on a plugin that will be installed in a multisite instance. </p> <p>How do I create a single settings page that is visible at the "Network admin" level only - most of the guides i've seen relate to a standard blog level plugin. Any links to information would be useful, otherwise I'll just end up going t...
[ { "answer_id": 18792, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 4, "selected": true, "text": "<p>As a reference</p>\n\n<p>To create network or global settings, you need to do the following</p>\n\n<ul>\n<li><p>Add a s...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18314", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/490/" ]
I'm working on a plugin that will be installed in a multisite instance. How do I create a single settings page that is visible at the "Network admin" level only - most of the guides i've seen relate to a standard blog level plugin. Any links to information would be useful, otherwise I'll just end up going through sit...
As a reference To create network or global settings, you need to do the following * Add a settings page ``` add_submenu_page( 'settings.php'... # cf options.php for blog level` ``` * Add a global option ``` add_site_option($key,$value) ``` * Update a global option ``` update_site_option($key,$value) ``` * Get a...
18,318
<p>What is the best way to display/dump <strong>all</strong> custom fields associated with a post? It doesn't have to be pretty, I just need to verify what is being saved in what field array for debugging.</p>
[ { "answer_id": 18322, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 5, "selected": true, "text": "<p>you can use <a href=\"http://codex.wordpress.org/Function_Reference/get_post_custom\">get_post_custom()</a> wh...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18318", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
What is the best way to display/dump **all** custom fields associated with a post? It doesn't have to be pretty, I just need to verify what is being saved in what field array for debugging.
you can use [get\_post\_custom()](http://codex.wordpress.org/Function_Reference/get_post_custom) which returns a multidimensional array with all custom fields of a particular post or page: ``` echo '<pre>'; print_r(get_post_custom($post_id)); echo '</pre>'; ```
18,331
<p>The function below is called from my index.php just below the main content block. Its purpose is to write out a link list of the latest posts. However, I need to reset the post object once this function has completed (or the sidebar query that follows thinks that the current post is the last post that gets executed ...
[ { "answer_id": 18336, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 4, "selected": true, "text": "<p><code>wp_reset_query()</code> will reset the query to the original query WordPress did on this page. So if you somewh...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18331", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
The function below is called from my index.php just below the main content block. Its purpose is to write out a link list of the latest posts. However, I need to reset the post object once this function has completed (or the sidebar query that follows thinks that the current post is the last post that gets executed by ...
`wp_reset_query()` will reset the query to the original query WordPress did on this page. So if you somewhere called `query_posts()`, it will not reset back to that query, but to the "main" query. You probably want to use `wp_reset_postdata()`, which resets the `$post` variable to the current post in `$wp_query`. The...
18,349
<p>If I use the URL "/tag/tag1,tag2/feed", it will retrieve posts that have both tags. Is there anyway to do this and just get posts that have BOTH tag1 and tag2?</p>
[ { "answer_id": 18350, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 0, "selected": false, "text": "<p>Im not to sure if you can or can not do this. I usually just merge the two with Yahoo pipes since i use fe...
2011/05/26
[ "https://wordpress.stackexchange.com/questions/18349", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5267/" ]
If I use the URL "/tag/tag1,tag2/feed", it will retrieve posts that have both tags. Is there anyway to do this and just get posts that have BOTH tag1 and tag2?
You could make a custom rss feed..... Here's a link for that <http://yoast.com/custom-rss-feeds-wordpress/> Simply use that info to make a [page template](http://codex.wordpress.org/Pages#Page_Templates) Make a new page through the WP interface and assign that template The url for that page is your new feed. You ...
18,402
<p>Any ideas on this? I earlier got an error on some update directory, and manually deleted it (unfortunately I didn't write it down). I think I've done auto-upgrades on the same domain before. </p> <pre><code>Downloading update from http://wordpress.org/wordpress-3.1.3.zip… Unpacking the update… Warning: copy(/hom...
[ { "answer_id": 18404, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 1, "selected": false, "text": "<p>It looks like you don't have permission. I would recommend doing a manual upgrade. Its a lot safer and you...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18402", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2550/" ]
Any ideas on this? I earlier got an error on some update directory, and manually deleted it (unfortunately I didn't write it down). I think I've done auto-upgrades on the same domain before. ``` Downloading update from http://wordpress.org/wordpress-3.1.3.zip… Unpacking the update… Warning: copy(/home/nwalters/publ...
sounds like you need to think about a new host... do I dare ask where you're hosted now? But yes that's a permission issue.
18,406
<p>There are several questions in here about sorting custom items in the admin section. However, I cannot find a specific answer anywhere. Here's my specific problem:</p> <p>I'm using MagicFields to create several fields related to Events (each post is an "event" or concert). One of those fields is the event date. ...
[ { "answer_id": 18410, "author": "Hameedullah Khan", "author_id": 5337, "author_profile": "https://wordpress.stackexchange.com/users/5337", "pm_score": 3, "selected": false, "text": "<p>You need to change <code>orderby</code> value to <code>meta_value</code> in <code>event_date_column_ord...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18406", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5727/" ]
There are several questions in here about sorting custom items in the admin section. However, I cannot find a specific answer anywhere. Here's my specific problem: I'm using MagicFields to create several fields related to Events (each post is an "event" or concert). One of those fields is the event date. I want to 1) ...
You need to change `orderby` value to `meta_value` in `event_date_column_orderby`, also I am not sure about the `get('event_date')` you are using, so I have replaced it in the code below to `get_post_meta`. I have just tested the code below and it sorts by dates just fine. ``` // Register a new column in the admin Po...
18,430
<p>I need help in sorting lists of posts inside a static page by a custom field value. I'm currently using the code below but it is not sorting correctly.</p> <pre><code>&lt;?php $postslist = get_posts('numberposts=15&amp;order=DESC&amp;meta_key=sorting&amp;orderby=meta_value_number&amp;tag='. get_post_met...
[ { "answer_id": 18431, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 1, "selected": false, "text": "<p>See the answers to this question: <a href=\"https://wordpress.stackexchange.com/questions/15839/wordpress-how-to-sort-...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18430", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5739/" ]
I need help in sorting lists of posts inside a static page by a custom field value. I'm currently using the code below but it is not sorting correctly. ``` <?php $postslist = get_posts('numberposts=15&order=DESC&meta_key=sorting&orderby=meta_value_number&tag='. get_post_meta($post->ID, 'Tag', true)); ...
See the answers to this question: [How to sort by meta value?](https://wordpress.stackexchange.com/questions/15839/wordpress-how-to-sort-by-meta-value)
18,446
<p><br> it is not the first i see that we "delete" a post meta even if it does not exist : example :</p> <pre><code> $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); </code></pre...
[ { "answer_id": 18442, "author": "edzillion", "author_id": 4675, "author_profile": "https://wordpress.stackexchange.com/users/4675", "pm_score": 2, "selected": false, "text": "<ul>\n<li><a href=\"http://dd32.id.au/wordpress-plugins/add-from-server/\" rel=\"nofollow\">Add From Server</a> -...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18446", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5644/" ]
it is not the first i see that we "delete" a post meta even if it does not exist : example : ``` $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); ``` So if $count is empty, so...
* [Add From Server](http://dd32.id.au/wordpress-plugins/add-from-server/) - allows you to upload files using FTP and then add them to galleries in wordpress * [BackupWordpress](http://wordpress.org/extend/plugins/backupwordpress/) - I have had problems with backing up certain parts of the site, but still use this as it...
18,463
<p>I found an XML to WP decoder script that stores the data as an array in a custom meta field. What is the best way to extract the information?</p> <p>For example how could I display the "Manufactured in" field as "CANADA"?</p> <p><code>[_ttn_i_details] =&gt; Array ( [0] =&gt; a:5:{s:9:"engine_id";a:1:{i:0;s:9:"3000...
[ { "answer_id": 18465, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 7, "selected": true, "text": "<p>Use <a href=\"http://php.net/manual/en/function.unserialize.php\">unserialize()</a> to convert it into an array.</p>...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18463", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
I found an XML to WP decoder script that stores the data as an array in a custom meta field. What is the best way to extract the information? For example how could I display the "Manufactured in" field as "CANADA"? `[_ttn_i_details] => Array ( [0] => a:5:{s:9:"engine_id";a:1:{i:0;s:9:"300000225";}s:15:"transmission_i...
Use [unserialize()](http://php.net/manual/en/function.unserialize.php) to convert it into an array. ``` $mydata = 'a:5:{s:9:"engine_id";a:1:{i:0;s:9:"300000225";}s:15:"transmission_id";a:1:{i:0;s:6:"257691";}s:5:"plant";a:1:{i:0;s:23:"Oshawa, Ontario, Canada";}s:15:"Manufactured in";a:1:{i:0;s:6:"CANADA";}s:22:"Produc...
18,474
<p>im having trouble using "add post meta" and "get post meta" : i have a new meta box in my taxonomy : i always have the value "empty meta" inside the input field, even after i enter anything : like 'banana' , i publish the article, and same thing : inside the field there is one more time "empty meta" ... (is it a pro...
[ { "answer_id": 18489, "author": "Michael", "author_id": 4884, "author_profile": "https://wordpress.stackexchange.com/users/4884", "pm_score": 0, "selected": false, "text": "<p>try and add <code>global $post;</code> direct inside your function.</p>\n\n<p>edit: answer moved from comment t...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18474", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5644/" ]
im having trouble using "add post meta" and "get post meta" : i have a new meta box in my taxonomy : i always have the value "empty meta" inside the input field, even after i enter anything : like 'banana' , i publish the article, and same thing : inside the field there is one more time "empty meta" ... (is it a proble...
here's the complete code : if somebody could try it, i might doing something wrong, but i can't find out what. (the whole code is inside a widget page) ``` /* * * add meta box : habillage * */ add_action( 'add_meta_boxes', 'myplugin_add_custom_box' ); add_action( 'save_post', 'myplugin_save_postdata' ); /* Adds a...
18,490
<p>I'm trying to hide a navigation menu item under certain circumstances. Specifically, if a user is logged in AND has already registered their product bar code, I want to hide the 'Register Kit' link (which has a class of 'ac-regkit').</p> <p>Below is the PHP I've added to the head section of header.php, just before ...
[ { "answer_id": 18479, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 2, "selected": false, "text": "<p>It's definitely from a plugin, unless you gave your WordPress install a prefix of \"atpp_\". Assuming you do not ...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18490", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5750/" ]
I'm trying to hide a navigation menu item under certain circumstances. Specifically, if a user is logged in AND has already registered their product bar code, I want to hide the 'Register Kit' link (which has a class of 'ac-regkit'). Below is the PHP I've added to the head section of header.php, just before wp\_head()...
It's definitely from a plugin, unless you gave your WordPress install a prefix of "atpp\_". Assuming you do not have the plugin active, you can safely remove it.
18,497
<p>I think this is a fairly simple issue but I haven't got my head around it.</p> <p><strong>Question: how do I get my custom posts to show only on the category archives, but not in the blog post listing page?</strong></p> <p>Background: I have a custom post type "video", with has_archive true and 'taxonomies' => arr...
[ { "answer_id": 18499, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 4, "selected": true, "text": "<p>This may be overly simplistic, but have you tried changing <code>is_home()</code> to <code>is_category()</co...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18497", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4642/" ]
I think this is a fairly simple issue but I haven't got my head around it. **Question: how do I get my custom posts to show only on the category archives, but not in the blog post listing page?** Background: I have a custom post type "video", with has\_archive true and 'taxonomies' => array('category', 'post\_tag') -...
This may be overly simplistic, but have you tried changing `is_home()` to `is_category()`, in this line: ``` if ( is_home() && false == $query->query_vars['suppress_filters'] ) ``` i.e. change it to this: ``` if ( is_category() && false == $query->query_vars['suppress_filters'] ) ``` Worth a shot, anyway...
18,524
<p><strong>What I have:</strong> A site of quotes with format: "Quote text." -Quote Author <br> See <a href="http://quotup.com" rel="nofollow">quotup.com</a> for my test website (my apologies in advance for the testing-profanity). <p> <strong>What I'm after:</strong> Clicking "-Quote Author" should launch a page of all...
[ { "answer_id": 18525, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 0, "selected": false, "text": "<p>Q: How do I tell WP to call index.php when I click the example.zom?qaid=2 href?<br>\nA: Well if your talki...
2011/05/27
[ "https://wordpress.stackexchange.com/questions/18524", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5763/" ]
**What I have:** A site of quotes with format: "Quote text." -Quote Author See [quotup.com](http://quotup.com) for my test website (my apologies in advance for the testing-profanity). **What I'm after:** Clicking "-Quote Author" should launch a page of all quotes by that quote author with URL: example.com/SteveSte...
Create a custom taxonomy `quoteauthor`, activate pretty permalinks, and you get nice URIs automatically. These URIs will not put the author’s name right behind the root, but something like `/qa/steve-stevenson/` should be good enough. Here is a sample code as a plugin, you can [download it on GitHub](https://gist.gith...
18,554
<p>some of my posts have the post meta of "project_id". How can I retrive all the posts which have the meta key of "project_id" ? I tried:</p> <pre><code>$meta_key = 'project_id'; return $wpdb-&gt;get_var($wpdb-&gt;prepare("SELECT ID FROM $wpdb-&gt;postmeta WHERE meta_key = %s", $meta_key)); </code></pre> <p>It retur...
[ { "answer_id": 18557, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 3, "selected": true, "text": "<p>As simple as this: <a href=\"http://codex.wordpress.org/Template_Tags/get_posts\" rel=\"nofollow\"><code>$the_posts_...
2011/05/28
[ "https://wordpress.stackexchange.com/questions/18554", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5210/" ]
some of my posts have the post meta of "project\_id". How can I retrive all the posts which have the meta key of "project\_id" ? I tried: ``` $meta_key = 'project_id'; return $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key)); ``` It returns nothing. Please help! Thanks!
As simple as this: [`$the_posts_you_want = get_posts( array( 'meta_key' => 'project_id' ) );`](http://codex.wordpress.org/Template_Tags/get_posts) ``` foreach ( $the_posts_you_want as $post ) { // Do whatever you need in here... // Read further how to inspect the post object: http://wordpress.stackexchange.co...
18,555
<p>So I did something like below, but I get just (I am expecting a Facebook textbox?)</p> <p><img src="https://i.stack.imgur.com/dWtKM.png" alt=""></p> <p>I hope its not too messy. I am new to Settings API ...</p> <pre><code>add_action('admin_init', function() { register_setting('elem_opts', 'elem_opts', 'elem_v...
[ { "answer_id": 18557, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 3, "selected": true, "text": "<p>As simple as this: <a href=\"http://codex.wordpress.org/Template_Tags/get_posts\" rel=\"nofollow\"><code>$the_posts_...
2011/05/28
[ "https://wordpress.stackexchange.com/questions/18555", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/794/" ]
So I did something like below, but I get just (I am expecting a Facebook textbox?) ![](https://i.stack.imgur.com/dWtKM.png) I hope its not too messy. I am new to Settings API ... ``` add_action('admin_init', function() { register_setting('elem_opts', 'elem_opts', 'elem_validate_opts'); add_settings_section('el...
As simple as this: [`$the_posts_you_want = get_posts( array( 'meta_key' => 'project_id' ) );`](http://codex.wordpress.org/Template_Tags/get_posts) ``` foreach ( $the_posts_you_want as $post ) { // Do whatever you need in here... // Read further how to inspect the post object: http://wordpress.stackexchange.co...
18,584
<p>Working on a new site, I'm trying to plant recent post excerpts on a static front-page. I had been doing all my static content outside of wordpress (as static files), but was convinced to pull everything into the WP fold, so to speak. </p> <p>On my external static file that was serving as my home page, I had figure...
[ { "answer_id": 18585, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>Is there any particular reason not to use the <code>front-page.php</code> template file, and just not bothe...
2011/05/28
[ "https://wordpress.stackexchange.com/questions/18584", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5430/" ]
Working on a new site, I'm trying to plant recent post excerpts on a static front-page. I had been doing all my static content outside of wordpress (as static files), but was convinced to pull everything into the WP fold, so to speak. On my external static file that was serving as my home page, I had figured out how ...
Ah - got it - was almost there with the new WP\_Query, but was failing to call the query method on it... This works perfectly: ``` <?php $excerptQuery = new WP_Query(); $excerptQuery->query('showposts=6'); ?> <?ph...
18,603
<p>I am a bit of an amateur when it comes to PHP and WordPress but I have rigged up the following code:</p> <pre><code>function fb_comment_count($url = 'some url here') { $filecontent = file_get_contents('https://graph.facebook.com/?ids=' . $url); $json = json_decode($filecontent); $count = $json-&gt;$url-&gt;comments...
[ { "answer_id": 18606, "author": "VicePrez", "author_id": 5018, "author_profile": "https://wordpress.stackexchange.com/users/5018", "pm_score": 1, "selected": false, "text": "<p>Try this and see what it gives you:</p>\n\n<pre><code>function fb_comment_count() {\nglobal $post;\n$url = get_...
2011/05/29
[ "https://wordpress.stackexchange.com/questions/18603", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4949/" ]
I am a bit of an amateur when it comes to PHP and WordPress but I have rigged up the following code: ``` function fb_comment_count($url = 'some url here') { $filecontent = file_get_contents('https://graph.facebook.com/?ids=' . $url); $json = json_decode($filecontent); $count = $json->$url->comments; if ($count == 0 ||...
Final version of code used: ``` function fb_comment_count($link = 'link') { global $post; $url = 'https://graph.facebook.com/'; $posturl = get_permalink($post->ID); $url .= $posturl; $filecontent = wp_remote_retrieve_body(wp_remote_get($url, array('sslverify'=>false))); $json = json_decode($filecontent); $count =...
18,671
<p>I want to get all the data with the meta key of "project_id" from post meta table. I wrote a query, it should work in thoery, but I have no way to see what I get, and inject this query to my plugin doesn't generate anything. Please take a look at this query, and help me understand if it is correct, what's the format...
[ { "answer_id": 18672, "author": "Digitalchild", "author_id": 3170, "author_profile": "https://wordpress.stackexchange.com/users/3170", "pm_score": 1, "selected": false, "text": "<p>To test if the query is working you could output the $query string that you have created and manually runni...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18671", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5210/" ]
I want to get all the data with the meta key of "project\_id" from post meta table. I wrote a query, it should work in thoery, but I have no way to see what I get, and inject this query to my plugin doesn't generate anything. Please take a look at this query, and help me understand if it is correct, what's the formate ...
First of all, you should look into using WP\_Query for this: <http://scribu.net/wordpress/advanced-metadata-queries.html> Secondly, to see the results, just do a [var\_dump()](http://php.net/var_dump) before the return: ``` echo '<pre>'; var_dump( $data ); ```
18,675
<p><br> i created a post meta, to add the name of a specific "author" to my articles. But if i enter the meta of the first article, all the other articles copy the same meta. If i enter then a second name in the meta of the second article, all the other articles copy this second "meta", as if i entered this second name...
[ { "answer_id": 18727, "author": "Paul_p", "author_id": 5644, "author_profile": "https://wordpress.stackexchange.com/users/5644", "pm_score": 0, "selected": false, "text": "<p>Here is the code of my plugin, to add a post meta. The problems are :</p>\n\n<ul>\n<li><p>after some tests, i fig...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18675", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5644/" ]
i created a post meta, to add the name of a specific "author" to my articles. But if i enter the meta of the first article, all the other articles copy the same meta. If i enter then a second name in the meta of the second article, all the other articles copy this second "meta", as if i entered this second name for eac...
You don't need to check if meta data exists prior to adding/updating it. `update_post_meta` does this for you. (See [Codex](http://codex.wordpress.org/Function_Reference/update_post_meta)) ``` update_post_meta($post_id, $meta_key, $meta_value, $prev_value); ``` The fourth (optional) `$prev_value` argument, if set, w...
18,678
<p><strong>My Old Question:</strong></p> <blockquote> <p><em>I made a Theme with rotating banner, common thing. So I want a way for users to select images. I think instead of implementing my own upload, I think its better to allow users to use the Media Library, how do I do that?</em></p> </blockquote> ...
[ { "answer_id": 18688, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 3, "selected": true, "text": "<p>Here are 3 links to get you started, your question should be more clear, do you want this to work like twentyten's h...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18678", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3788/" ]
**My Old Question:** > > *I made a Theme with rotating banner, > common thing. So I want a way for > users to select images. I think > instead of implementing my own upload, > I think its better to allow users to > use the Media Library, how do I do > that?* > > > The New One ----------- So far, I have som...
Here are 3 links to get you started, your question should be more clear, do you want this to work like twentyten's header, using a custom theme options field, a category? [How to use media upload on theme option page?](https://wordpress.stackexchange.com/questions/8173/how-to-use-media-upload-on-theme-option-page) ...
18,694
<p>I've a working version of wordpress in localhost and i tried to move them to the remote server.</p> <p>As i've another wordpress installed in the same server and tried to rename the current tables to the prefix wp1_</p> <p>I exported my local data to a sql file. After that i searched and renamed every table name w...
[ { "answer_id": 18698, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 0, "selected": false, "text": "<p>Instead of renaming the tables, just create a new database and change your wp-config.php. It's a much easier solution,...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18694", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4452/" ]
I've a working version of wordpress in localhost and i tried to move them to the remote server. As i've another wordpress installed in the same server and tried to rename the current tables to the prefix wp1\_ I exported my local data to a sql file. After that i searched and renamed every table name with wp\_ and cha...
This usually happens when the table prefix is manually changed but some changes have been overlooked. Go to your user\_meta table and have a look at the meta\_key column. Check if fields like wp\_capabilities have been changed to use the wp1\_ prefix. Also look in your wp1\_options table to check that user\_roles has...
18,703
<p>I need to do a <code>WP_Query</code> with a <code>LIKE</code> on the <code>post_title</code>.</p> <p>I started with this regular <code>WP_Query</code>:</p> <pre><code>$wp_query = new WP_Query( array ( 'post_type' =&gt; 'wp_exposants', 'posts_per_page' =&gt; '1', 'post_status' ...
[ { "answer_id": 18715, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 7, "selected": true, "text": "<p>I would solve this with a filter on <code>WP_Query</code>. One that detects an extra query variable and uses that as ...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18703", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5711/" ]
I need to do a `WP_Query` with a `LIKE` on the `post_title`. I started with this regular `WP_Query`: ``` $wp_query = new WP_Query( array ( 'post_type' => 'wp_exposants', 'posts_per_page' => '1', 'post_status' => 'publish', 'orderby' => 'title', 'ord...
I would solve this with a filter on `WP_Query`. One that detects an extra query variable and uses that as the prefix of the title. ``` add_filter( 'posts_where', 'wpse18703_posts_where', 10, 2 ); function wpse18703_posts_where( $where, &$wp_query ) { global $wpdb; if ( $wpse18703_title = $wp_query->get( 'wpse1...
18,720
<p>I'm getting a really strange bug (WP 3.1.3). My goal is to have users create a new post simply by landing on a single post. In order to make that happen, I have the following code in my single.php:</p> <pre><code> &lt;?php //-- Set up post values $myPost = array( 'post_status' =&gt; 'publish', ...
[ { "answer_id": 18735, "author": "dwenaus", "author_id": 4229, "author_profile": "https://wordpress.stackexchange.com/users/4229", "pm_score": 1, "selected": false, "text": "<p>try putting your script in a function and running it during an action hook. perhaps the wp_footer hook. </p>\n" ...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18720", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5808/" ]
I'm getting a really strange bug (WP 3.1.3). My goal is to have users create a new post simply by landing on a single post. In order to make that happen, I have the following code in my single.php: ``` <?php //-- Set up post values $myPost = array( 'post_status' => 'publish', 'post_type' =>...
try putting your script in a function and running it during an action hook. perhaps the wp\_footer hook.
18,725
<p>I have two custom post types that deal with people's names. Right now, in browsing views, it just lists them all alphabetically and the pagination breaks them down by numbers, which isn't terribly helpful when you're trying to find a specific person. </p> <p>Specifically, I've been asked to create pagination links...
[ { "answer_id": 18733, "author": "dwenaus", "author_id": 4229, "author_profile": "https://wordpress.stackexchange.com/users/4229", "pm_score": 0, "selected": false, "text": "<p>This is not so much an answer, but more a pointer to a direction to take. This will probably have to be 100% cus...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18725", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2355/" ]
I have two custom post types that deal with people's names. Right now, in browsing views, it just lists them all alphabetically and the pagination breaks them down by numbers, which isn't terribly helpful when you're trying to find a specific person. Specifically, I've been asked to create pagination links for people...
This will help you getting started. I don't know how you would break the query at specific letter and then tell WP that there's another page with more letters, but the following takes 99% of the rest. Don't forget to post your solution! ``` query_posts( array( 'orderby' => 'title' ) ); // Build an alphabet array fo...
18,736
<p>I have around 140 post in database but wordpress admin page shows just 50 post. How could I let wordpress shows all the posts in database?</p> <p>Thanks</p>
[ { "answer_id": 18740, "author": "Alex Dumitru", "author_id": 5810, "author_profile": "https://wordpress.stackexchange.com/users/5810", "pm_score": 3, "selected": true, "text": "<p>Are you sure those aren't pages, drafts, trashed, revisions or attachments? To make sure that those aren't s...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18736", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5814/" ]
I have around 140 post in database but wordpress admin page shows just 50 post. How could I let wordpress shows all the posts in database? Thanks
Are you sure those aren't pages, drafts, trashed, revisions or attachments? To make sure that those aren't such, run the following in * phpMyAdmin (Query tab - field "SQL query on database [database name]:") * Adminer * In the terminal * … and see how many results you get: ``` select * from wp_posts where post_stat...
18,760
<ul> <li><p>I have just deployed <a href="http://wordpress.org/extend/plugins/w3-total-cache/" rel="nofollow">the W3 Total Cache plugin</a> on my dedicated server (<code>moillusions.com</code>), but am not sure if it works already (server load still high).</p></li> <li><p>I have a very important <a href="http://wordpre...
[ { "answer_id": 18762, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<ol>\n<li><p>What this plugin is supposed to do about server load, if anything?</p></li>\n<li><p>This depends on cachin...
2011/05/30
[ "https://wordpress.stackexchange.com/questions/18760", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5819/" ]
* I have just deployed [the W3 Total Cache plugin](http://wordpress.org/extend/plugins/w3-total-cache/) on my dedicated server (`moillusions.com`), but am not sure if it works already (server load still high). * I have a very important [random link generator](http://wordpress.org/extend/plugins/random-redirect/): `moil...
Use jQuery or Javascript to cycle through and randomly pick one of your links, this way you can bypass the caching? ``` var messages = ["Good!", "Great!", "Awesome!", "Super!", "Nice!"]; function getMessage() { return messages[Math.floor(Math.random() * messages.length)]; } ``` From <https://stackoverflow.com/que...