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 |
|---|---|---|---|---|---|---|
55,170 | <p>I have a blog with all media stored in a folder called <strong>upload</strong> (organize media was disabled), I've activate it to organize new uploads by date. <strong>But how can i organize old files?</strong></p>
<p>I want this because i need to migrate the site to a Wordpress MU site, and i need to have files or... | [
{
"answer_id": 55176,
"author": "Diana",
"author_id": 17048,
"author_profile": "https://wordpress.stackexchange.com/users/17048",
"pm_score": 1,
"selected": false,
"text": "<p>Maybe this plugin can help: <a href=\"http://wordpress.org/extend/plugins/wp-filemanager/\" rel=\"nofollow\">htt... | 2012/06/13 | [
"https://wordpress.stackexchange.com/questions/55170",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15331/"
] | I have a blog with all media stored in a folder called **upload** (organize media was disabled), I've activate it to organize new uploads by date. **But how can i organize old files?**
I want this because i need to migrate the site to a Wordpress MU site, and i need to have files organizated. | Thans but I've found the solution, what it need to do is to edit the site **(Network -> Sites -> Edit -> Settings )** and change the following parameters:
```
Uploads Use Yearmonth Folders 0
Upload Path wp-content/blogs.dir/1/uploads
Fileupload Url http://www.mydomain.com/myblog/... |
55,179 | <p>So in english we don't have gendered nouns. It is always "a table" or "a desk" with no need to worry about it being "une table" or "un tableau" (french). So my question is that when working on the french .mo file, how does one translate a string such as :</p>
<p>You can include a %s in a childtheme</p>
<p>since ... | [
{
"answer_id": 55185,
"author": "brasofilo",
"author_id": 12615,
"author_profile": "https://wordpress.stackexchange.com/users/12615",
"pm_score": 0,
"selected": false,
"text": "<p>Helga, you Viking... I'd say this is one dam of a simple and intriguing question..!</p>\n\n<p>In a simple vi... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55179",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6477/"
] | So in english we don't have gendered nouns. It is always "a table" or "a desk" with no need to worry about it being "une table" or "un tableau" (french). So my question is that when working on the french .mo file, how does one translate a string such as :
You can include a %s in a childtheme
since the "a" depends on ... | This is not a problem if every string gets its own template for translation.
If you use the string `You can include a %s in a childtheme.` more than one time for different nouns it is not translatable.
An example, taken from a [recent article](http://www.deluxeblogtips.com/2012/05/register-custom-post-type.html#comm... |
55,184 | <p>I am trying to move a WordPress site to a new server, but I cannot get it up and running on my local server (running XAMPP).</p>
<p>The site is running perfectly fine, but when I download the files, export the database and then hook everything up on my local copy, I get the following error message:</p>
<pre><code>... | [
{
"answer_id": 55267,
"author": "brasofilo",
"author_id": 12615,
"author_profile": "https://wordpress.stackexchange.com/users/12615",
"pm_score": 0,
"selected": false,
"text": "<p>Try to run this search-replace script as it is able to do proper replaces inside serialized options: <a href... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55184",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17053/"
] | I am trying to move a WordPress site to a new server, but I cannot get it up and running on my local server (running XAMPP).
The site is running perfectly fine, but when I download the files, export the database and then hook everything up on my local copy, I get the following error message:
```
Warning: call_user_fu... | Is the site still working/displaying properly , other than this error on the front end?
It looks to me like your new hosting environment has warning and notice reporting ON.
Consider looking in your `wp-config.php` file for `WP_DEBUG` and make sure it's set to `false`.
Depending on how much control you have on your ... |
55,196 | <p>I would like to reverse the comment pagination numbers so that the newest comments show on page 1 instead of the last page. I did an array_reverse for the comments_array and set the Wordpress Discussion Settings to first page displayed by default - everything works fine except when someone leaves a comment it doesn'... | [
{
"answer_id": 55306,
"author": "AriePutranto",
"author_id": 17138,
"author_profile": "https://wordpress.stackexchange.com/users/17138",
"pm_score": 0,
"selected": false,
"text": "<p>Wouldn't it achievable withing the admin discussion setting page?</p>\n\n<blockquote>\n <p>Break comment... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55196",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17106/"
] | I would like to reverse the comment pagination numbers so that the newest comments show on page 1 instead of the last page. I did an array\_reverse for the comments\_array and set the Wordpress Discussion Settings to first page displayed by default - everything works fine except when someone leaves a comment it doesn't... | i've used
```
wp_list_comments
```
like this:
```
<?php if (class_exists('Walker_Comment_Wink'))
$walker = new Walker_Comment_Wink();
else
$walker = '';
wp_list_comments(array('walker' => $walker, 'type' => 'comment' , 'callback' => 'theme_comment2')); ?>
```
i used the plugin <http://winkpress.com/a... |
55,226 | <p>I've been having difficulties with some new functionality I've been trying to create. Basically I have a custom page setup that displays a list of all posts with a specific tag. What it needs to do is also display each attachment associated with that post, beside the post name. I can get this working on the actual p... | [
{
"answer_id": 55228,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": 1,
"selected": false,
"text": "<p>First of all don't use <code>query_posts</code> function, use the <a href=\"http://codex.wordpress.org/C... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55226",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17119/"
] | I've been having difficulties with some new functionality I've been trying to create. Basically I have a custom page setup that displays a list of all posts with a specific tag. What it needs to do is also display each attachment associated with that post, beside the post name. I can get this working on the actual post... | First of all don't use `query_posts` function, use the [WP\_Query](http://codex.wordpress.org/Class_Reference/WP_Query) class instead.
Secondary you forget to fetch attachments for a post. You can get attachments list by calling [`get_children`](http://codex.wordpress.org/Function_Reference/get_children) function.
``... |
55,230 | <p>I used the following to enqueue jquery plugins:</p>
<pre><code><?php
function my_scripts_method() {
wp_enqueue_script(
'custom functions',
get_template_directory_uri() . '/js/main.js',
array('jquery'),
'1',
true
);
wp_enqueue... | [
{
"answer_id": 55228,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": 1,
"selected": false,
"text": "<p>First of all don't use <code>query_posts</code> function, use the <a href=\"http://codex.wordpress.org/C... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55230",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14982/"
] | I used the following to enqueue jquery plugins:
```
<?php
function my_scripts_method() {
wp_enqueue_script(
'custom functions',
get_template_directory_uri() . '/js/main.js',
array('jquery'),
'1',
true
);
wp_enqueue_script(
... | First of all don't use `query_posts` function, use the [WP\_Query](http://codex.wordpress.org/Class_Reference/WP_Query) class instead.
Secondary you forget to fetch attachments for a post. You can get attachments list by calling [`get_children`](http://codex.wordpress.org/Function_Reference/get_children) function.
``... |
55,235 | <p>I've got the following macro button defined to wrap a selection in a shortcode in the wp_editor visual editor: </p>
<pre><code>(function() {
tinymce.create('tinymce.plugins.ingredient_name', {
init : function(ed, url){
ed.addButton('ingredient_name', {
title : 'Tag ingredient',
onclick... | [
{
"answer_id": 55242,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": 0,
"selected": false,
"text": "<p>The TinyMCE WYSIWYG editor convert space symbols into <code>&nbsp;</code> entities by default. It ca... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55235",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10957/"
] | I've got the following macro button defined to wrap a selection in a shortcode in the wp\_editor visual editor:
```
(function() {
tinymce.create('tinymce.plugins.ingredient_name', {
init : function(ed, url){
ed.addButton('ingredient_name', {
title : 'Tag ingredient',
onclick : function() ... | well, it turned out not to be an issue with tiny mce at all, rather php DOMdocument that was filtering tinyMCE's output, interpreted in the wrong charset, then passing garbage characters to the page.
Fun! |
55,239 | <p>I'm making a mobile site and I'm using the main computers IP adress to connect to it from the iphone <code>10.0.0.1/wp</code></p>
<p>With normal sites it works fine, but the WP site I get is stripped from CSS, JS, and images, only plain text. on the mac and the iphone-simulator it works fine.</p>
<p>Is it somethin... | [
{
"answer_id": 55252,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 2,
"selected": false,
"text": "<p>It may be a conflict between the internal option <code>'home'</code> or <code>'siteurl'</code> and the access per pure... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55239",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14982/"
] | I'm making a mobile site and I'm using the main computers IP adress to connect to it from the iphone `10.0.0.1/wp`
With normal sites it works fine, but the WP site I get is stripped from CSS, JS, and images, only plain text. on the mac and the iphone-simulator it works fine.
Is it something known and configurable? | yes, it because wordpress use the server address from database `get_option('siteurl')` and `get_option('home')`, so if you access the wordpress from IP Address the assets (js and css) will still loaded from `localhost/wp/` that mean from `127.0.0.1` not the `10.0.0.1`
the simple way to get dynamic url for your wordpre... |
55,257 | <p>I have created a custom hierarchical taxomony and when viewing a taxonomy archive page would like to only display the posts that have been assigned to that term. This works fine on the child term pages, but the parent term pages display posts assigned to them AND any child terms.</p>
<p>I found a <a href="http://az... | [
{
"answer_id": 55374,
"author": "Sam",
"author_id": 6800,
"author_profile": "https://wordpress.stackexchange.com/users/6800",
"pm_score": 3,
"selected": false,
"text": "<p>Okay, I've found an answer. Part of the issue was the missing array @goto10 mentioned, and the other part was that t... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55257",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6800/"
] | I have created a custom hierarchical taxomony and when viewing a taxonomy archive page would like to only display the posts that have been assigned to that term. This works fine on the child term pages, but the parent term pages display posts assigned to them AND any child terms.
I found a [solution](http://azuliadesi... | Okay, I've found an answer. Part of the issue was the missing array @goto10 mentioned, and the other part was that tax\_query has required arguments. Here's what I'm using so far:
```
function exclude_children($wp_query) {
if ( isset ( $wp_query->query_vars['custom_taxomony'] ) ) {
$wp_query->set('tax_quer... |
55,259 | <p>How can I go about getting the previous and next posts from <em>outside</em> the loop? Everything I try to do aside from the custom SELECT query (using <code>get_posts</code> or <code>WP_Query</code>) breaks stuff further down the page. </p>
<p>I currently have a recursive function which will hopefully find the fi... | [
{
"answer_id": 55285,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 5,
"selected": true,
"text": "<p>Take a look at <code>get_previous_post()</code> and <code>get_next_post()</code> and you'll see they both use the <cod... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55259",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5846/"
] | How can I go about getting the previous and next posts from *outside* the loop? Everything I try to do aside from the custom SELECT query (using `get_posts` or `WP_Query`) breaks stuff further down the page.
I currently have a recursive function which will hopefully find the first "previous" post which satisfies a ce... | Take a look at `get_previous_post()` and `get_next_post()` and you'll see they both use the `get_adjacent_post()` to find the previous or next post.
Let's say you want to fetch the ID of the immediately previous post based on the current post's ID. This is what you'd do:
```php
function get_previous_post_id( $post_id... |
55,263 | <p>I have an archive page ordered by a numeric value in a custom field. This returns the ordered posts correctly, but does not display posts that don't have a custom field. </p>
<pre><code>$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("paged=$paged&cat=7&posts_per_page=24&m... | [
{
"answer_id": 55268,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 2,
"selected": false,
"text": "<p>You could put the post IDs in an array and then query for all posts excluding those IDs:</p>\n\n<pre><code>$post_i... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55263",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9636/"
] | I have an archive page ordered by a numeric value in a custom field. This returns the ordered posts correctly, but does not display posts that don't have a custom field.
```
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("paged=$paged&cat=7&posts_per_page=24&meta_key=custom_order&orderby... | When you specify a meta\_key, `query_posts()` does an INNER JOIN between the wp\_posts and wp\_postmeta table. That means that any posts that don't have any meta value for the key you specified won't ever be returned in that query.
In order to do what you need, you should use the same query you posted in your questio... |
55,265 | <p>I'm getting <strong>a lot</strong> of spam on my Wordpress blog. I'd like to cut down on the amount of comments I have to moderate. I'm looking for a plugin that does something like this: automatically marks comments as spam, and allows me to say "yes, this is spam". Once I've marked the comment as spam, block the u... | [
{
"answer_id": 55297,
"author": "Joshua Dance",
"author_id": 17091,
"author_profile": "https://wordpress.stackexchange.com/users/17091",
"pm_score": 0,
"selected": false,
"text": "<p>The plugin <a href=\"http://wordpress.org/extend/plugins/wp-ban/\" rel=\"nofollow\">WP-Ban</a> has a vari... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55265",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10735/"
] | I'm getting **a lot** of spam on my Wordpress blog. I'd like to cut down on the amount of comments I have to moderate. I'm looking for a plugin that does something like this: automatically marks comments as spam, and allows me to say "yes, this is spam". Once I've marked the comment as spam, block the user's IP address... | Here's what I ended up doing. Since I received thousands of spam comments a week, I began to mark the spam comments as spam. Then, I installed [WP-Ban](http://lesterchan.net/portfolio/programming/php/#wp-ban), a simple little plugin that allows you to block IP addresses. Then, I used a simple MYSQL code block to show m... |
55,274 | <p>i have installed wordpress and i i have installed couple of plugins and i have got two themes already came with wordpress.</p>
<p>What i am asking about today is : what does the Plugins & Theme string value in database mean ?</p>
<p>Example [When plugins are active] , there is a value on table of :</p>
<pre><... | [
{
"answer_id": 55278,
"author": "jessica",
"author_id": 2659,
"author_profile": "https://wordpress.stackexchange.com/users/2659",
"pm_score": 3,
"selected": true,
"text": "<p>The value is a <a href=\"http://php.net/manual/en/function.serialize.php\" rel=\"nofollow\">serialized php array<... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55274",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17133/"
] | i have installed wordpress and i i have installed couple of plugins and i have got two themes already came with wordpress.
What i am asking about today is : what does the Plugins & Theme string value in database mean ?
Example [When plugins are active] , there is a value on table of :
```
a:3:{i:0;s:19:"akismet/akis... | The value is a [serialized php array](http://php.net/manual/en/function.serialize.php). Further explanation is not really WordPress specific, but here you go -- the 's' is the length of the string representation of the succeeding array element (the length of the string in quotes). I.E. in
`a:2:{s:12:"twentyeleven";s:... |
55,276 | <p>As far as I know the showing and hiding of the admin toolbar on the front-end is a global setting, which applies to any page containing <code>wp_footer()</code>.</p>
<p>I want to have more specific control over the visibility admin bar—specifically, to be able to hide it based on a URL query string, such as (e.g., ... | [
{
"answer_id": 55283,
"author": "jessica",
"author_id": 2659,
"author_profile": "https://wordpress.stackexchange.com/users/2659",
"pm_score": 4,
"selected": true,
"text": "<p>You should be able to just add the filter inside of a conditional:</p>\n\n<pre><code><?php if ($_GET['hidetool... | 2012/06/14 | [
"https://wordpress.stackexchange.com/questions/55276",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3564/"
] | As far as I know the showing and hiding of the admin toolbar on the front-end is a global setting, which applies to any page containing `wp_footer()`.
I want to have more specific control over the visibility admin bar—specifically, to be able to hide it based on a URL query string, such as (e.g., `?hidetoolbar` at the... | You should be able to just add the filter inside of a conditional:
```
<?php if ($_GET['hidetoolbar'])
{
add_filter('show_admin_bar', '__return_false');
}
?>
```
or, since conditionally adding action handlers and filters is sometimes frowned upon, you could add your own function as a filter and then put your co... |
55,301 | <p>This seems like a very simple question. I'm looking for something like sub-page.php or page-child.php where I can do some different things on the child pages of my theme. </p>
<p>They are different enough in design and content that I'm having to use a lot of php or the CSS .page-child class to do all the dirty wo... | [
{
"answer_id": 55305,
"author": "Pippin",
"author_id": 2418,
"author_profile": "https://wordpress.stackexchange.com/users/2418",
"pm_score": 5,
"selected": true,
"text": "<p>There is no specifica template for child pages, but you can do this pretty easily with the <a href=\"http://codex.... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55301",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5861/"
] | This seems like a very simple question. I'm looking for something like sub-page.php or page-child.php where I can do some different things on the child pages of my theme.
They are different enough in design and content that I'm having to use a lot of php or the CSS .page-child class to do all the dirty work. I'm look... | There is no specifica template for child pages, but you can do this pretty easily with the [get\_template\_part()](http://codex.wordpress.org/Function_Reference/get_template_part) function.
First create a file called "content-child.php".
Second create a file called "content.php".
Next, inside of page.php, place this... |
55,313 | <p>I'm trying to force password change upon first user login, which overall is not working, but so far I find a problem update_user_meta() is not updating at all, this is my code:</p>
<pre><code>function track_last_login($login)
{
global $user_ID;
$user = get_userdatabylogin($login);
$Nlogins = (int)get_us... | [
{
"answer_id": 55315,
"author": "Mario Peshev",
"author_id": 11506,
"author_profile": "https://wordpress.stackexchange.com/users/11506",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure how is the flow going on exactly, but I had an issue with a very similar problem where I'm d... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55313",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17141/"
] | I'm trying to force password change upon first user login, which overall is not working, but so far I find a problem update\_user\_meta() is not updating at all, this is my code:
```
function track_last_login($login)
{
global $user_ID;
$user = get_userdatabylogin($login);
$Nlogins = (int)get_user_meta($use... | In response to the extended question, i.e. ***Another question is[...]:***
It is worth noting that Wordpress' plugin API does not persist between requests - that is to say, any functions associated with actions through Wordpress' `add_action()` are only associated for the duration of the script's execution. Each subse... |
55,352 | <p>I was wondering if all wordpress theme have a similar class name for the content.. For example I know the class for post/content in the twenty ten and twenty eleven is </p>
<pre><code>.entry-content
</code></pre>
<p>if not then how would I go about referring contents for all theme using jQuery?</p>
<p>e.g $j('.e... | [
{
"answer_id": 55355,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": true,
"text": "<p>There is no mandatory class name for posts. Many themes use the <a href=\"http://codex.wordpress.org/Function_Reference... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55352",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12918/"
] | I was wondering if all wordpress theme have a similar class name for the content.. For example I know the class for post/content in the twenty ten and twenty eleven is
```
.entry-content
```
if not then how would I go about referring contents for all theme using jQuery?
e.g $j('.entry-content').css('color','red');... | There is no mandatory class name for posts. Many themes use the [`post_class()`](http://codex.wordpress.org/Function_Reference/post_class) if that is needed but you cannot rely on it.
To change the output of [`the_content()`](http://codex.wordpress.org/Function_Reference/the_content) add a [filter to `'the_content'`]... |
55,354 | <p>Here are the args for my query :</p>
<pre><code>$args = array(
'post_type' => 'news',
'meta_query' => array(
array(
'key' => 'topics',
'value' => 'sports',
)
)
);
</code></pre>
<p>This works when <code>topics</code> is a string, but <strong>not</stron... | [
{
"answer_id": 55359,
"author": "Johannes Pille",
"author_id": 9745,
"author_profile": "https://wordpress.stackexchange.com/users/9745",
"pm_score": 7,
"selected": true,
"text": "<h2>Feeding the query an array of possible values</h2>\n<p>If the value in the database is a string and you w... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55354",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1381/"
] | Here are the args for my query :
```
$args = array(
'post_type' => 'news',
'meta_query' => array(
array(
'key' => 'topics',
'value' => 'sports',
)
)
);
```
This works when `topics` is a string, but **not** when it is an array. I'd like this query to work when `topi... | Feeding the query an array of possible values
---------------------------------------------
If the value in the database is a string and you want to feed the query several values:
```
$args = array(
'post_type' => 'news',
'meta_query' => array(
array(
'key' => 'topics',
'value'... |
55,363 | <p>I've found other posts related to this, but none had a answer to my issue.</p>
<p>After updating to WP 3.4 my visual editor is broken.</p>
<p>Firebug reports this error</p>
<pre><code>Failed to load: http://xxxxxx.com/wp-includes/js/tinymce/langs/pt.js
</code></pre>
<p>wp-tin...9-20805 (linha 1)</p>
<p>I've tri... | [
{
"answer_id": 55385,
"author": "user1337",
"author_id": 16338,
"author_profile": "https://wordpress.stackexchange.com/users/16338",
"pm_score": 1,
"selected": false,
"text": "<p>There shouldn't be a <code>pt.js</code> file in that directory. There wasn't in 3.3.2 nor in 3.4. There's sev... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55363",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4445/"
] | I've found other posts related to this, but none had a answer to my issue.
After updating to WP 3.4 my visual editor is broken.
Firebug reports this error
```
Failed to load: http://xxxxxx.com/wp-includes/js/tinymce/langs/pt.js
```
wp-tin...9-20805 (linha 1)
I've tried setting the theme to a default theme and it ... | There shouldn't be a `pt.js` file in that directory. There wasn't in 3.3.2 nor in 3.4. There's several possible issues that could be taking place, but my guess is that your WordPress install has been compromised and your theme files are corrupted. They are then trying to access that js file which is no longer there and... |
55,373 | <p>I have been customising the <code>admin bar</code> in version 3.3 to only have certain custom links with the following added to <code>functions.php</code>:</p>
<pre><code>function mytheme_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('site-name');
$wp_admin_bar->remove_menu('new-conte... | [
{
"answer_id": 55407,
"author": "fdsa",
"author_id": 8288,
"author_profile": "https://wordpress.stackexchange.com/users/8288",
"pm_score": -1,
"selected": true,
"text": "<p>EDIT: This is obviously not a good idea if you want to be able to update - see comments below</p>\n\n<p><a href=\"h... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55373",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16467/"
] | I have been customising the `admin bar` in version 3.3 to only have certain custom links with the following added to `functions.php`:
```
function mytheme_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('site-name');
$wp_admin_bar->remove_menu('new-content');
$wp_admin_bar->remove_menu('updates'... | EDIT: This is obviously not a good idea if you want to be able to update - see comments below
[As this site explains](http://rpmediaservices.com/change-howdy-in-wordpress/), you need to replace `<?php printf(__(‘Howdy, %2$s!’), ‘profile.php’, $user_identity) ?>` in the wordpress admin with in your case the word 'logou... |
55,375 | <p>I want to order my posts by tags with only one WP_Query()</p>
<p>In my WP_Query I would like to display
2 posts with tags <code>portrait</code></p>
<p>2 posts with tags <code>paysage</code></p>
<p>2 posts with tags <code>portrait</code></p>
<p>2 posts with tags <code>paysage</code></p>
<p>2 posts with tags <cod... | [
{
"answer_id": 55379,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": 0,
"selected": false,
"text": "<p>It's impossible to do with one query, even from database point of view (without unions). </p>\n\n<p>I wo... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55375",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2000/"
] | I want to order my posts by tags with only one WP\_Query()
In my WP\_Query I would like to display
2 posts with tags `portrait`
2 posts with tags `paysage`
2 posts with tags `portrait`
2 posts with tags `paysage`
2 posts with tags `portrait`
2 posts with tags `paysage`
Etc...
And I need to order these posts by ... | Like Eugene mentioned in his answer you need to run a query for each tag. I would create a foreach loop that went through each tag then queried the latest 2 posts from each.
```
$tags = get_tags();
foreach ( $tags as $tag ) {
echo '<h3>' .$tag->name. '</h3>';
$tag_query = new WP_Query( array(
... |
55,377 | <p>How would I retrieve attachments from all <strong>subpages</strong> of a specific Page ID? </p>
<p>Example:</p>
<p>SPECIFIC PAGE</p>
<ul>
<li>Child (with attachments) </li>
<li>Child (with attachments) </li>
<li>Child (with attachments) </li>
</ul>
<p>I'm currently using this code to retrieve all attachments... | [
{
"answer_id": 55379,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": 0,
"selected": false,
"text": "<p>It's impossible to do with one query, even from database point of view (without unions). </p>\n\n<p>I wo... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55377",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2811/"
] | How would I retrieve attachments from all **subpages** of a specific Page ID?
Example:
SPECIFIC PAGE
* Child (with attachments)
* Child (with attachments)
* Child (with attachments)
I'm currently using this code to retrieve all attachments site-wide, however I would like to limit this to only pull images from all ... | Like Eugene mentioned in his answer you need to run a query for each tag. I would create a foreach loop that went through each tag then queried the latest 2 posts from each.
```
$tags = get_tags();
foreach ( $tags as $tag ) {
echo '<h3>' .$tag->name. '</h3>';
$tag_query = new WP_Query( array(
... |
55,391 | <p>Currently I am making a custom design for a site. The problem I'm seeing in Wordpress is about almost all data pulled out from the database.</p>
<p>While in certain pages - like front-page.php - it only needs, for example, title, category, two metas and the excerpt, WP gets everything. Hell, the post content is onl... | [
{
"answer_id": 55398,
"author": "DarkGhostHunter",
"author_id": 16135,
"author_profile": "https://wordpress.stackexchange.com/users/16135",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"https://wordpress.stackexchange.com/questions/15346/how-to-exclude-content-and-other-returne... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55391",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16135/"
] | Currently I am making a custom design for a site. The problem I'm seeing in Wordpress is about almost all data pulled out from the database.
While in certain pages - like front-page.php - it only needs, for example, title, category, two metas and the excerpt, WP gets everything. Hell, the post content is only visible ... | You can filter `'posts_fields'`, check if it [is the main query](http://codex.wordpress.org/Function_Reference/is_main_query) and limit the queried fields to … whatever you need.
See `WP_Query::get_posts()` in `/wp-includes/query.php` for details and side effects.
For debugging the queries I recommend the plugin [D... |
55,400 | <p>im sure i must be doing something wrong and would really appreciate a little help.</p>
<p>I am trying to loop through all of my Sub Dir "Multisite" blogs using switch_to_blog, below:</p>
<pre><code>global $wpdb, $blog_id, $post;
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM wp_blogs ORDER B... | [
{
"answer_id": 55403,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 2,
"selected": false,
"text": "<p>No, it's retrieving the posts just fine, but you're not storing them anywhere. Here's your code again, with line-by-... | 2012/06/15 | [
"https://wordpress.stackexchange.com/questions/55400",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15694/"
] | im sure i must be doing something wrong and would really appreciate a little help.
I am trying to loop through all of my Sub Dir "Multisite" blogs using switch\_to\_blog, below:
```
global $wpdb, $blog_id, $post;
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM wp_blogs ORDER BY blog_id" ) );
forea... | No, it's retrieving the posts just fine, but you're not storing them anywhere. Here's your code again, with line-by-line documentation:
```
// Set up global variables. Great
global $wpdb, $blog_id, $post;
// Get a list of blogs in your multisite network
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" )... |
55,418 | <p>I have spent hours today on a maddening issue I was having with displaying a custom post type. Everything displayed beautifully, except the pagination simply would not work properly. </p>
<p>I have a page-template setup to display a "page of posts" (see <a href="http://codex.wordpress.org/Pages" rel="nofollow">Co... | [
{
"answer_id": 55419,
"author": "timshutes",
"author_id": 5861,
"author_profile": "https://wordpress.stackexchange.com/users/5861",
"pm_score": 4,
"selected": true,
"text": "<p>I figured this problem out literally seconds before I posted the question, so I thought I would go ahead and po... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55418",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5861/"
] | I have spent hours today on a maddening issue I was having with displaying a custom post type. Everything displayed beautifully, except the pagination simply would not work properly.
I have a page-template setup to display a "page of posts" (see [Codex: Page of Posts](http://codex.wordpress.org/Pages)) for a custom p... | I figured this problem out literally seconds before I posted the question, so I thought I would go ahead and post the answer here. I've noticed there is not a lot of consolidated help for this problem out there.
This will help you if your "Older Posts" or "Newer Posts" links give you a 404 error when trying to display... |
55,453 | <p>I have come across quite an odd problem when using the <code>update_option</code> function, and I am sure that I've tried everything I can think of to get it working, but unfortunately it isn't.</p>
<p>I'm using AJAX to submit a form (using the popular method <a href="http://www.garyc40.com/2010/03/5-tips-for-using... | [
{
"answer_id": 55461,
"author": "Evan Mattson",
"author_id": 12055,
"author_profile": "https://wordpress.stackexchange.com/users/12055",
"pm_score": 2,
"selected": false,
"text": "<p>It sounds like your array isn't being serialized before updating the option for whatever reason. Perhaps ... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55453",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2415/"
] | I have come across quite an odd problem when using the `update_option` function, and I am sure that I've tried everything I can think of to get it working, but unfortunately it isn't.
I'm using AJAX to submit a form (using the popular method [described here](http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-word... | Turns out, my question didn't even have to do with AJAX, it had to do with the function used to validate the settings that was supplied with `register_setting`.
The problem with it was that it wasn't going deep enough into the array to even save the values. I needed to modify it to look like so:
```
public functi... |
55,456 | <p>I have a problem with set_post_thumbnail_size() function, which seems it doesn't work. Or at least it doesn't work correctly.</p>
<p>I have set a thumbnail size 75x75px in WordPress settings under the media section and have also set another thumbnail size in the functions.php using:</p>
<pre><code>set_post_thumb... | [
{
"answer_id": 55457,
"author": "Fraggy",
"author_id": 15517,
"author_profile": "https://wordpress.stackexchange.com/users/15517",
"pm_score": 3,
"selected": true,
"text": "<p>They work independently of eachother. You need to call the one you created in the functions.php.</p>\n\n<p>So in... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55456",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15859/"
] | I have a problem with set\_post\_thumbnail\_size() function, which seems it doesn't work. Or at least it doesn't work correctly.
I have set a thumbnail size 75x75px in WordPress settings under the media section and have also set another thumbnail size in the functions.php using:
```
set_post_thumbnail_size(80, 80, tr... | They work independently of eachother. You need to call the one you created in the functions.php.
So in your functions.php you would have something like:
```
if (function_exists('add_theme_support')) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 75, 75, true ); // default thumbnail size
add_image_... |
55,462 | <p>My head hurts...</p>
<p>Here is what I have:</p>
<p>Custom post type: Our People, slug => <strong>our-people</strong><br />Taxonomy: Job Title, slug => <strong>job-title</strong></p>
<p>I have an archive page for the Our People CPT at <strong>domain.com/our-people</strong>.</p>
<p>I can easily have archive pages... | [
{
"answer_id": 55466,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": -1,
"selected": false,
"text": "<p>WordPress doesn't understand your URL, because there is no rewrite rule for it. You have to add custom ... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55462",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15190/"
] | My head hurts...
Here is what I have:
Custom post type: Our People, slug => **our-people**
Taxonomy: Job Title, slug => **job-title**
I have an archive page for the Our People CPT at **domain.com/our-people**.
I can easily have archive pages for the Job Title taxonomy terms at **domain.com/job-title/{term}**
But... | You have two avenues:
* Hardcode rewrite rules for those specific URLs
* Abandon your quest and design a new URL structure
What your asking for cannot be automated efficiently because it would mean 2 rewrite rules that are the same, but are mapped on to different things. The result being that either the post type slu... |
55,472 | <p>Here is my issue: I have one parent category with many sub-categories below it, e.g.</p>
<pre><code>Category
Sub category
sub-sub category......
sub-sub category......
sub-sub category......
sub-sub category......
sub-sub category......
........
</code></pre>
<p>I... | [
{
"answer_id": 55466,
"author": "Eugene Manuilov",
"author_id": 8170,
"author_profile": "https://wordpress.stackexchange.com/users/8170",
"pm_score": -1,
"selected": false,
"text": "<p>WordPress doesn't understand your URL, because there is no rewrite rule for it. You have to add custom ... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55472",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16755/"
] | Here is my issue: I have one parent category with many sub-categories below it, e.g.
```
Category
Sub category
sub-sub category......
sub-sub category......
sub-sub category......
sub-sub category......
sub-sub category......
........
```
I used the [WP dTree](http:... | You have two avenues:
* Hardcode rewrite rules for those specific URLs
* Abandon your quest and design a new URL structure
What your asking for cannot be automated efficiently because it would mean 2 rewrite rules that are the same, but are mapped on to different things. The result being that either the post type slu... |
55,476 | <p>When you keep the category base ( that is you don't remove it by a plug in) WordPress does allow you to browse to your 2 level deep category in two different ways as the example below would demonstrate it.</p>
<p>say, your category has a top level item "MULTIMEDIA" and a child under it called VIDEO.</p>
<p>Visuall... | [
{
"answer_id": 55482,
"author": "Damien",
"author_id": 17132,
"author_profile": "https://wordpress.stackexchange.com/users/17132",
"pm_score": 0,
"selected": false,
"text": "<p>There are 3 possible options here ...</p>\n\n<ol>\n<li>If you haven't already ... go install <a href=\"http://y... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55476",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14967/"
] | When you keep the category base ( that is you don't remove it by a plug in) WordPress does allow you to browse to your 2 level deep category in two different ways as the example below would demonstrate it.
say, your category has a top level item "MULTIMEDIA" and a child under it called VIDEO.
Visually, we are talking... | You could filter `'term_link'`.
*just an untested idea, written directly into the answer field*
```
add_filter( 'term_link', 'wpse_55476_categore_ur_filter', 10, 3 );
function wpse_55476_categore_ur_filter( $termlink, $term, $taxonomy )
{
if ( 'category' !== $taxonomy )
{
return $termlink;
}
... |
55,478 | <p>I'm trying to setup a default fallback featured image on my website to ensure consistency with images being displayed for every post, even when an image is not embedded in the post. I've tried a number of plugins - Default Post Thumb and Default Thumb, however neither of these seemed to work. I'm using WP 3.4 and th... | [
{
"answer_id": 55481,
"author": "Damien",
"author_id": 17132,
"author_profile": "https://wordpress.stackexchange.com/users/17132",
"pm_score": 0,
"selected": false,
"text": "<p>while you say you'd like to use a plugin ... there is a very easy method to do what you want</p>\n\n<p>basicall... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55478",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17197/"
] | I'm trying to setup a default fallback featured image on my website to ensure consistency with images being displayed for every post, even when an image is not embedded in the post. I've tried a number of plugins - Default Post Thumb and Default Thumb, however neither of these seemed to work. I'm using WP 3.4 and the S... | One simple method is to filter `post_thumbnail_html`, to add in a default image link:
```
<?php
function wpse55748_filter_post_thumbnail_html( $html ) {
// If there is no post thumbnail,
// Return a default image
if ( '' == $html ) {
return '<img src="' . get_template_directory_uri() . '/images/def... |
55,479 | <p>I have the following pairs:</p>
<pre><code>add_rewrite_rule('^questions/ask/?','index.php?pagename=ask','top');
if(is_page('ask')){
$tname = 'add-question.php';
if(file_exists(TEMPLATEPATH.'/'.$tname)){
$returntemplate = TEMPLATEPATH.'/'.$tname;
}else{
$returntemplate... | [
{
"answer_id": 55480,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": false,
"text": "<p>From what I recall, if a page is a child of another page, the pagename value is the full parent / child path. In yo... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55479",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17188/"
] | I have the following pairs:
```
add_rewrite_rule('^questions/ask/?','index.php?pagename=ask','top');
if(is_page('ask')){
$tname = 'add-question.php';
if(file_exists(TEMPLATEPATH.'/'.$tname)){
$returntemplate = TEMPLATEPATH.'/'.$tname;
}else{
$returntemplate = $plugindir.... | From what I recall, if a page is a child of another page, the pagename value is the full parent / child path. In your examples it would be `pagename=questions/ask` and `pagename=questions/ed`, though you say the first rule works, which is puzzling.
also, side note - there's a [`locate_template`](http://codex.wordpress... |
55,484 | <p>I recently moved a wordpress install from my local instance to a dev server. For the move, I installed a clean version of wordpress 3.4, moved exact duplicates of the file structre, and used the import / export feature to bring the posts in.</p>
<p>I then went in and set the necessary widgets, and settings. I've ... | [
{
"answer_id": 55486,
"author": "Tyler Carter",
"author_id": 16921,
"author_profile": "https://wordpress.stackexchange.com/users/16921",
"pm_score": 3,
"selected": false,
"text": "<p>This usually happens when you are trying to do admin navigation stuff and you aren't hooked into <code>ad... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55484",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5861/"
] | I recently moved a wordpress install from my local instance to a dev server. For the move, I installed a clean version of wordpress 3.4, moved exact duplicates of the file structre, and used the import / export feature to bring the posts in.
I then went in and set the necessary widgets, and settings. I've done this 10... | This usually happens when you are trying to do admin navigation stuff and you aren't hooked into `admin_menu`. If you hook in before that, `$menu` hasn't been created yet.
```
add_action('admin_menu', 'my_plugin_add_menu');
function my_plugin_add_menu(){
$ptype = 'my_post_type';
$ptype_obj = get_post_type_obj... |
55,485 | <pre><code>if ( function_exists('register_sidebar') )
register_sidebar(array(
"name" => "Top Widget Area",
"id" => "topWidgetArea-$i",
));
</code></pre>
<p>I just create a new sidebar with this.<br />
I'm displaying this sidebar in my <code>header.php</code> like this:</p>
<pre><code><... | [
{
"answer_id": 55488,
"author": "Eray",
"author_id": 3552,
"author_profile": "https://wordpress.stackexchange.com/users/3552",
"pm_score": 3,
"selected": true,
"text": "<p>Changing widget's ID from <code>topWidgetArea</code> to <code>top-widget-area</code> solved my problem. Widget ID mu... | 2012/06/16 | [
"https://wordpress.stackexchange.com/questions/55485",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3552/"
] | ```
if ( function_exists('register_sidebar') )
register_sidebar(array(
"name" => "Top Widget Area",
"id" => "topWidgetArea-$i",
));
```
I just create a new sidebar with this.
I'm displaying this sidebar in my `header.php` like this:
```
<?php dynamic_sidebar( "Top Widget Area" ); ?>
```
... | Changing widget's ID from `topWidgetArea` to `top-widget-area` solved my problem. Widget ID must have hypen. I tried a lots of variations for ID (like `testtesttest`, `asdasdasd`, `widgetareaaa`) . I'm not sure, why . |
55,519 | <p>I am running a multisite network and i have setup a sql query that uses swith_to_blog(); and queries the posts.</p>
<p>Is there a way that i can declare the query inside a new WP_Query and actually merge that query with another?</p>
<p>Basically if i do this:</p>
<pre><code>$number1 = new WP_Query($multisitequery... | [
{
"answer_id": 55559,
"author": "Chip Bennett",
"author_id": 3966,
"author_profile": "https://wordpress.stackexchange.com/users/3966",
"pm_score": 2,
"selected": false,
"text": "<p>So, if you have this:</p>\n\n<pre><code>$number1 = new WP_Query($multisitequery);\n\n$number2 = new WP_Quer... | 2012/06/17 | [
"https://wordpress.stackexchange.com/questions/55519",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15694/"
] | I am running a multisite network and i have setup a sql query that uses swith\_to\_blog(); and queries the posts.
Is there a way that i can declare the query inside a new WP\_Query and actually merge that query with another?
Basically if i do this:
```
$number1 = new WP_Query($multisitequery);
```
Can i merge it w... | You won't do much good just merging the arguments, you need to merge the resulting posts array and the post\_count count. This works for me:
```
//setup your queries as you already do
$query1 = new WP_Query($args_for_query1);
$query2 = new WP_Query($args_for_query2);
//create new empty query and populate it with the ... |
55,521 | <p>I've been struggling with a warning message above the comments field on a site I'm building for a friend and I'd be very grateful if you're able to help. I've asked on the Wordpress Codex, but unfortunately there's been no response.</p>
<p>Warning: call_user_func_array() [function.call-user-func-array]: First argum... | [
{
"answer_id": 55559,
"author": "Chip Bennett",
"author_id": 3966,
"author_profile": "https://wordpress.stackexchange.com/users/3966",
"pm_score": 2,
"selected": false,
"text": "<p>So, if you have this:</p>\n\n<pre><code>$number1 = new WP_Query($multisitequery);\n\n$number2 = new WP_Quer... | 2012/06/17 | [
"https://wordpress.stackexchange.com/questions/55521",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17211/"
] | I've been struggling with a warning message above the comments field on a site I'm building for a friend and I'd be very grateful if you're able to help. I've asked on the Wordpress Codex, but unfortunately there's been no response.
Warning: call\_user\_func\_array() [function.call-user-func-array]: First argument is ... | You won't do much good just merging the arguments, you need to merge the resulting posts array and the post\_count count. This works for me:
```
//setup your queries as you already do
$query1 = new WP_Query($args_for_query1);
$query2 = new WP_Query($args_for_query2);
//create new empty query and populate it with the ... |
55,550 | <p>I am using this code to shorting the title:</p>
<pre><code>function short_title( $after = '', $length ) {
$mytitle = get_the_title();
if( strlen( $mytitle ) > $length ) {
$mytitle = substr( $mytitle, 0, $length );
echo $mytitle . $after;
} else echo $mytitle;
}
</code></pre>
<p>and i... | [
{
"answer_id": 55551,
"author": "HungryCoder",
"author_id": 17129,
"author_profile": "https://wordpress.stackexchange.com/users/17129",
"pm_score": -1,
"selected": false,
"text": "<p>as the word is broken at the end, this problem is very likely. you can use the following snippet instead ... | 2012/06/17 | [
"https://wordpress.stackexchange.com/questions/55550",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16936/"
] | I am using this code to shorting the title:
```
function short_title( $after = '', $length ) {
$mytitle = get_the_title();
if( strlen( $mytitle ) > $length ) {
$mytitle = substr( $mytitle, 0, $length );
echo $mytitle . $after;
} else echo $mytitle;
}
```
and i call it with:
```
<?php sho... | Use `mb_strlen()`, [not `strlen()`](http://wpengineer.com/2410/dont-use-strlen/).
The same with `mb_substr()` and `substr()`: Your title contains multi-byte characters, but `strlen()` and `substr()` do not work on characters, they work on single bytes.
For a improved function to shorten strings see [this answer](ht... |
55,581 | <p>I <strong>never</strong> use the WP menu (the logo and its child items) except when I click it accidentally. And it is wasting my time when I navigate per keyboard. Plus, the support page is <em>not our site</em>.</p>
<p>How can I remove it?</p>
| [
{
"answer_id": 55582,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 4,
"selected": true,
"text": "<p>This menu is added in <code>WP_Admin_Bar::add_menus()</code> with an action:</p>\n<pre><code>add_action( 'admin_bar_men... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55581",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/73/"
] | I **never** use the WP menu (the logo and its child items) except when I click it accidentally. And it is wasting my time when I navigate per keyboard. Plus, the support page is *not our site*.
How can I remove it? | This menu is added in `WP_Admin_Bar::add_menus()` with an action:
```
add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
```
To remove it take the same action – just one step later. The following code works as a [mu plugin](http://codex.wordpress.org/Must_Use_Plugins) or as a regular plugin:
```
<?php # -*... |
55,609 | <p>The default WordPress search setup isn't really working for my website's setup.</p>
<p>I have two custom post types (<code>species</code>, <code>glossary</code>) which I'd like to search for, as well as the standard <code>post</code> type.</p>
<p>The <code>species</code> post type (which I'll refer to herein as <c... | [
{
"answer_id": 57024,
"author": "Laurence Tuck",
"author_id": 1426,
"author_profile": "https://wordpress.stackexchange.com/users/1426",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not entirely sure you will find a plugin to do exactly what you need. I've tried many 'out of the box'... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55609",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6344/"
] | The default WordPress search setup isn't really working for my website's setup.
I have two custom post types (`species`, `glossary`) which I'd like to search for, as well as the standard `post` type.
The `species` post type (which I'll refer to herein as `species profiles`) is made up of a number of `meta` fields, in... | Yes, Relevanssi will do the trick for you, but you need some additional code. Relevanssi has a filter hook relevanssi\_hits\_filter, which lets you modify the list of results.
So, you need to create a function that will take the hits and if there's a species profile that matches the search query, the function will add... |
55,625 | <p>I have a .php page in the theme root to check the data of one CUSTOM form.
After receiving this data I need to do a query in a custom mysql table, so I need $wpdb, but I can't use it directly (or doing <code>global $wpdb</code>) because it is a phisical .php file, so the rewrite rule will not affect the request (the... | [
{
"answer_id": 55628,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 1,
"selected": false,
"text": "<pre><code>require_once( 'path/to/wordpress/wp-includes/wp-db.php' );\nif ( file_exists( 'path/to/wordpress/wp-conte... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55625",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17224/"
] | I have a .php page in the theme root to check the data of one CUSTOM form.
After receiving this data I need to do a query in a custom mysql table, so I need $wpdb, but I can't use it directly (or doing `global $wpdb`) because it is a phisical .php file, so the rewrite rule will not affect the request (the request is no... | First of all you probably created an isolated file that is not under the umbrella of WP files. That's why you are not getting $wpdb. I guess you may not following the general rules/conventions of theme development. my question is now how are you accessing the file?
whatever, if you include the wp\_config.php in your ... |
55,633 | <p>I have search a lot but cannot find any solution for my problem.</p>
<p>I when i entered the search term to the search box of my website, it goes to <code>mysite.com/search/search+term</code>. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into th... | [
{
"answer_id": 55628,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 1,
"selected": false,
"text": "<pre><code>require_once( 'path/to/wordpress/wp-includes/wp-db.php' );\nif ( file_exists( 'path/to/wordpress/wp-conte... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17226/"
] | I have search a lot but cannot find any solution for my problem.
I when i entered the search term to the search box of my website, it goes to `mysite.com/search/search+term`. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header of the resul... | First of all you probably created an isolated file that is not under the umbrella of WP files. That's why you are not getting $wpdb. I guess you may not following the general rules/conventions of theme development. my question is now how are you accessing the file?
whatever, if you include the wp\_config.php in your ... |
55,634 | <p>I'm trying to place a small code in my template <code>header.php</code> file. I want to get a custom field value.</p>
<p>I'm trying to call custom fields from current page <strong>outside</strong> of loop, btw.</p>
<p>I have no problem doing this when I need to get custom field values from posts, but I can't seem ... | [
{
"answer_id": 55639,
"author": "Dagan Henderson",
"author_id": 17239,
"author_profile": "https://wordpress.stackexchange.com/users/17239",
"pm_score": 0,
"selected": false,
"text": "<p>You'll have to either start the loop, then rewind it:</p>\n\n<pre><code>$wp_query->the_post(); // N... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55634",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17237/"
] | I'm trying to place a small code in my template `header.php` file. I want to get a custom field value.
I'm trying to call custom fields from current page **outside** of loop, btw.
I have no problem doing this when I need to get custom field values from posts, but I can't seem to do this for pages.
Here is my code:
... | try using
```
get_metadata('post', $postid, 'teaser-text, true);
```
these two actually same. should not make any difference. earlier i gave wrong arguments. var\_dump() will show you what it is actually getting. please make sure, the ID is correct, 'teaser-text' exists. You can also try using some other meta name (... |
55,642 | <p>I am using the Starker Theme as a foundation to build my custom WordPress theme. The Starker Theme comes with a loop.php file for setting up the main loop. I decided to use the loop.php file to display content on the homepage of my site. I would like to incorporate this loop as well as the pagination on other pages ... | [
{
"answer_id": 55639,
"author": "Dagan Henderson",
"author_id": 17239,
"author_profile": "https://wordpress.stackexchange.com/users/17239",
"pm_score": 0,
"selected": false,
"text": "<p>You'll have to either start the loop, then rewind it:</p>\n\n<pre><code>$wp_query->the_post(); // N... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55642",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17193/"
] | I am using the Starker Theme as a foundation to build my custom WordPress theme. The Starker Theme comes with a loop.php file for setting up the main loop. I decided to use the loop.php file to display content on the homepage of my site. I would like to incorporate this loop as well as the pagination on other pages of ... | try using
```
get_metadata('post', $postid, 'teaser-text, true);
```
these two actually same. should not make any difference. earlier i gave wrong arguments. var\_dump() will show you what it is actually getting. please make sure, the ID is correct, 'teaser-text' exists. You can also try using some other meta name (... |
55,655 | <p>My blog is www.theprinterdepo.com/blog.</p>
<p>The blog title its in the beginning and at the end, which looks bad for seo efforts, I have a pluggin called ALL In one SEO. Which puts the title of the blog at the end, which is fine.</p>
<p>But I cant find how to remove it from the start of the meta title.</p>
<p>t... | [
{
"answer_id": 55802,
"author": "brasofilo",
"author_id": 12615,
"author_profile": "https://wordpress.stackexchange.com/users/12615",
"pm_score": 2,
"selected": false,
"text": "<p>I normally use WP SEO by Yoast, but here's a troubleshoot:</p>\n\n<ul>\n<li>what if you use only <code>wp_ti... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55655",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17241/"
] | My blog is www.theprinterdepo.com/blog.
The blog title its in the beginning and at the end, which looks bad for seo efforts, I have a pluggin called ALL In one SEO. Which puts the title of the blog at the end, which is fine.
But I cant find how to remove it from the start of the meta title.
thank you
I suppose this... | I normally use WP SEO by Yoast, but here's a troubleshoot:
* what if you use only `wp_title('');` *(this is a WPSEO requirement)*
* what do you have as Home Title at the plugin's settings page?

* search your theme's `functions.php` for a similar hook... |
55,663 | <p>I am trying to create my own first plugin but I am coding novice so please guide me to the right direction. </p>
<p>This plugin is to set the post expiry date based on the user's role. Now I am stuck at the saving data phase. </p>
<p>Since I don't want to create a new database table for the inputs. I using the ... | [
{
"answer_id": 55671,
"author": "MathSmath",
"author_id": 1537,
"author_profile": "https://wordpress.stackexchange.com/users/1537",
"pm_score": 3,
"selected": true,
"text": "<p>This is the way I like to handle collection of form inputs. Detailed explanation is in the comments.</p>\n\n<pr... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55663",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14728/"
] | I am trying to create my own first plugin but I am coding novice so please guide me to the right direction.
This plugin is to set the post expiry date based on the user's role. Now I am stuck at the saving data phase.
Since I don't want to create a new database table for the inputs. I using the settings api to do t... | This is the way I like to handle collection of form inputs. Detailed explanation is in the comments.
```
if( isset( $_POST ) ) {
// Create an empty array. This is the one we'll eventually store.
$arr_store_me = array();
// Create a "whitelist" of posted values (field names) you'd like in your array.
... |
55,672 | <p>I'm giving <a href="http://wordpress.org/extend/plugins/custom-query-fields/" rel="nofollow">Custom Query Fields</a> a shot for filtering/sorting posts on the front-end of a site. The instructions seem pretty self-explanatory, but I do have another layer that I'm trying to figure out.</p>
<p>For one of my custom fi... | [
{
"answer_id": 56471,
"author": "Stephen Harris",
"author_id": 9364,
"author_profile": "https://wordpress.stackexchange.com/users/9364",
"pm_score": 1,
"selected": false,
"text": "<p>I've had a brief look at the plug-in, it offers no hooks to do this, but you could use <code>posts_clause... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55672",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9605/"
] | I'm giving [Custom Query Fields](http://wordpress.org/extend/plugins/custom-query-fields/) a shot for filtering/sorting posts on the front-end of a site. The instructions seem pretty self-explanatory, but I do have another layer that I'm trying to figure out.
For one of my custom fields, it is currently storing a frac... | What I ended up doing was storing the data I needed in the `post_meta` table on-save:
```
add_action( 'save_post', 'mouldings_hidden_postmeta' );
function mouldings_hidden_postmeta() {
global $post;
if (is_admin() && (get_post_type() == 'moulding_profiles' || get_post_type() == 'moulding_combination')) {
... |
55,674 | <p>I want to write a select query to return data on only posts which have are associated with the taxonomy term <code>food-and-beverage</code></p>
<pre><code>SELECT wp_postmeta . * , wp_posts.post_name
FROM wp_posts, wp_postmeta, wp_terms, wp_term_relationships
WHERE wp_posts.post_type = 'projects'
AND wp_posts.post_... | [
{
"answer_id": 55678,
"author": "HungryCoder",
"author_id": 17129,
"author_profile": "https://wordpress.stackexchange.com/users/17129",
"pm_score": 2,
"selected": false,
"text": "<p>You don't need to write these SQL queries. you can utilize WP_Query api. </p>\n\n<p>the following will dis... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55674",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5846/"
] | I want to write a select query to return data on only posts which have are associated with the taxonomy term `food-and-beverage`
```
SELECT wp_postmeta . * , wp_posts.post_name
FROM wp_posts, wp_postmeta, wp_terms, wp_term_relationships
WHERE wp_posts.post_type = 'projects'
AND wp_posts.post_status = 'publish'
AND w... | (I realize you're leaning away from this, but maybe if you can get it working, it's worthwhile. With the recent perfomance improvements in 3.4 for WP\_Query, this could be worthwhile.)
`WP_Query` is the right decision if this is a secondary loop. Otherwise, you might look into [`pre_get_posts`](http://codex.wordpress.... |
55,694 | <p>I'm putting together a site that will be comprised, mostly, of static pages with some dynamic content as well as a blog page.</p>
<p>In terms of naming files, what would be the best way to achieve this? My first thought was to simply use <code>about.php</code>, <code>services.php</code>, etc., but I'm sure that doe... | [
{
"answer_id": 55678,
"author": "HungryCoder",
"author_id": 17129,
"author_profile": "https://wordpress.stackexchange.com/users/17129",
"pm_score": 2,
"selected": false,
"text": "<p>You don't need to write these SQL queries. you can utilize WP_Query api. </p>\n\n<p>the following will dis... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55694",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14606/"
] | I'm putting together a site that will be comprised, mostly, of static pages with some dynamic content as well as a blog page.
In terms of naming files, what would be the best way to achieve this? My first thought was to simply use `about.php`, `services.php`, etc., but I'm sure that doesn't work well with WP's system. | (I realize you're leaning away from this, but maybe if you can get it working, it's worthwhile. With the recent perfomance improvements in 3.4 for WP\_Query, this could be worthwhile.)
`WP_Query` is the right decision if this is a secondary loop. Otherwise, you might look into [`pre_get_posts`](http://codex.wordpress.... |
55,703 | <p>I found examples adding a class to top level itens, so we can display an arrow in menu itens with subitens, but is seems terrible to cope with the already builtin WordPress classes, can't display the arrow with current and css hover, it just ruins all states.</p>
<p>Is there someway to add a <code><span class="a... | [
{
"answer_id": 55727,
"author": "Stephen Harris",
"author_id": 9364,
"author_profile": "https://wordpress.stackexchange.com/users/9364",
"pm_score": 3,
"selected": true,
"text": "<p>You can use the <code>walker_nav_menu_start_el</code> filter:</p>\n\n<pre><code>add_filter( 'walker_nav_me... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55703",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17048/"
] | I found examples adding a class to top level itens, so we can display an arrow in menu itens with subitens, but is seems terrible to cope with the already builtin WordPress classes, can't display the arrow with current and css hover, it just ruins all states.
Is there someway to add a `<span class="arrow"></span>` wit... | You can use the `walker_nav_menu_start_el` filter:
```
add_filter( 'walker_nav_menu_start_el', 'wpse_add_arrow',10,4);
function wpse_add_arrow( $item_output, $item, $depth, $args ){
//Only add class to 'top level' items on the 'primary' menu.
if('primary' == $args->theme_location && $depth ==0){
$item_... |
55,707 | <p>dose anyone know how to get this query (or a different query) to preserve the page formatting?
Thanks</p>
<pre><code><?php
$my_postid = 663;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = s... | [
{
"answer_id": 55932,
"author": "HungryCoder",
"author_id": 17129,
"author_profile": "https://wordpress.stackexchange.com/users/17129",
"pm_score": 0,
"selected": false,
"text": "<p>I believe your question is not very clear. You did not give enough effort to explain the problem resulting... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55707",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13698/"
] | dose anyone know how to get this query (or a different query) to preserve the page formatting?
Thanks
```
<?php
$my_postid = 663;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']... | You're comparing apples to oranges here. Both **queries** do the exact same thing, but are presented through different code.
Your query:
```
<?php
$my_postid = 663;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $conten... |
55,716 | <p>I am displaying a list of employees using my custom plugin. My permalink structure is <code>%category%%postname%/</code></p>
<p>My page navigation was like <code>http://www.example.com/emp/?page=2</code>, and was working fine until now. But now it rewrites url like <code>http://www.example.com/emp/2/</code>.</p>
... | [
{
"answer_id": 55717,
"author": "HungryCoder",
"author_id": 17129,
"author_profile": "https://wordpress.stackexchange.com/users/17129",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not clear which URL format you want! As you've set pretty URLs permalink, it will be something like <c... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55716",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12022/"
] | I am displaying a list of employees using my custom plugin. My permalink structure is `%category%%postname%/`
My page navigation was like `http://www.example.com/emp/?page=2`, and was working fine until now. But now it rewrites url like `http://www.example.com/emp/2/`.
I have read [Using Permalinks](http://codex.word... | I guess permalink structure should be
```
/%category%/%postname%/
``` |
55,723 | <p>I am using this code to show the custom menu subpages if you are on the parent page. But what this code also shows is a parent page on a page that has no sub menu, which I would like hidden. Basically only use this code if we are on a page that has a sub page,</p>
<pre><code>class Selective_Walker extends Walker_Na... | [
{
"answer_id": 55717,
"author": "HungryCoder",
"author_id": 17129,
"author_profile": "https://wordpress.stackexchange.com/users/17129",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not clear which URL format you want! As you've set pretty URLs permalink, it will be something like <c... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55723",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17028/"
] | I am using this code to show the custom menu subpages if you are on the parent page. But what this code also shows is a parent page on a page that has no sub menu, which I would like hidden. Basically only use this code if we are on a page that has a sub page,
```
class Selective_Walker extends Walker_Nav_Menu
{
f... | I guess permalink structure should be
```
/%category%/%postname%/
``` |
55,725 | <p>I have a value that I'm trying to store as user meta for authors on my site. I need it to update itself every time the content of a post is viewed for that author. Here's as far as I've gotten but it isn't storing the value. I use this in functions.php.</p>
<pre><code>function user_score() {
global $bp;
$au... | [
{
"answer_id": 55717,
"author": "HungryCoder",
"author_id": 17129,
"author_profile": "https://wordpress.stackexchange.com/users/17129",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not clear which URL format you want! As you've set pretty URLs permalink, it will be something like <c... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55725",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12700/"
] | I have a value that I'm trying to store as user meta for authors on my site. I need it to update itself every time the content of a post is viewed for that author. Here's as far as I've gotten but it isn't storing the value. I use this in functions.php.
```
function user_score() {
global $bp;
$author_id = $bp-... | I guess permalink structure should be
```
/%category%/%postname%/
``` |
55,739 | <p>I need to pull out the post publish date in order to make the post post auto expire. The thing is I can't get the right publish date.</p>
<p>Here is my code:</p>
<pre><code> global $wpdb;
$post_ids = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_status ='publish'" );
foreach($post_ids as $id)... | [
{
"answer_id": 55741,
"author": "Gembel Intelek",
"author_id": 17191,
"author_profile": "https://wordpress.stackexchange.com/users/17191",
"pm_score": -1,
"selected": false,
"text": "<p>try like this</p>\n\n<pre><code>$getPosts = $wpdb->get_results( \n\"\n SELECT ID, post_date,post... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55739",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14728/"
] | I need to pull out the post publish date in order to make the post post auto expire. The thing is I can't get the right publish date.
Here is my code:
```
global $wpdb;
$post_ids = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_status ='publish'" );
foreach($post_ids as $id){
$postdate = get_th... | `get_the_date` must be used inside the Loop. For outside the loop use [`get_the_time`](http://codex.wordpress.org/Template_Tags/get_the_time).
```
$posts = get_posts(array('numberposts'=>-1)); //Get all published posts
foreach ($posts as $post){
echo get_the_time('Y-m-d', $post->ID); //Echos date in Y-m-d format.
... |
55,754 | <p>I want to link the selectbox to my CSS.</p>
<p>Like if I click an item on the list, the background of my header will change - the header's color is in the CSS.</p>
<p>The selectbox isn't in the html but it's in the <code>options.php</code> in the theme file and partly in the <code>functions.php</code> file.</p>
<... | [
{
"answer_id": 55757,
"author": "Gembel Intelek",
"author_id": 17191,
"author_profile": "https://wordpress.stackexchange.com/users/17191",
"pm_score": 1,
"selected": false,
"text": "<h1>Not Recommended</h1>\n\n<pre><code> <?php if(theme_get_option('theme_style_options') == 'style1'):... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55754",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17270/"
] | I want to link the selectbox to my CSS.
Like if I click an item on the list, the background of my header will change - the header's color is in the CSS.
The selectbox isn't in the html but it's in the `options.php` in the theme file and partly in the `functions.php` file.
So the point here is that if I click on the ... | Not Recommended
===============
```
<?php if(theme_get_option('theme_style_options') == 'style1'): ?>
<link rel="stylesheet" type="text/css" media="all" href="<?php echo get_template_directory_uri(); ?>/style1.css" />
<?php elseif(theme_get_option('theme_style_options') == 'style2'): ?>
<link rel="styles... |
55,759 | <p>I am trying custom rewrite for following url...</p>
<pre><code>http://www.domain.com/lp/1
</code></pre>
<p>and it would be parsed using </p>
<pre><code>lp.php?p=1
</code></pre>
<p>I have tried following...</p>
<pre><code>add_action( 'init', 'aagt_rewrite_add_rewrites' );
function aagt_rewrite_add_rewrites()
{
... | [
{
"answer_id": 55760,
"author": "Gembel Intelek",
"author_id": 17191,
"author_profile": "https://wordpress.stackexchange.com/users/17191",
"pm_score": 0,
"selected": false,
"text": "<p>go to wp-admin/options-permalink.php</p>\n\n<p>nothing to do but \"Save Changes\"</p>\n"
},
{
"... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55759",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17024/"
] | I am trying custom rewrite for following url...
```
http://www.domain.com/lp/1
```
and it would be parsed using
```
lp.php?p=1
```
I have tried following...
```
add_action( 'init', 'aagt_rewrite_add_rewrites' );
function aagt_rewrite_add_rewrites()
{
add_rewrite_rule(
'^lp/(\d+)/?$', // p followed b... | WordPress has two kinds of rewrite rules- internal and external. Internal rules are parsed by WordPress and routed to `index.php`. External rewrites get written to .htaccess and are not directed to WordPress.
Right now your rule is a mix between internal and external- you have it structured as an internal rule, but yo... |
55,770 | <p>If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the <a href="http://codex.wordpress.org/Template_Hierarchy" rel="nofollow">template hierarchy</a>.</p>
<p>If I'm doing some logic checking in the hook <code>init</code> and say my conditions are met, how do I te... | [
{
"answer_id": 55771,
"author": "Stephen Harris",
"author_id": 9364,
"author_profile": "https://wordpress.stackexchange.com/users/9364",
"pm_score": 3,
"selected": true,
"text": "<p>Can you perform the logic on the <code>template_include</code> filter? Else, you could set a global/consta... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55770",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4610/"
] | If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the [template hierarchy](http://codex.wordpress.org/Template_Hierarchy).
If I'm doing some logic checking in the hook `init` and say my conditions are met, how do I tell WordPress to load a template file of my choo... | Can you perform the logic on the `template_include` filter? Else, you could set a global/constant and use that in `template_include` to serve up the appropriate template.
The template\_include filter filers the path to the template file to be included. To avoid errors you should check if the template exists - locate\_... |
55,782 | <p>I am using the <a href="http://wordpress.org/extend/plugins/mailchimp/" rel="nofollow noreferrer">Mailchimp plugin</a>, and it has a shortcode that uses output buffering to grab its widget's code and spit it out in the content.</p>
<p>However, the widget code has plenty of white space, so the_content filters are th... | [
{
"answer_id": 55783,
"author": "MaximOrlovsky",
"author_id": 15294,
"author_profile": "https://wordpress.stackexchange.com/users/15294",
"pm_score": 4,
"selected": true,
"text": "<p>You do not need a plugin to do this. Just add 3 lines of code to the end of the <code>functions.php</code... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55782",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6477/"
] | I am using the [Mailchimp plugin](http://wordpress.org/extend/plugins/mailchimp/), and it has a shortcode that uses output buffering to grab its widget's code and spit it out in the content.
However, the widget code has plenty of white space, so the\_content filters are throwing useless linebreaks (like after hidden i... | You do not need a plugin to do this. Just add 3 lines of code to the end of the `functions.php` file in your active theme:
```
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99 );
add_filter( 'the_content', 'shortcode_unautop', 100 );
``` |
55,784 | <p>So I'm trying to enqueue scripts used for some post formats like video and audio and I could find a way to check what post formats are going to be shown on the page.</p>
<p>I tried print_r on some global variables but they doesn't seems to have post_format in the post details, I tried $posts and $wp_query and also ... | [
{
"answer_id": 55787,
"author": "Zach Lysobey",
"author_id": 5846,
"author_profile": "https://wordpress.stackexchange.com/users/5846",
"pm_score": 0,
"selected": false,
"text": "<p>If you can find the post id within functions.php, you should be able to use </p>\n\n<p><code>if (</code><a ... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55784",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14490/"
] | So I'm trying to enqueue scripts used for some post formats like video and audio and I could find a way to check what post formats are going to be shown on the page.
I tried print\_r on some global variables but they doesn't seems to have post\_format in the post details, I tried $posts and $wp\_query and also tried p... | Inside the Loop, try something like the following:
```
<?php
if ( get_post_format() && in_array( get_post_format(), array( 'audio', 'video' ) ) ) {
// The current post has either the
// audio or video post format;
// enqueue a script
wp_enqueue_script( $handle, $src );
}
?>
```
Now that WordPress can... |
55,801 | <p>I have multiple author accounts on one of my WordPress installs. Often I will create a post, and set the author to be a different account. However, when I upload images into that post, their attachment page lists the author as my account. How can I set the author for posts, and have it carry over to the media ass... | [
{
"answer_id": 55787,
"author": "Zach Lysobey",
"author_id": 5846,
"author_profile": "https://wordpress.stackexchange.com/users/5846",
"pm_score": 0,
"selected": false,
"text": "<p>If you can find the post id within functions.php, you should be able to use </p>\n\n<p><code>if (</code><a ... | 2012/06/19 | [
"https://wordpress.stackexchange.com/questions/55801",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9636/"
] | I have multiple author accounts on one of my WordPress installs. Often I will create a post, and set the author to be a different account. However, when I upload images into that post, their attachment page lists the author as my account. How can I set the author for posts, and have it carry over to the media associate... | Inside the Loop, try something like the following:
```
<?php
if ( get_post_format() && in_array( get_post_format(), array( 'audio', 'video' ) ) ) {
// The current post has either the
// audio or video post format;
// enqueue a script
wp_enqueue_script( $handle, $src );
}
?>
```
Now that WordPress can... |
55,831 | <p>I've created a new query for a custom post type of 'courses'. Those results are then to be filtered using tax_query, querying 3 custom taxonomies matching 1 or several term ID's. These are passed from a search page.</p>
<p>Here's the code working find up to now:</p>
<pre><code>// Lets emulate the posted ID's from ... | [
{
"answer_id": 55836,
"author": "jessica",
"author_id": 2659,
"author_profile": "https://wordpress.stackexchange.com/users/2659",
"pm_score": 6,
"selected": true,
"text": "<p>You can define the args outside of the <code>WP_Query</code> instantiation:</p>\n\n<pre><code><?php\n$tax_quer... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55831",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17295/"
] | I've created a new query for a custom post type of 'courses'. Those results are then to be filtered using tax\_query, querying 3 custom taxonomies matching 1 or several term ID's. These are passed from a search page.
Here's the code working find up to now:
```
// Lets emulate the posted ID's from the course search wi... | You can define the args outside of the `WP_Query` instantiation:
```
<?php
$tax_query = array('relation' => 'AND');
if (isset($search_course_area))
{
$tax_query[] = array(
'taxonomy' => 'course-area',
'field' => 'id',
'terms' => $search_course_area
... |
55,851 | <p>Testing Site: <a href="http://www.indysouthportdental.com.php5-1.ord1-1.websitetestlink.com" rel="nofollow">http://www.indysouthportdental.com.php5-1.ord1-1.websitetestlink.com</a></p>
<p>I only want to display the children of parent in the sidebar when viewing any pages within the parent.</p>
<p>For example, Oral... | [
{
"answer_id": 55879,
"author": "Devin",
"author_id": 12383,
"author_profile": "https://wordpress.stackexchange.com/users/12383",
"pm_score": 0,
"selected": false,
"text": "<p>Just use this:</p>\n\n<pre><code><?php\n if($post->post_parent)\n $children = wp_list_pages(\"ti... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55851",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17301/"
] | Testing Site: <http://www.indysouthportdental.com.php5-1.ord1-1.websitetestlink.com>
I only want to display the children of parent in the sidebar when viewing any pages within the parent.
For example, Oral Health has 10 child pages. Some of those child (Treatment for example) pages have child pages (grandchildren of ... | Got it working. This is the final code (pulled from <http://cssglobe.com/post/5812/wordpress-find-pages-top-level-parent-id> with little modification)
```
<?php
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent ... |
55,856 | <p>I have seen on some wordpress themes that if the browser width is less, the normal menu becomes a select menu. Can someone tell me how it is done?
I know there is a plugin for that, but I want to know how to implement it in the theme without plugin.
Thanks</p>
| [
{
"answer_id": 55879,
"author": "Devin",
"author_id": 12383,
"author_profile": "https://wordpress.stackexchange.com/users/12383",
"pm_score": 0,
"selected": false,
"text": "<p>Just use this:</p>\n\n<pre><code><?php\n if($post->post_parent)\n $children = wp_list_pages(\"ti... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55856",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17303/"
] | I have seen on some wordpress themes that if the browser width is less, the normal menu becomes a select menu. Can someone tell me how it is done?
I know there is a plugin for that, but I want to know how to implement it in the theme without plugin.
Thanks | Got it working. This is the final code (pulled from <http://cssglobe.com/post/5812/wordpress-find-pages-top-level-parent-id> with little modification)
```
<?php
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent ... |
55,862 | <p>I have jquery file like as follows</p>
<p>"portfolio.css"<br>
"jquery-ui-1.8.18.custom.css"<br>
"portfolio.js"</p>
<p>I want to include these files into my plugin...
if anyone have solution for how to include above mentioned file into wordpress plugin then tell me....</p>
<p>please....
thank you in advance</p>
| [
{
"answer_id": 55879,
"author": "Devin",
"author_id": 12383,
"author_profile": "https://wordpress.stackexchange.com/users/12383",
"pm_score": 0,
"selected": false,
"text": "<p>Just use this:</p>\n\n<pre><code><?php\n if($post->post_parent)\n $children = wp_list_pages(\"ti... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55862",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17304/"
] | I have jquery file like as follows
"portfolio.css"
"jquery-ui-1.8.18.custom.css"
"portfolio.js"
I want to include these files into my plugin...
if anyone have solution for how to include above mentioned file into wordpress plugin then tell me....
please....
thank you in advance | Got it working. This is the final code (pulled from <http://cssglobe.com/post/5812/wordpress-find-pages-top-level-parent-id> with little modification)
```
<?php
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent ... |
55,890 | <p>I want to show the last category level of a post</p>
<p>for example, I hav a post in category "Course -> resultat -> Trail"</p>
<p>I want to show just "trail"</p>
<p>Thanks if somenone can help</p>
| [
{
"answer_id": 55892,
"author": "Max Yudin",
"author_id": 11761,
"author_profile": "https://wordpress.stackexchange.com/users/11761",
"pm_score": 0,
"selected": false,
"text": "<p>This will work if you don't assign multiple categories to the posts.</p>\n\n<pre><code>$categories = get_the... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55890",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17316/"
] | I want to show the last category level of a post
for example, I hav a post in category "Course -> resultat -> Trail"
I want to show just "trail"
Thanks if somenone can help | Try the following. I've used `get_the_terms` so it is readily extendible to any taxonomy.
This will return an array of terms (event if it contains just one). For instance, the post may have terms a,b,c,d,e in the relationship:
```
a > b > c (parent > child)
d > e
```
In which case the following will... |
55,897 | <p>Before 2 days there was a automatic update for wordpress, which I for my website.</p>
<p>When the update was over, I tried to access backend but I always get this message:</p>
<pre><code>Fatal error: Call to undefined function wp_is_mobile() in /home/*******/public_html/wp-login.php on line 67
</code></pre>
<p>Ca... | [
{
"answer_id": 55899,
"author": "MaximOrlovsky",
"author_id": 15294,
"author_profile": "https://wordpress.stackexchange.com/users/15294",
"pm_score": 3,
"selected": true,
"text": "<p>/!\\ <strong>Before change I suggest, please make a full backup (code + database) of your Wordpress.</str... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55897",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17317/"
] | Before 2 days there was a automatic update for wordpress, which I for my website.
When the update was over, I tried to access backend but I always get this message:
```
Fatal error: Call to undefined function wp_is_mobile() in /home/*******/public_html/wp-login.php on line 67
```
Can you give me any idea what to do... | /!\ **Before change I suggest, please make a full backup (code + database) of your Wordpress.**
* Deactivate all plugins.
If it does not help try next
* Re-upload all files and folders (**except the wp-content folder**) from a fresh download of WordPress. |
55,908 | <p>Is there a way to only do a section of code on a template if the post has just been published or updated?</p>
<p>What do I need to wrap around that code?</p>
<p><strong>UPDATE:</strong></p>
<p>I need to check if any of my custom-post types called "members" have been saved. The template I'm using to display the po... | [
{
"answer_id": 55910,
"author": "OriginalEXE",
"author_id": 16710,
"author_profile": "https://wordpress.stackexchange.com/users/16710",
"pm_score": 2,
"selected": false,
"text": "<p>Why don't you wrap it in post save_post and post_publish hooks?</p>\n\n<p>You have examples here: <a href=... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55908",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4588/"
] | Is there a way to only do a section of code on a template if the post has just been published or updated?
What do I need to wrap around that code?
**UPDATE:**
I need to check if any of my custom-post types called "members" have been saved. The template I'm using to display the posts is single-members.php.
If the po... | Why don't you wrap it in post save\_post and post\_publish hooks?
You have examples here: <http://codex.wordpress.org/Function_Reference/add_action>
How to do it:
Add this to your functions.php file:
```
function my_data_update () {
$company = get_field('company_name');
$address = get_field('address');
$city = ge... |
55,914 | <p>I registered my menu in functions.php, called it from header.php and set it all up in the Appearances > Menus backend. The problem is, I need to manually insert a div surrounding <code><ul class="sub-menu"> ... </ul></code> where my drop-down menu is.</p>
<p>There is no way around it like adding the div... | [
{
"answer_id": 55915,
"author": "jessica",
"author_id": 2659,
"author_profile": "https://wordpress.stackexchange.com/users/2659",
"pm_score": 3,
"selected": true,
"text": "<p>Update: The question was actually how to wrap the submenus, not the whole menu. Here are 2 options:</p>\n\n<p>usi... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55914",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14895/"
] | I registered my menu in functions.php, called it from header.php and set it all up in the Appearances > Menus backend. The problem is, I need to manually insert a div surrounding `<ul class="sub-menu"> ... </ul>` where my drop-down menu is.
There is no way around it like adding the div's class to the ul etc., as in or... | Update: The question was actually how to wrap the submenus, not the whole menu. Here are 2 options:
using jQuery:
```
<script type="text/javascript">
// run this before the script that sets up the dropdowns:
jQuery(document.ready(function($){
$('.sub-menu').wrap('<div class="dropdown"></div>');
})
</script>
``... |
55,924 | <p>In my theme's functions.php, I'm calling an add_action in order to gain a measure of control on where jquery is loaded (in the footer along with my theme's other scripts). </p>
<p>The problem I'm having is that when I use add_action('wp_enqueue_scripts'), it only appears to fire if no plugins are loaded. However, t... | [
{
"answer_id": 55928,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 6,
"selected": true,
"text": "<p>A lot of plugin developers don't do things the right way. The <em>right</em> way is to hook on to <code>wp_enqueue_sc... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55924",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6620/"
] | In my theme's functions.php, I'm calling an add\_action in order to gain a measure of control on where jquery is loaded (in the footer along with my theme's other scripts).
The problem I'm having is that when I use add\_action('wp\_enqueue\_scripts'), it only appears to fire if no plugins are loaded. However, the add... | A lot of plugin developers don't do things the right way. The *right* way is to hook on to `wp_enqueue_scripts` like you're trying to do.
However, here's the order of the hooks run in a typical request:
* muplugins\_loaded
* registered\_taxonomy
* registered\_post\_type
* plugins\_loaded
* sanitize\_comment\_cookies
... |
55,949 | <p>I have a stylesheet in my theme in the css subdir of the theme dir (<code>css/style.css</code>). The question is how to make this .css file appear in the theme editor of the WordPress admin. (I know using the web editor is a bad idea and I never use it, but the client specifically asked for this).</p>
<p>Note: the ... | [
{
"answer_id": 55977,
"author": "brasofilo",
"author_id": 12615,
"author_profile": "https://wordpress.stackexchange.com/users/12615",
"pm_score": 2,
"selected": true,
"text": "<p>I'd say it's impossible...</p>\n\n<p>For one, there's no hook inside the file <code>/wp-admin/theme-editor.ph... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55949",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17330/"
] | I have a stylesheet in my theme in the css subdir of the theme dir (`css/style.css`). The question is how to make this .css file appear in the theme editor of the WordPress admin. (I know using the web editor is a bad idea and I never use it, but the client specifically asked for this).
Note: the only css file that sh... | I'd say it's impossible...
For one, there's no hook inside the file `/wp-admin/theme-editor.php`.
And last but not least, if you try one of this, it dumps an error:
* `/wp-admin/theme-editor.php?file=css%2Fstyle.css&theme=twentyeleven`
* `/wp-admin/theme-editor.php?file=css/style.css&theme=twentyeleven`
Case you fi... |
55,952 | <p>I want the background-color of the selected box on this page to display gray color once the user lands on the corresponding page. My link is currently setup inside of the page template itself as a traditional link, and is not being displayed under the default Wordpress menu setup.</p>
<p>Do I need to add a CSS styl... | [
{
"answer_id": 55954,
"author": "user1337",
"author_id": 16338,
"author_profile": "https://wordpress.stackexchange.com/users/16338",
"pm_score": 1,
"selected": true,
"text": "<p>Each link would need a unique class. Then you can work from one of the body classes, eg <code>page-id-7</code>... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55952",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15578/"
] | I want the background-color of the selected box on this page to display gray color once the user lands on the corresponding page. My link is currently setup inside of the page template itself as a traditional link, and is not being displayed under the default Wordpress menu setup.
Do I need to add a CSS style to the "... | Each link would need a unique class. Then you can work from one of the body classes, eg `page-id-7` to do this. Your CSS would look like:
```
.page-id-7 .1-products a {color: #333;}
``` |
55,963 | <p>I am trying to add a QR code to the bar and I can do this but it's my first time to make a WordPress plug-in and I'm having trouble. It ends up showing to everyone even if they are not an admin or even not logged in. </p>
<p>Any ideas or guidance would be very grateful. </p>
<pre><code>function selfURL() {
$s ... | [
{
"answer_id": 55962,
"author": "jessica",
"author_id": 2659,
"author_profile": "https://wordpress.stackexchange.com/users/2659",
"pm_score": -1,
"selected": false,
"text": "<p>If the files & directories in your wordpress installation are all owned by the FTP user, then you can bypas... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55963",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17337/"
] | I am trying to add a QR code to the bar and I can do this but it's my first time to make a WordPress plug-in and I'm having trouble. It ends up showing to everyone even if they are not an admin or even not logged in.
Any ideas or guidance would be very grateful.
```
function selfURL() {
$s = empty($_SERVER["HTT... | The problem with WordPress not being able to install plugins or update itself is because WordPress uses the Apache 'user' for all its processes. In the case of Ubuntu / Linux the Apache user and group is www-data:www-data.
By doing `sudo chown www-data:www-data /wordpress` your changing the ownership of all files.
A... |
55,981 | <p>Hi I'm attempting to create my own custom template that will have a format like this:</p>
<pre><code><?php get_header(); ?>
<div id="container">
<div id="top-half">
<!--fixed content here that is stored in the page template-->
</div>
<div id="bott... | [
{
"answer_id": 55982,
"author": "OriginalEXE",
"author_id": 16710,
"author_profile": "https://wordpress.stackexchange.com/users/16710",
"pm_score": 2,
"selected": false,
"text": "<p>You pull content normally. You don't have to specify any id, as page/post will use template it is assigned... | 2012/06/20 | [
"https://wordpress.stackexchange.com/questions/55981",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15578/"
] | Hi I'm attempting to create my own custom template that will have a format like this:
```
<?php get_header(); ?>
<div id="container">
<div id="top-half">
<!--fixed content here that is stored in the page template-->
</div>
<div id="bottom-half">
<!--Content pulled from the actual... | You pull content normally. You don't have to specify any id, as page/post will use template it is assigned to, so I don't really understand your question. |
55,988 | <p>Been having a bit of a problem with my site regarding our caching method and my php code not refreshing or flushing.</p>
<p>To start, my site is on a dedicated Nginx webserver. I used W3 Total Cache for the initial caching setup. Everything was set up to cache through Memcached.<br>
(I should note, my website is ... | [
{
"answer_id": 56317,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 2,
"selected": false,
"text": "<p>First of all, this isn't a WordPress issue - it's a Memcache issue - and if not for the open bounty, I'd close it as ... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/55988",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3247/"
] | Been having a bit of a problem with my site regarding our caching method and my php code not refreshing or flushing.
To start, my site is on a dedicated Nginx webserver. I used W3 Total Cache for the initial caching setup. Everything was set up to cache through Memcached.
(I should note, my website is somewhat of a... | >
> So any suggestions are welcomed.
>
>
>
Suggestion #1 - Whenever Memcache is available in the server, I prefer [Memcached Object Cache](http://wordpress.org/extend/plugins/memcached/) and [Batcache](http://wordpress.org/extend/plugins/batcache/), unless I have a specific reason to use W3 Total Cache. Whatever, ... |
55,990 | <p>I'm using custom menu for <code>login/logout</code> here below is my code:</p>
<pre><code><?php
if(is_user_logged_in()) {
$user = wp_get_current_user();
echo 'Welcome <strong><a href="http://gopalbonline.com/kolkataonwheels/wp-admin/index.php" >'.$user->user_firstname.'</a><... | [
{
"answer_id": 55999,
"author": "Gembel Intelek",
"author_id": 17191,
"author_profile": "https://wordpress.stackexchange.com/users/17191",
"pm_score": 1,
"selected": false,
"text": "<p>something like this</p>\n\n<pre><code>function my_redirect(){\n $redirect_url = $_SERVER['HTTP_REFER... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/55990",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16951/"
] | I'm using custom menu for `login/logout` here below is my code:
```
<?php
if(is_user_logged_in()) {
$user = wp_get_current_user();
echo 'Welcome <strong><a href="http://gopalbonline.com/kolkataonwheels/wp-admin/index.php" >'.$user->user_firstname.'</a></strong>
| <a href="<?php echo wp_logout_url( get... | `wp_loginout(get_permalink());` will make hyperlink with "Log out/Log in" text and after log out it will stay in the same page, or it will direct user to log in page. |
56,004 | <p>I am building a new WordPress theme and it is quite different from my current theme. Currently the dimensions of my images are much wider than how I would like them to be for my new theme I am developing. Is there way to scale down the widths programmatically and in mass? Is there a plugin that accomplishes this tas... | [
{
"answer_id": 56008,
"author": "Gembel Intelek",
"author_id": 17191,
"author_profile": "https://wordpress.stackexchange.com/users/17191",
"pm_score": 0,
"selected": false,
"text": "<p>this plugin can handle your problem <a href=\"http://wordpress.org/extend/plugins/regenerate-thumbnail... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56004",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17193/"
] | I am building a new WordPress theme and it is quite different from my current theme. Currently the dimensions of my images are much wider than how I would like them to be for my new theme I am developing. Is there way to scale down the widths programmatically and in mass? Is there a plugin that accomplishes this task? | if what you need is to apply this to big images (no thumbnails like in Gembel's solution) you can use CSS, including a max-width statement. For example:
```
.content img{width:98%; max-width:200px;}
```
of course you should adapt the numbers to what you need, but you'll get the idea |
56,010 | <p>How can i filter the link given in "link to existing content". </p>
<p>Eg:<img src="https://i.stack.imgur.com/BwLoF.jpg" alt="enter image description here"></p>
<p>As in the above image. I just want WSP BANNER TO BE SHOWN. </p>
<p>where WSP BANNER & CALENDAR are custom POST types</p>
<p>Any help will be appr... | [
{
"answer_id": 56012,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 0,
"selected": false,
"text": "<p>Check the file <code>class-wp-editor.php</code>, line no. 742 onwards. The list doesn't have any filter... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56010",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17355/"
] | How can i filter the link given in "link to existing content".
Eg:
As in the above image. I just want WSP BANNER TO BE SHOWN.
where WSP BANNER & CALENDAR are custom POST types
Any help will be appreciable. | Currently there are no ready filters available for this purpose. A [ticket](http://core.trac.wordpress.org/ticket/21033) has been posted for the request.Lets hope we get one soon.
Instead of hardcoding your custom post types its better to create a filter hook and use it
Till then you can create your own filter.
Open... |
56,020 | <p>I want to modify wp_ajax_find_posts function. It receives search string from find-posts form and delivers search results by ajax. Part of the function looks like this:</p>
<pre><code>function wp_ajax_find_posts() {
global $wpdb;
check_ajax_referer( 'find-posts' );
// ........
$search .= " OR ($wpdb... | [
{
"answer_id": 56026,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 0,
"selected": false,
"text": "<p>I've posted the code for alphabetical title/content search here: <a href=\"https://wordpress.stackexcha... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56020",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5210/"
] | I want to modify wp\_ajax\_find\_posts function. It receives search string from find-posts form and delivers search results by ajax. Part of the function looks like this:
```
function wp_ajax_find_posts() {
global $wpdb;
check_ajax_referer( 'find-posts' );
// ........
$search .= " OR ($wpdb->posts.pos... | You can jump in front of an AJAX hook by specifying a higher priority (i.e. lower number), like this:
```
add_action( 'wp_ajax_find_posts', 'wp_ajax_find_posts', 0 );
```
NB: works because 0 < 1 |
56,031 | <p>We have a custom post type called <code>listings</code>, and each <code>listing</code> has a custom field <code>zipcode</code> (which is a 5 digit number). We then have a custom taxonomy <code>area</code>, which can be "New York", "Los Angeles" etc.</p>
<p>If the <code>zipcode</code> is "10001", "10002" or "10003" ... | [
{
"answer_id": 56036,
"author": "Gembel Intelek",
"author_id": 17191,
"author_profile": "https://wordpress.stackexchange.com/users/17191",
"pm_score": 2,
"selected": true,
"text": "<p>I'm sure this not best answer, however you may try like this</p>\n\n<pre><code>add_action('save_post', '... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56031",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16872/"
] | We have a custom post type called `listings`, and each `listing` has a custom field `zipcode` (which is a 5 digit number). We then have a custom taxonomy `area`, which can be "New York", "Los Angeles" etc.
If the `zipcode` is "10001", "10002" or "10003" then it should be assigned to "New York", and if it's "90001" or ... | I'm sure this not best answer, however you may try like this
```
add_action('save_post', 'add_my_taxonomy');
function add_my_taxonomy($post_ID) {
$area = array(
'ny' => 'New York',
'la' => 'Los Angeles'
);
$zip = array(
'ny' => '10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 100... |
56,033 | <p>Hi I'm using XDEBUG to debug my WordPress code, is it possible to view the page building up in the browser while debugging? At the moment the page just hangs until the debugging process is finished then displays the fully rendered page. Ideally I'd like to see the page building up bit by bit as I debug through the t... | [
{
"answer_id": 56036,
"author": "Gembel Intelek",
"author_id": 17191,
"author_profile": "https://wordpress.stackexchange.com/users/17191",
"pm_score": 2,
"selected": true,
"text": "<p>I'm sure this not best answer, however you may try like this</p>\n\n<pre><code>add_action('save_post', '... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56033",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5844/"
] | Hi I'm using XDEBUG to debug my WordPress code, is it possible to view the page building up in the browser while debugging? At the moment the page just hangs until the debugging process is finished then displays the fully rendered page. Ideally I'd like to see the page building up bit by bit as I debug through the them... | I'm sure this not best answer, however you may try like this
```
add_action('save_post', 'add_my_taxonomy');
function add_my_taxonomy($post_ID) {
$area = array(
'ny' => 'New York',
'la' => 'Los Angeles'
);
$zip = array(
'ny' => '10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 100... |
56,034 | <p>This is my first attempt at modifying the main query using the <code>pre_get_posts</code> action/filter</p>
<p>This is the function currently hooked to it:</p>
<pre><code>function advanced_product_search_filter($query)
{
if(!is_admin() &&
is_main_query() &&
is_search() && $quer... | [
{
"answer_id": 56676,
"author": "Łukasz Muchlado",
"author_id": 17574,
"author_profile": "https://wordpress.stackexchange.com/users/17574",
"pm_score": 0,
"selected": false,
"text": "<p>Check definition of your \"pa_ordering-code\" taxonomy.</p>\n\n<p>It looks like you could have wrong v... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56034",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15247/"
] | This is my first attempt at modifying the main query using the `pre_get_posts` action/filter
This is the function currently hooked to it:
```
function advanced_product_search_filter($query)
{
if(!is_admin() &&
is_main_query() &&
is_search() && $query->query_vars['post_type'] == 'product')
{
$keywor... | The `0 = 1` happens when the terms don't exist.
You're creating a query for some set of terms. Before it can add the SQL to that main query, it first does a secondary query to get the term\_id's for the relevant terms. If none are found, then it returns 0 = 1 instead, to shortcut the main query because no terms match ... |
56,042 | <p>Does anyone know how I can set a different value in the select options in the Contact Form 7 plugin? Here is an example of the HTML I'd like it to generate:</p>
<pre><code><select>
<option value="1">My car</option>
<option value="2">Your car</option>
</sel... | [
{
"answer_id": 56089,
"author": "Demilio",
"author_id": 12727,
"author_profile": "https://wordpress.stackexchange.com/users/12727",
"pm_score": 2,
"selected": false,
"text": "<p>I solved this by publishing the standard contct form 7 form first, then I copied the source code created from ... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56042",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12727/"
] | Does anyone know how I can set a different value in the select options in the Contact Form 7 plugin? Here is an example of the HTML I'd like it to generate:
```
<select>
<option value="1">My car</option>
<option value="2">Your car</option>
</select>
``` | It looks like this is supported by Contact Form 7 natively, it's just not very obvious on how to make it happen.
Here's a documentation page explaining the functionality: <http://contactform7.com/selectable-recipient-with-pipes/>
Basically, all you have to do is put the values like so:
```
"Visible Value|actual-form... |
56,052 | <p>My code is:</p>
<pre><code>$sliders = new WP_Query(array('post_type' => 'sliders', 'showposts' => '10', 'orderby' => 'menu_order', 'order' => 'ASC', 'countries'=> 'Default', 'supress_filters' => true, 'meta_query' => array(
</code></pre>
<p>But wordpress orderby post_date :(</p>
<pre><code> ... | [
{
"answer_id": 56085,
"author": "BaltimoreDrew",
"author_id": 17378,
"author_profile": "https://wordpress.stackexchange.com/users/17378",
"pm_score": 2,
"selected": false,
"text": "<p>I think (could be wrong) the problem is only pages have menu_order. Also, when you registered the post_t... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56052",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17370/"
] | My code is:
```
$sliders = new WP_Query(array('post_type' => 'sliders', 'showposts' => '10', 'orderby' => 'menu_order', 'order' => 'ASC', 'countries'=> 'Default', 'supress_filters' => true, 'meta_query' => array(
```
But wordpress orderby post\_date :(
```
[query] => Array
(
[post_type] => sliders
... | First, it's `suppress_filters` with two P's.
Secondly, 'countries' => 'default' doesn't do anything in a normal query, so I suspect you have something else going on code-wise.
Third, when I do your query with this code
```
$sliders = new WP_Query(array('post_type' => 'sliders',
'showposts' => '10',
'orderby' => 'm... |
56,059 | <p>I need to post extra information on programs pages, so i have decided to use wordpress metabox but its showing on all pages. So is there any condition check so it could put meta box on those sub pages only where parent_page is 'Programs' or or Parent Page id.</p>
<p>I have already tried this...</p>
<pre><code>func... | [
{
"answer_id": 56062,
"author": "Adam",
"author_id": 13418,
"author_profile": "https://wordpress.stackexchange.com/users/13418",
"pm_score": 0,
"selected": false,
"text": "<p>Possibly a conditional statement like this,</p>\n\n<pre><code>function custom_meta_box() {\n\n global $post;\n... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56059",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17024/"
] | I need to post extra information on programs pages, so i have decided to use wordpress metabox but its showing on all pages. So is there any condition check so it could put meta box on those sub pages only where parent\_page is 'Programs' or or Parent Page id.
I have already tried this...
```
function parent_id() {
... | After too many tries i have found following solution myself, but this could save others time.
```
$pid = (isset($_GET['post']) ? $_GET['post'] : $_POST['post_ID']);
$page_att = get_page( $pid );
$page_parent = $page_att->post_parent;
if(15 == $page_parent){
//register metabox
}
``` |
56,071 | <p>I want to query posts by their author role. And do something with the post based on the role. </p>
<p>I know we can get the post by get_posts or WP_query, the problem is there are no argument to sort the post based on the author role. Or, we also can combine get_users and get_posts together, like this </p>
<pre><c... | [
{
"answer_id": 56075,
"author": "OriginalEXE",
"author_id": 16710,
"author_profile": "https://wordpress.stackexchange.com/users/16710",
"pm_score": -1,
"selected": false,
"text": "<p>You can use Roles and Capabilitied check by deploying function:</p>\n\n<pre><code>current_user_can( $capa... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56071",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14728/"
] | I want to query posts by their author role. And do something with the post based on the role.
I know we can get the post by get\_posts or WP\_query, the problem is there are no argument to sort the post based on the author role. Or, we also can combine get\_users and get\_posts together, like this
```
$users = get_... | I haven't really messed around with custom post queries before, but here is my try at a solution:
```
function get_posts_by_author_role($role) {
global $wpdb;
return $wpdb->get_results( "SELECT p.* FROM {$wpdb->posts} p, {$wpdb->usermeta} u"
." WHERE p.post_type = 'post'"... |
56,072 | <p>I have this jquery code inside my wordpress admin page that checks if the input value is empty.</p>
<pre><code>$j(function(){
$j('form').submit(function(){
var link = $j('#input').val();
if(link == ''){
alert('hi there');
}
});
});
</code></pre>
<p>Now if the form is empty it will alert ' ... | [
{
"answer_id": 56074,
"author": "OriginalEXE",
"author_id": 16710,
"author_profile": "https://wordpress.stackexchange.com/users/16710",
"pm_score": -1,
"selected": false,
"text": "<p>I believe the problem is that you are enquequeing jquery. </p>\n\n<p>You don't need to do that, as WordPr... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56072",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12918/"
] | I have this jquery code inside my wordpress admin page that checks if the input value is empty.
```
$j(function(){
$j('form').submit(function(){
var link = $j('#input').val();
if(link == ''){
alert('hi there');
}
});
});
```
Now if the form is empty it will alert ' hi there'.
the plugin wor... | ```
function test(){
wp_enqueue_script('myscript', plugin_dir_url(__FILE__). 'js/test.js',array('jquery'));
}
add_action('admin_print_scripts','test');
add_action('wp_head','test');
``` |
56,076 | <p>I am trying to create a custom homepage where the site content is shown as follows...</p>
<p>See image...</p>
<p><a href="https://i.stack.imgur.com/ykrdf.png" rel="nofollow noreferrer">http://i.stack.imgur.com/ykrdf.png</a></p>
<p>With separate loops this is simple... 3 individual query_posts inside a category fe... | [
{
"answer_id": 56074,
"author": "OriginalEXE",
"author_id": 16710,
"author_profile": "https://wordpress.stackexchange.com/users/16710",
"pm_score": -1,
"selected": false,
"text": "<p>I believe the problem is that you are enquequeing jquery. </p>\n\n<p>You don't need to do that, as WordPr... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56076",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17306/"
] | I am trying to create a custom homepage where the site content is shown as follows...
See image...
[http://i.stack.imgur.com/ykrdf.png](https://i.stack.imgur.com/ykrdf.png)
With separate loops this is simple... 3 individual query\_posts inside a category fetch loop...
But I want to reduce the number of query posts... | ```
function test(){
wp_enqueue_script('myscript', plugin_dir_url(__FILE__). 'js/test.js',array('jquery'));
}
add_action('admin_print_scripts','test');
add_action('wp_head','test');
``` |
56,082 | <p>We use the default WordPress <code>register_setting()</code> function to validate theme options. This call, for example:</p>
<pre><code>register_setting( 'options-group', 'option1', 'intval' );
</code></pre>
<p>Will validate whether or not <code>$option1</code> is an integer.</p>
<p>What can I use to pass an arr... | [
{
"answer_id": 56100,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 5,
"selected": true,
"text": "<p>What you need to do is build your own data validation function. Ozh wrote <a href=\"http://planetozh.com/blog/2009/05... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56082",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1372/"
] | We use the default WordPress `register_setting()` function to validate theme options. This call, for example:
```
register_setting( 'options-group', 'option1', 'intval' );
```
Will validate whether or not `$option1` is an integer.
What can I use to pass an array of options to validate each member of the array?
For... | What you need to do is build your own data validation function. Ozh wrote [a great tutorial](http://planetozh.com/blog/2009/05/handling-plugins-options-in-wordpress-28-with-register_setting/) about this earlier, but here's the gist of it ...
Assume your options array is called `$my_options` and it contains three field... |
56,087 | <p>I have similar problem to this one: <a href="https://wordpress.stackexchange.com/questions/20543/custom-post-type-template-archive">Custom Post Type Template - Archive</a></p>
<p>I have a WordPress custom post type called <code>coupon</code>. I try to assign the template to it by using <code>archive-coupon.php</code... | [
{
"answer_id": 56097,
"author": "Sisir",
"author_id": 3094,
"author_profile": "https://wordpress.stackexchange.com/users/3094",
"pm_score": 1,
"selected": false,
"text": "<p>i believe <code>tag</code> is a reserved taxonomy rewrite name on wordpress to be used on default <code>post_tag</... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56087",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17254/"
] | I have similar problem to this one: [Custom Post Type Template - Archive](https://wordpress.stackexchange.com/questions/20543/custom-post-type-template-archive)
I have a WordPress custom post type called `coupon`. I try to assign the template to it by using `archive-coupon.php`, but it goes directly to `home.php`.
I ... | I think you should add support for custom taxonomy types and name the file taxonomy-cpt-type.php where cpt is the name of your Custom Post Type.
Your CPT archive file should be named archive-cpt.php where cpt is the name of your Custom Post Type.
Here's all the code which has been tested.
**Note:** You shouldn't be ... |
56,104 | <p>Is there a function for getting a list of registered Meta Boxes and removing them? I see there is a method for adding, and removing.</p>
<p><a href="http://codex.wordpress.org/Function_Reference/remove_meta_box" rel="noreferrer">http://codex.wordpress.org/Function_Reference/remove_meta_box</a></p>
<p><a href="http... | [
{
"answer_id": 56109,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 4,
"selected": true,
"text": "<p>Not really, but you can define your own. All meta boxes are stored in the global variable <code>$wp_meta_boxes</code>... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56104",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9579/"
] | Is there a function for getting a list of registered Meta Boxes and removing them? I see there is a method for adding, and removing.
<http://codex.wordpress.org/Function_Reference/remove_meta_box>
<http://codex.wordpress.org/Function_Reference/add_meta_box> | Not really, but you can define your own. All meta boxes are stored in the global variable `$wp_meta_boxes` which is a multi-dimensional array.
```
function get_meta_boxes( $screen = null, $context = 'advanced' ) {
global $wp_meta_boxes;
if ( empty( $screen ) )
$screen = get_current_screen();
elsei... |
56,126 | <p>I'm trying to create a portfolio page that will display a series of thumbnails and, when clicked on, will go to single.php. The code I'm using below seems to work in that when I click "see more" it goes to the proper page, however the thumbnails are not showing up. Any ideas as to why? Thanks.</p>
<p><a href="http:... | [
{
"answer_id": 56124,
"author": "getWeberForStackExchange",
"author_id": 5927,
"author_profile": "https://wordpress.stackexchange.com/users/5927",
"pm_score": 1,
"selected": false,
"text": "<p><strong>Yes you can use PHP's SQL functions in WordPress.</strong> WordPress is written in PHP,... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56126",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14606/"
] | I'm trying to create a portfolio page that will display a series of thumbnails and, when clicked on, will go to single.php. The code I'm using below seems to work in that when I click "see more" it goes to the proper page, however the thumbnails are not showing up. Any ideas as to why? Thanks.
[Live site.](http://www.... | There are a few different reasons.
1. [Separation of Concerns](http://en.wikipedia.org/wiki/Separation_of_concerns)
--------------------------------------------------------------------------------
Fundamentally, your logical code (i.e. your plugin or your theme) should not need to know anything about the database. At... |
56,135 | <p>I´m new with wordpress and I need to create a slider based on Nivo library. There I would like to create the shortcode using this syntax:</p>
<pre><code>[slider]
[image]http: //www .domain.com/images/1.jpg[/image]
[image]http: //www .domain.com/images/2.jpg[/image]
[image]http: //www .domain.com/images/n.jpg[/image... | [
{
"answer_id": 56140,
"author": "HungryCoder",
"author_id": 17129,
"author_profile": "https://wordpress.stackexchange.com/users/17129",
"pm_score": 1,
"selected": false,
"text": "<p>at first glance i see, you registered <code>nivo-slider</code> as your shortcode but you've used <code>[sl... | 2012/06/22 | [
"https://wordpress.stackexchange.com/questions/56135",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17391/"
] | I´m new with wordpress and I need to create a slider based on Nivo library. There I would like to create the shortcode using this syntax:
```
[slider]
[image]http: //www .domain.com/images/1.jpg[/image]
[image]http: //www .domain.com/images/2.jpg[/image]
[image]http: //www .domain.com/images/n.jpg[/image]
[/slider]
`... | that's will be nested shortcodes, so you will need [slider] and [image] shortcode
```
add_shortcode( 'nivo_slider', 'nivo_slider_func' );
function nivo_slider_func( $atts, $content = null ) {
$output = '<div class="slider-wrapper theme-default">';
$output .= '<div id="slider" class="nivoSlider">';
$out... |
56,168 | <p>I have links going to category pages on a WordPress blog. These category pages show all the posts that are in that category and sub-categories. I want to group these lists by the authors.</p>
<p>I guess need to modify category.php to first list all the authors which have posts in that particular category and then r... | [
{
"answer_id": 56173,
"author": "Gembel Intelek",
"author_id": 17191,
"author_profile": "https://wordpress.stackexchange.com/users/17191",
"pm_score": 0,
"selected": false,
"text": "<p>make your query to order by author<br>\nexample for WP_Query</p>\n\n<pre><code>$query = new WP_Query( a... | 2012/06/22 | [
"https://wordpress.stackexchange.com/questions/56168",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14411/"
] | I have links going to category pages on a WordPress blog. These category pages show all the posts that are in that category and sub-categories. I want to group these lists by the authors.
I guess need to modify category.php to first list all the authors which have posts in that particular category and then run WP\_Que... | I don't think you need to get the list of authors in a given category or use a bunch of individual `WP_Query`'s, you just need to [order posts](http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters) by author and check to see when the author changes.
Two parts to this. One to modify the loop... |
56,187 | <p>So following on from this post: <a href="https://stackoverflow.com/q/1463480/1086990">https://stackoverflow.com/q/1463480/1086990</a> I was wondering how exactly it would work integrating it into Wordpress.</p>
<p>I have a custom post type setup, and so far I have tried both linking to a "ical.php" with the above l... | [
{
"answer_id": 56203,
"author": "Stephen Harris",
"author_id": 9364,
"author_profile": "https://wordpress.stackexchange.com/users/9364",
"pm_score": 3,
"selected": true,
"text": "<p>I would use WordPress' <em>feeds</em>. You can create your own feed with <a href=\"http://codex.wordpress.... | 2012/06/22 | [
"https://wordpress.stackexchange.com/questions/56187",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17411/"
] | So following on from this post: <https://stackoverflow.com/q/1463480/1086990> I was wondering how exactly it would work integrating it into Wordpress.
I have a custom post type setup, and so far I have tried both linking to a "ical.php" with the above link code (and changing the title into `the_title()` and the dates ... | I would use WordPress' *feeds*. You can create your own feed with [`add_feed`](http://codex.wordpress.org/Rewrite_API/add_feed). You specify a callback and this callback is responsible for displaying the output.
Creating a feed
---------------
```
add_feed('my-events','wpse56187_ical_cb');
```
`wpse56187_ical_cb` i... |
56,190 | <p>I'm trying to make a post pagination like this: </p>
<p><code>button left image | 1 2 3 4 5 |button right image</code> </p>
<p>but I can't get it work. I've tried: </p>
<p><code><?php wp_link_pages('before=<p>&after=</p>&next_or_number=number&pagelink= %'); ?></code> </p>
<p>But ... | [
{
"answer_id": 56203,
"author": "Stephen Harris",
"author_id": 9364,
"author_profile": "https://wordpress.stackexchange.com/users/9364",
"pm_score": 3,
"selected": true,
"text": "<p>I would use WordPress' <em>feeds</em>. You can create your own feed with <a href=\"http://codex.wordpress.... | 2012/06/21 | [
"https://wordpress.stackexchange.com/questions/56190",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17376/"
] | I'm trying to make a post pagination like this:
`button left image | 1 2 3 4 5 |button right image`
but I can't get it work. I've tried:
`<?php wp_link_pages('before=<p>&after=</p>&next_or_number=number&pagelink= %'); ?>`
But how to add images to the left an right as buttons? thx! AD | I would use WordPress' *feeds*. You can create your own feed with [`add_feed`](http://codex.wordpress.org/Rewrite_API/add_feed). You specify a callback and this callback is responsible for displaying the output.
Creating a feed
---------------
```
add_feed('my-events','wpse56187_ical_cb');
```
`wpse56187_ical_cb` i... |
56,195 | <p>For whatever reason I can't seem to get my .htaccess file to work correctly on a local Wordpress install. What I'm trying to achieve is to have the themes assets paths rewritten as such:</p>
<pre><code> RewriteRule ^img/(.*)$ wp-content/themes/cashed/img/$1 [L]
</code></pre>
<p>The current location to my images fo... | [
{
"answer_id": 56203,
"author": "Stephen Harris",
"author_id": 9364,
"author_profile": "https://wordpress.stackexchange.com/users/9364",
"pm_score": 3,
"selected": true,
"text": "<p>I would use WordPress' <em>feeds</em>. You can create your own feed with <a href=\"http://codex.wordpress.... | 2012/06/22 | [
"https://wordpress.stackexchange.com/questions/56195",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3093/"
] | For whatever reason I can't seem to get my .htaccess file to work correctly on a local Wordpress install. What I'm trying to achieve is to have the themes assets paths rewritten as such:
```
RewriteRule ^img/(.*)$ wp-content/themes/cashed/img/$1 [L]
```
The current location to my images folder is:
```
wp-content/... | I would use WordPress' *feeds*. You can create your own feed with [`add_feed`](http://codex.wordpress.org/Rewrite_API/add_feed). You specify a callback and this callback is responsible for displaying the output.
Creating a feed
---------------
```
add_feed('my-events','wpse56187_ical_cb');
```
`wpse56187_ical_cb` i... |
56,206 | <p>In order to refrain from possible duplicate URLs or conflicting URLs, I really want to use "postname" for a clean URL structure, EXCEPT for the blog ... for the blog and it's posts, I always want /blog/ to be apart of the URL. This makes total sense, and I don't quite understand why it doesn't function like this whe... | [
{
"answer_id": 56208,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": false,
"text": "<p>if your posts page is <code>/blog/</code>, then set your post permalinks to <code>/blog/%postname%/</code></p>\n"
... | 2012/06/22 | [
"https://wordpress.stackexchange.com/questions/56206",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9295/"
] | In order to refrain from possible duplicate URLs or conflicting URLs, I really want to use "postname" for a clean URL structure, EXCEPT for the blog ... for the blog and it's posts, I always want /blog/ to be apart of the URL. This makes total sense, and I don't quite understand why it doesn't function like this when y... | I've come to accept that this is just a limit of WordPress. |
56,219 | <p>Hello at the moment I'm wondering how I would be able to make this work to post in Hierarchical order within the post loop. </p>
<pre><code><?php
foreach ((get_the_category()) as $childcat)
{
if (cat_is_ancestor_of('42', $childcat))
{
echo '<li> <a href="'.get_ca... | [
{
"answer_id": 56236,
"author": "Adam",
"author_id": 13418,
"author_profile": "https://wordpress.stackexchange.com/users/13418",
"pm_score": 3,
"selected": true,
"text": "<p>Use <code>wp_list_categories</code> instead,</p>\n<pre><code><?php \n\n $args = array(\n 'hierarchical' ... | 2012/06/22 | [
"https://wordpress.stackexchange.com/questions/56219",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16946/"
] | Hello at the moment I'm wondering how I would be able to make this work to post in Hierarchical order within the post loop.
```
<?php
foreach ((get_the_category()) as $childcat)
{
if (cat_is_ancestor_of('42', $childcat))
{
echo '<li> <a href="'.get_category_link($childcat->cat... | Use `wp_list_categories` instead,
```
<?php
$args = array(
'hierarchical' => true,
'child_of' => 42, //parent category
'hide_empty' => 1, //hide empty categories (set to 0 to show)
);
wp_list_categories($args);
?>
```
A full list of parameters for `wp_list_... |
56,223 | <p>Is there any way to know what functions are added to actions on a certain page in WordPress?</p>
| [
{
"answer_id": 56224,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": false,
"text": "<p>There is a magic action <code>all</code> which is called on every action or filter. You can hook into this action and ... | 2012/06/22 | [
"https://wordpress.stackexchange.com/questions/56223",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/293/"
] | Is there any way to know what functions are added to actions on a certain page in WordPress? | There is a magic action `all` which is called on every action or filter. You can hook into this action and log all associated functions. In `$GLOBALS['wp_filter']` which you can inspect too you can find all active hooks, eg. hooks that are actually used.
I have written a small plugin [T5 Debug Hook](https://gist.githu... |
56,227 | <p>I have a wordpress site that, for some users, they only see a blank page. In fact, they only get some sort of javascript (below). I've tried deactivating all plugins and changing the theme; I still get the same result. I don't have any compression plugins (like WP-Cache or WP-SuperCache) installed.</p>
<p>What's th... | [
{
"answer_id": 56231,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 3,
"selected": true,
"text": "<p>If you've disabled all plugins and switched back to the default Twenty Ten (or Twenty Eleven) theme and are <em>still<... | 2012/06/22 | [
"https://wordpress.stackexchange.com/questions/56227",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3724/"
] | I have a wordpress site that, for some users, they only see a blank page. In fact, they only get some sort of javascript (below). I've tried deactivating all plugins and changing the theme; I still get the same result. I don't have any compression plugins (like WP-Cache or WP-SuperCache) installed.
What's the problem,... | If you've disabled all plugins and switched back to the default Twenty Ten (or Twenty Eleven) theme and are *still* seeing this, then you've got a serious problem.
First of all, the JavaScript is horribly obfuscated. Second of all, with no plugins and a default theme, you should see the default layout of WordPress.
F... |