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 |
|---|---|---|---|---|---|---|
104,466 | <p>I'm using this code to display the last three posts of a custom taxonomy ('special') by a certain author:</p>
<pre><code><?php query_posts( array( 'taxo' => 'special', 'showposts' => 3, 'author' => 2 ) ); ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<a href="<?php th... | [
{
"answer_id": 104468,
"author": "Yamu",
"author_id": 34577,
"author_profile": "https://wordpress.stackexchange.com/users/34577",
"pm_score": 0,
"selected": false,
"text": "<p>I think this is what you want to do!</p>\n\n<pre><code><?php\n $sql = \"SELECT * FROM $wpdb->posts WHERE p... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104466",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34104/"
] | I'm using this code to display the last three posts of a custom taxonomy ('special') by a certain author:
```
<?php query_posts( array( 'taxo' => 'special', 'showposts' => 3, 'author' => 2 ) ); ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?><... | ```
$args = array(
'taxonomy' => 'special',
'posts_per_page' => -1,
'author' => 2
);
$author_category_posts = new WP_Query($args);
$count_of_posts_by_author = $author_category_posts->post_count;
```
You can fetch the number of posts made by that author in specific taxonomy. |
104,477 | <p>Since updating to Wordpress 3.5 I've had my updates of pages and posts become excessively slow. I've been timing them and they take 40-80 seconds to update. </p>
<p>I've spent the last 2 hours reading and trying everything I can find in the Wordpress.org forums yet nothing works. </p>
<p>I use maxcdn and CloudFlar... | [
{
"answer_id": 104468,
"author": "Yamu",
"author_id": 34577,
"author_profile": "https://wordpress.stackexchange.com/users/34577",
"pm_score": 0,
"selected": false,
"text": "<p>I think this is what you want to do!</p>\n\n<pre><code><?php\n $sql = \"SELECT * FROM $wpdb->posts WHERE p... | 2013/06/26 | [
"https://wordpress.stackexchange.com/questions/104477",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10013/"
] | Since updating to Wordpress 3.5 I've had my updates of pages and posts become excessively slow. I've been timing them and they take 40-80 seconds to update.
I've spent the last 2 hours reading and trying everything I can find in the Wordpress.org forums yet nothing works.
I use maxcdn and CloudFlare for the frontsi... | ```
$args = array(
'taxonomy' => 'special',
'posts_per_page' => -1,
'author' => 2
);
$author_category_posts = new WP_Query($args);
$count_of_posts_by_author = $author_category_posts->post_count;
```
You can fetch the number of posts made by that author in specific taxonomy. |
104,480 | <p>I've just recently installed a local installation of Wordpress 3.5.2 on my laptop, running ubuntu 12.10. I installed following the guide from <a href="https://help.ubuntu.com/community/WordPress" rel="nofollow">here</a>. So far, everything else is working, except I cannot upload any media files via <code>Media Libra... | [
{
"answer_id": 104504,
"author": "markratledge",
"author_id": 268,
"author_profile": "https://wordpress.stackexchange.com/users/268",
"pm_score": 0,
"selected": false,
"text": "<p>777 permissions are <em>passably</em> OK on localhost, but very bad in production. (You can temporarily set ... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104480",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34629/"
] | I've just recently installed a local installation of Wordpress 3.5.2 on my laptop, running ubuntu 12.10. I installed following the guide from [here](https://help.ubuntu.com/community/WordPress). So far, everything else is working, except I cannot upload any media files via `Media Library -> Add New`.
The file seems to... | Right, I've managed to solve the problem. Maybe this answer helps other people who encounter the issue again. The problem is inherently in the installation procedure when installing via the package manager in ubuntu.
The actual issue was in the database configuration, the installation had set `WP_CONTENT_DIR` to `/srv... |
104,481 | <p>I want to use conditional statements in WordPress. How can I get the current category and tag outside of The Loop? I tried this but it did not work for me.</p>
<pre><code><?php
$category = get_the_category();
echo $category[0]->cat_name;
?>
</code></pre>
| [
{
"answer_id": 104504,
"author": "markratledge",
"author_id": 268,
"author_profile": "https://wordpress.stackexchange.com/users/268",
"pm_score": 0,
"selected": false,
"text": "<p>777 permissions are <em>passably</em> OK on localhost, but very bad in production. (You can temporarily set ... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104481",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/30937/"
] | I want to use conditional statements in WordPress. How can I get the current category and tag outside of The Loop? I tried this but it did not work for me.
```
<?php
$category = get_the_category();
echo $category[0]->cat_name;
?>
``` | Right, I've managed to solve the problem. Maybe this answer helps other people who encounter the issue again. The problem is inherently in the installation procedure when installing via the package manager in ubuntu.
The actual issue was in the database configuration, the installation had set `WP_CONTENT_DIR` to `/srv... |
104,487 | <p>I am using WP3.5, and I have a <code>post_list.php</code> which will show all the posts order by post date DESC. Everything is ok except <code>pagination</code>.</p>
<p>I have 15 posts, for test purpose, I want to every page show 2 posts, others will be show next page like this.</p>
<pre><code>Prev 1 2 3 4 5 Next
... | [
{
"answer_id": 104488,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": true,
"text": "<p>Use <a href=\"http://codex.wordpress.org/Function_Reference/paginate_links\" rel=\"nofollow noreferrer\"><cod... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104487",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34196/"
] | I am using WP3.5, and I have a `post_list.php` which will show all the posts order by post date DESC. Everything is ok except `pagination`.
I have 15 posts, for test purpose, I want to every page show 2 posts, others will be show next page like this.
```
Prev 1 2 3 4 5 Next
```
Some parts of post\_list.php
```
def... | Use [`paginate_links`](http://codex.wordpress.org/Function_Reference/paginate_links). It is meant to do pretty much just that. Plus, the ordinary pagination functions like [`next_posts_link` (which I think you want instead of `next_post_link`) do not work reliably with custom queries](https://wordpress.stackexchange.co... |
104,510 | <p>I have this code which I want to add into a specific page of mine. I don't want to create a file for it and then include etc (though do tell if that would be the only way). Also I don't want it to be in the header as it would be included in all pages. The code is:</p>
<pre><code><script type="text/javascript">... | [
{
"answer_id": 104511,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": false,
"text": "<p>WordPress loads <a href=\"http://api.jquery.com/jQuery.noConflict/\" rel=\"nofollow\">jQuery in \"No Conflic... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104510",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34642/"
] | I have this code which I want to add into a specific page of mine. I don't want to create a file for it and then include etc (though do tell if that would be the only way). Also I don't want it to be in the header as it would be included in all pages. The code is:
```
<script type="text/javascript">
$(function () {
... | Although @s\_ha\_dum is correct you *WILL* need to use jQuery no conflict within WordPress the original question is left unanswered.
>
> I have this code which I want to add into a specific page of mine.
>
>
>
There are a couple of ways to do this
Based on Page name/slug WordPress in theme's functions.php
-----... |
104,513 | <p>So I've tried like three different solutions:</p>
<pre><code> remove_action('init', 'wp_admin_bar_init');
add_filter( 'show_admin_bar', '__return_false' );
function remove_admin_bar_css() {
show_admin_bar( false );
remove_action('wp_head', '_admin_bar_bump_cb');
}
add_action('ad... | [
{
"answer_id": 104511,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": false,
"text": "<p>WordPress loads <a href=\"http://api.jquery.com/jQuery.noConflict/\" rel=\"nofollow\">jQuery in \"No Conflic... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104513",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34348/"
] | So I've tried like three different solutions:
```
remove_action('init', 'wp_admin_bar_init');
add_filter( 'show_admin_bar', '__return_false' );
function remove_admin_bar_css() {
show_admin_bar( false );
remove_action('wp_head', '_admin_bar_bump_cb');
}
add_action('admin_bar_init',... | Although @s\_ha\_dum is correct you *WILL* need to use jQuery no conflict within WordPress the original question is left unanswered.
>
> I have this code which I want to add into a specific page of mine.
>
>
>
There are a couple of ways to do this
Based on Page name/slug WordPress in theme's functions.php
-----... |
104,514 | <p>I have a client with a wordpress theme, <a href="http://themeforest.unitedthemes.com/?theme=nevadawp" rel="nofollow noreferrer">Nevada</a>, and we are having trouble making the built in translations work for it. The theme contains .mo files for English, German, and Slovenian, and appear to be found by our WPML plugi... | [
{
"answer_id": 104533,
"author": "vancoder",
"author_id": 26778,
"author_profile": "https://wordpress.stackexchange.com/users/26778",
"pm_score": 2,
"selected": false,
"text": "<p>Within the code, can you see any syntax like either of the following?</p>\n\n<pre><code>__( 'Hello, dear use... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104514",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34645/"
] | I have a client with a wordpress theme, [Nevada](http://themeforest.unitedthemes.com/?theme=nevadawp), and we are having trouble making the built in translations work for it. The theme contains .mo files for English, German, and Slovenian, and appear to be found by our WPML plugin. However, they are not translating any... | Within the code, can you see any syntax like either of the following?
```
__( 'Hello, dear user!', 'my-text-domain' )
_e( 'Your Ad here', 'my-text-domain' )
```
That is, strings starting with \_\_ (double underscores) or \_e. If so, where the above says my-text-domain, you should find the name of your text domain. |
104,532 | <p>I'm currently displaying a list of all users using the following code. The only problem is that I need to paginate and only display 10 users at a time. I'm familiar with pagination using CPT's and Posts but not with users.</p>
<p>Is this possible? If so where would I start?</p>
<pre><code> <?php
/**
* @pack... | [
{
"answer_id": 104533,
"author": "vancoder",
"author_id": 26778,
"author_profile": "https://wordpress.stackexchange.com/users/26778",
"pm_score": 2,
"selected": false,
"text": "<p>Within the code, can you see any syntax like either of the following?</p>\n\n<pre><code>__( 'Hello, dear use... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104532",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31784/"
] | I'm currently displaying a list of all users using the following code. The only problem is that I need to paginate and only display 10 users at a time. I'm familiar with pagination using CPT's and Posts but not with users.
Is this possible? If so where would I start?
```
<?php
/**
* @package WordPress
* @subpac... | Within the code, can you see any syntax like either of the following?
```
__( 'Hello, dear user!', 'my-text-domain' )
_e( 'Your Ad here', 'my-text-domain' )
```
That is, strings starting with \_\_ (double underscores) or \_e. If so, where the above says my-text-domain, you should find the name of your text domain. |
104,537 | <p>WooCommerce has a simple way to pick "Featured" products by clicking a little star icon in the "Featured" column in the admin area.</p>
<p>I need to be able to filter and show only featured products in the admin area. Does anyone know of a straightforward way to do this?</p>
<p>I did some digging and it turns out ... | [
{
"answer_id": 104541,
"author": "helgatheviking",
"author_id": 6477,
"author_profile": "https://wordpress.stackexchange.com/users/6477",
"pm_score": 4,
"selected": false,
"text": "<p>You can sort your products list by the featured status. Just click on the star at the top of the column... | 2013/06/27 | [
"https://wordpress.stackexchange.com/questions/104537",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15190/"
] | WooCommerce has a simple way to pick "Featured" products by clicking a little star icon in the "Featured" column in the admin area.
I need to be able to filter and show only featured products in the admin area. Does anyone know of a straightforward way to do this?
I did some digging and it turns out this is done with... | I found this plugin: <https://wordpress.stackexchange.com/a/45447/15190>, which I was able to customize to provide a select list to filter by Featured product. With that, I am able to then use WooCommerce's Sort Products drag and drop feature to easily change the order that Featured products appear in the Featured Prod... |
104,550 | <p>I am creating a shortcode plugin for Bootstrap framework that will go along with my theme. However since this would be released to the plugin, if a users's theme already has Bootstrap.css included, is there a way for me to check this from a plugin?</p>
| [
{
"answer_id": 104552,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 3,
"selected": false,
"text": "<p>There's no bulletproof way of doing this, as a theme developer could add the <code>bootstrap.css</code> file direc... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104550",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18389/"
] | I am creating a shortcode plugin for Bootstrap framework that will go along with my theme. However since this would be released to the plugin, if a users's theme already has Bootstrap.css included, is there a way for me to check this from a plugin? | You *might* be able to use [`wp_style_is()`](http://codex.wordpress.org/Function_Reference/wp_style_is) to do this:
```
$style = 'bootstrap';
if( ( ! wp_style_is( $style, 'queue' ) ) && ( ! wp_style_is( $style, 'done' ) ) ) {
//queue up your bootstrap
wp_enqueue_style( $style, $path_to_bootstrap, $deps, $ver, ... |
104,570 | <p>In the index.php template I want to display posts in 3columns in a table format. How can I do this? I don't want a list format cause I have variable hight image sizes</p>
| [
{
"answer_id": 104588,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": true,
"text": "<p>You still can use lists - just use proper CSS (every third li - first li in every row - should have <c... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104570",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17971/"
] | In the index.php template I want to display posts in 3columns in a table format. How can I do this? I don't want a list format cause I have variable hight image sizes | You still can use lists - just use proper CSS (every third li - first li in every row - should have `clear` property set; You can use CSS classes or :nth-child selector to do this).
If you really have to use table (I don't suggest it - it's not a very good idea, because it's not semantic), you can do something like th... |
104,574 | <p>I've recently had a lot of help creating an upcoming events list (see here <a href="https://stackoverflow.com/questions/17343615/showing-upcoming-events-including-todays-event">Showing upcoming events including todays event - StackOverflow</a>), as a result my pagination using <code>wp_pagenavi()</code> is broken.</... | [
{
"answer_id": 104588,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": true,
"text": "<p>You still can use lists - just use proper CSS (every third li - first li in every row - should have <c... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104574",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4588/"
] | I've recently had a lot of help creating an upcoming events list (see here [Showing upcoming events including todays event - StackOverflow](https://stackoverflow.com/questions/17343615/showing-upcoming-events-including-todays-event)), as a result my pagination using `wp_pagenavi()` is broken.
At the moment, when you c... | You still can use lists - just use proper CSS (every third li - first li in every row - should have `clear` property set; You can use CSS classes or :nth-child selector to do this).
If you really have to use table (I don't suggest it - it's not a very good idea, because it's not semantic), you can do something like th... |
104,586 | <p>I want to change my page template automatically when someone selects a specific post parent.</p>
<p>I have the code to update the template but couldn't find anything for detection of post parent attribute changes. Can you help?</p>
| [
{
"answer_id": 104594,
"author": "Rush",
"author_id": 34674,
"author_profile": "https://wordpress.stackexchange.com/users/34674",
"pm_score": 0,
"selected": false,
"text": "<p>Using MySQL you can do;</p>\n\n<pre><code>$result= $wpdb->get_row(\"select post_parent from wp_posts where ID... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104586",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34672/"
] | I want to change my page template automatically when someone selects a specific post parent.
I have the code to update the template but couldn't find anything for detection of post parent attribute changes. Can you help? | This is how you do it...
```
function update_post_template($post_id, $post){
//set $post_parent_id however you wish
if ($post->post_parent == $post_parent_id) {
//unhook save_post action to avoid infinite loop
remove_action('save_post', 'update_post_template');
//change template
... |
104,605 | <p>I have to convert the image path to lowercase characters inside wp_posts table. </p>
<p>Right now, I have inside my posts this:</p>
<pre><code><img class="alignleft" title="my image title" alt="my image alt" src="http://www.mydomain.com/wp-content/uploads/2012/09/My-Image-Lowercase-First-Char.jpg" width="75" he... | [
{
"answer_id": 104609,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>I guess, you can use one of these plugins:\n 1. <a href=\"http://wordpress.org/plugins/search-and-rep... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104605",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18693/"
] | I have to convert the image path to lowercase characters inside wp\_posts table.
Right now, I have inside my posts this:
```
<img class="alignleft" title="my image title" alt="my image alt" src="http://www.mydomain.com/wp-content/uploads/2012/09/My-Image-Lowercase-First-Char.jpg" width="75" height="75" />
```
And ... | Changing the case of the paths without changing the file names themselves could break your links, depending on the server and its configuration.
But to get to the question directly, you *may* be able to do this with SQL using [MySQL's `REPLACE` and `LOWER`](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html... |
104,619 | <p>If I have this URL for my custom taxonomy term <code>http://example.com/work_type/vehicle-transporting/</code> how can I show it as the main page <code>http://example.com/</code> like it is available to do for the static pages at <code>Setings</code> > <code>Reading</code> menu? </p>
<p><code>.htaccess</code> solut... | [
{
"answer_id": 104623,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 1,
"selected": false,
"text": "<p><strong>Solution 1.</strong></p>\n\n<p>One solution would be to use <code>home.php</code> template fi... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104619",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25831/"
] | If I have this URL for my custom taxonomy term `http://example.com/work_type/vehicle-transporting/` how can I show it as the main page `http://example.com/` like it is available to do for the static pages at `Setings` > `Reading` menu?
`.htaccess` solutions are acceptable, changing theme's `index.php` is not.
Update... | I agree with @KrzysiekDróżdż While you should probably be able to do this it might be unnecessary work.
However, this works with I test it, just change the category/term name and the template name (the part in `get_template_part`), and maybe the `is_main_query() && $qry->is_home()` conditional if you need to:
```
fun... |
104,648 | <p>I have a blog page at: mysite.com/blog. On this page I have this loop:</p>
<pre><code><?php
$args = array (
'pagination' => true,
'paged' => 'pages',
'posts_per_page' => '5',
'ignore_sticky_posts' => true
);
?>
<?php $query = new WP_Query( $arg... | [
{
"answer_id": 104637,
"author": "Lucas Kauffman",
"author_id": 13688,
"author_profile": "https://wordpress.stackexchange.com/users/13688",
"pm_score": -1,
"selected": false,
"text": "<p>Sure, all you need to do is change your web server's configuration to point <code>www.mysite.com</cod... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104648",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16042/"
] | I have a blog page at: mysite.com/blog. On this page I have this loop:
```
<?php
$args = array (
'pagination' => true,
'paged' => 'pages',
'posts_per_page' => '5',
'ignore_sticky_posts' => true
);
?>
<?php $query = new WP_Query( $args ); ?>
<?php if($query->have_post... | You should be able to export `www.mysite.com/anothersite` to a WXR file using **Tools » Export** in your WordPress backend -- `www.mysite.com/anothersite/wp-admin`. Then you can go to `www.mysite.com/wp-admin`, remove the existing content (delete your existing posts / pages / etc -- export them first if you want/need a... |
104,657 | <p>I want to add dynamic CSS, so currently I am adding directly to the div, ie:</p>
<pre><code>$color = "#000000";
echo '<div style="background:'.$color.'">
</code></pre>
<p>Is it bad to add code like above?</p>
<p>I have read in some forum that it adds server burden and it is not recommended by WordPress codi... | [
{
"answer_id": 104659,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 3,
"selected": false,
"text": "<p>Try this:</p>\n\n<h1>Using query conditionals</h1>\n\n<p>Putting style enqueueing directly in the template is n... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104657",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34701/"
] | I want to add dynamic CSS, so currently I am adding directly to the div, ie:
```
$color = "#000000";
echo '<div style="background:'.$color.'">
```
Is it bad to add code like above?
I have read in some forum that it adds server burden and it is not recommended by WordPress coding standards. I should use `wp_add_inli... | Try this:
Using query conditionals
========================
Putting style enqueueing directly in the template is not advisable. It is possible (if you understand the order that relevant actions fire, and ensure that your call to `wp_add_inline_style()` happens at the right point in the execution order). It is far eas... |
104,667 | <p>I want to remove the site-name from title post and used All in One SEO and this is the configuration </p>
<p><img src="https://i.stack.imgur.com/yJ5dK.png" alt="enter image description here"></p>
<p>but in Google search the site name display in all title post ( as this )</p>
<p><img src="https://i.stack.imgur.com... | [
{
"answer_id": 104674,
"author": "JMau",
"author_id": 31376,
"author_profile": "https://wordpress.stackexchange.com/users/31376",
"pm_score": 3,
"selected": false,
"text": "<p>Check your theme (<code>header.php</code>). If it uses something like this :</p>\n\n<pre><code><title><... | 2013/06/28 | [
"https://wordpress.stackexchange.com/questions/104667",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27653/"
] | I want to remove the site-name from title post and used All in One SEO and this is the configuration

but in Google search the site name display in all title post ( as this )

How... | Check your theme (`header.php`). If it uses something like this :
```
<title><?php wp_title( '|', true, 'right' ); ?></title>
```
You can use this filter :
```
add_filter( 'wp_title', 'wpse104667_wp_title' );
function wpse104667_wp_title( $title ) {
global $post;
if(
is_singular()
&& !is_fro... |
104,677 | <p>I manage a blog which consists of about 25 writers. Sometimes a few of them are in the process of writing a new post at once, and they end up publishing them too close to each other.</p>
<p>Is there a way to prevent this from happening? Something to say "Another post just went live within the last 5 minutes. You'll... | [
{
"answer_id": 104738,
"author": "Coen Jacobs",
"author_id": 1763,
"author_profile": "https://wordpress.stackexchange.com/users/1763",
"pm_score": 0,
"selected": false,
"text": "<p>There is a plugin in the repository named <a href=\"http://wordpress.org/plugins/auto-future-date/\" rel=\"... | 2013/06/29 | [
"https://wordpress.stackexchange.com/questions/104677",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/30841/"
] | I manage a blog which consists of about 25 writers. Sometimes a few of them are in the process of writing a new post at once, and they end up publishing them too close to each other.
Is there a way to prevent this from happening? Something to say "Another post just went live within the last 5 minutes. You'll need to w... | Here is a very rough block of code that should get you started. What it does is look for the most recent "future" or "publish" post and if that value is less than 1 hour different from the latest scheduled post, it schedules the current post to one hour plus the "most recent" time found.
```
function force_time_betwee... |
104,682 | <p>I created a child theme of twentytwelve using the following in style.css:</p>
<pre><code>/*
Theme Name: WAMSA
Template: twentytwelve
version: 0.1
*/
@import url("../twentytwelve/style.css");
</code></pre>
<p>In Appearance > Theme, the template is listed with error:</p>
<blockquote>
<p>The following themes are ... | [
{
"answer_id": 106507,
"author": "Steve",
"author_id": 3206,
"author_profile": "https://wordpress.stackexchange.com/users/3206",
"pm_score": 3,
"selected": true,
"text": "<p>I found the problem.</p>\n\n<p>I went to edit the stylesheet in Wordpress's editor, and saw that the stylesheet's ... | 2013/06/29 | [
"https://wordpress.stackexchange.com/questions/104682",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3206/"
] | I created a child theme of twentytwelve using the following in style.css:
```
/*
Theme Name: WAMSA
Template: twentytwelve
version: 0.1
*/
@import url("../twentytwelve/style.css");
```
In Appearance > Theme, the template is listed with error:
>
> The following themes are installed but incomplete. Themes must have ... | I found the problem.
I went to edit the stylesheet in Wordpress's editor, and saw that the stylesheet's code had been moved onto 1 line. This meant the top comment section was also on one line, and the `Template: twentytwelve` was not distinct.
Adding line breaks resolved the problem. |
104,725 | <p>I am trying to create single page theme. </p>
<p>What i have trouble with is understanding this whole wordpress query logic.</p>
<p>There is query object and supposedly i get all published posts like this:</p>
<pre><code>$query = new WP_Query( array (
'orderby' => 'menu_order',
'order' => 'ASC',
... | [
{
"answer_id": 104729,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 3,
"selected": true,
"text": "<p>WordPress queries are indeed represented by <code>WP_Query</code> objects. The snippet example you have is <em>secon... | 2013/06/29 | [
"https://wordpress.stackexchange.com/questions/104725",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12007/"
] | I am trying to create single page theme.
What i have trouble with is understanding this whole wordpress query logic.
There is query object and supposedly i get all published posts like this:
```
$query = new WP_Query( array (
'orderby' => 'menu_order',
'order' => 'ASC',
'post_type' => array( 'page' )... | WordPress queries are indeed represented by `WP_Query` objects. The snippet example you have is *secondary* query, as opposed to *main query* - which is run by WP itself during core load and stored in global `$wp_query` variable.
Typically it is better (for performance and compatibility) to modify main query for set o... |
104,728 | <p>I'm building a contactform that needs to send all queries to the admin mail adress.</p>
<p>The php file which processes the entered data and sends the email has only contains this code:</p>
<pre><code><?php
$admin_email = get_option('admin_email');
if($_POST["name"] != "" && $_POST["contact"] != "" &a... | [
{
"answer_id": 104731,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": true,
"text": "<p>Merely having a file in the theme folder does not mean that WordPress will load the file, or that when access... | 2013/06/29 | [
"https://wordpress.stackexchange.com/questions/104728",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33143/"
] | I'm building a contactform that needs to send all queries to the admin mail adress.
The php file which processes the entered data and sends the email has only contains this code:
```
<?php
$admin_email = get_option('admin_email');
if($_POST["name"] != "" && $_POST["contact"] != "" && $_POST["comments"] != "")
{
... | Merely having a file in the theme folder does not mean that WordPress will load the file, or that when accessed the file will be loaded in a WordPress context.
There are two ways to approach this that I can think of:
In order to use WordPress functions WordPress needs to load. The easiest way to do that is to let Wo... |
104,735 | <p>I'm setting a meta field for the category and getting the meta value of each field like this:</p>
<pre><code>$cat_meta = get_option( "meta_field_$cat1" );
if (isset($cat_meta['color'])){
$cat1_color = $cat_meta['color'];
}
</code></pre>
<p>Can I get the non empty meta field value of all categories using a loop... | [
{
"answer_id": 104740,
"author": "Coen Jacobs",
"author_id": 1763,
"author_profile": "https://wordpress.stackexchange.com/users/1763",
"pm_score": 1,
"selected": true,
"text": "<p>If you'd use the <a href=\"http://codex.wordpress.org/Function_Reference/get_categories\" rel=\"nofollow nor... | 2013/06/29 | [
"https://wordpress.stackexchange.com/questions/104735",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34701/"
] | I'm setting a meta field for the category and getting the meta value of each field like this:
```
$cat_meta = get_option( "meta_field_$cat1" );
if (isset($cat_meta['color'])){
$cat1_color = $cat_meta['color'];
}
```
Can I get the non empty meta field value of all categories using a loop? | If you'd use the [get\_categories() function](http://codex.wordpress.org/Function_Reference/get_categories) to get all the categories, you can then loop through them. Partial pseudo code, but this will do the trick:
```
$categories = get_categories( array() );
$colors = array();
foreach ( $categories as $category ) {... |
104,751 | <p>I have been having this issue with my site where some of the scripts that I am putting into the site are not working and others are. The site is fully functional on one setup and fails on another even though it's the same code. I have 4 calls to different scripts in the header of my site. slider, custom animation, p... | [
{
"answer_id": 104753,
"author": "rfrq",
"author_id": 34671,
"author_profile": "https://wordpress.stackexchange.com/users/34671",
"pm_score": -1,
"selected": false,
"text": "<p>Basically WordPress already loads jQuery by default, you don't have to enqueue jQuery from your functions.php. ... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104751",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14761/"
] | I have been having this issue with my site where some of the scripts that I am putting into the site are not working and others are. The site is fully functional on one setup and fails on another even though it's the same code. I have 4 calls to different scripts in the header of my site. slider, custom animation, pagi... | The answer is obvious. The jQuery is loaded in [noConflict](http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers) mode. It means that the global `$` shortcut for jQuery is not available. You have to use closure, like this:
```
(function($) {
$(document).ready(function() {
... |
104,760 | <p>I am using woocommerce at work for equipment requests, therefore all products I will create will need to be £0. Is it possible to set a default value of 0 for the regular price field on the add product form?</p>
<p>Thanks
Jack</p>
| [
{
"answer_id": 104783,
"author": "helgatheviking",
"author_id": 6477,
"author_profile": "https://wordpress.stackexchange.com/users/6477",
"pm_score": 4,
"selected": true,
"text": "<p>You could run a check on the <code>save_post</code> hook, but WooCommerce already has a hook for processi... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104760",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32346/"
] | I am using woocommerce at work for equipment requests, therefore all products I will create will need to be £0. Is it possible to set a default value of 0 for the regular price field on the add product form?
Thanks
Jack | You could run a check on the `save_post` hook, but WooCommerce already has a hook for processing meta where the post type and security checks have already been done. So using their hook, you just check for a null string on the regular price and set it to 0.
```
function wpa104760_default_price( $post_id, $post ) {
... |
104,763 | <p>Yesterday i asked how it would be best to load all existing pages and their content on front page - to create single page layout. (<a href="https://wordpress.stackexchange.com/questions/104725/single-page-theme/104755">Single page theme</a>)</p>
<p>From the info on that page i created my own pre_get_posts hook in f... | [
{
"answer_id": 104765,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": true,
"text": "<p>And why do you think it should do anything else?</p>\n\n<p>What you do is:</p>\n\n<ol>\n<li><p>You add... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104763",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12007/"
] | Yesterday i asked how it would be best to load all existing pages and their content on front page - to create single page layout. ([Single page theme](https://wordpress.stackexchange.com/questions/104725/single-page-theme/104755))
From the info on that page i created my own pre\_get\_posts hook in functions.php:
```
... | And why do you think it should do anything else?
What you do is:
1. You add your filter to modify default WordPress query, which is run on index page. Your modifications are correct - this query will select published root pages.
2. Then you run `get_posts` with default set of params (see below) and loop through them.... |
104,766 | <p>Is there a plugin available? Or suggestions on how to achieve re-ordering automatically and randomly custom post type?</p>
| [
{
"answer_id": 104775,
"author": "JMau",
"author_id": 31376,
"author_profile": "https://wordpress.stackexchange.com/users/31376",
"pm_score": 0,
"selected": false,
"text": "<p>I guess it's just about displaying randomly cpt with a query :</p>\n\n<pre><code><?php\n$args = array(\n ... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104766",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34742/"
] | Is there a plugin available? Or suggestions on how to achieve re-ordering automatically and randomly custom post type? | Or the `pre_get_posts` approach for the CPT archive.... which is more efficient since you don't query twice.
```
function wpa104766_randomize_cpt( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_post_type_archive( 'movie' ) ) {
// Display custom post type called 'movi... |
104,782 | <p>I am using the code below to count the number of comments by a certain user:</p>
<pre><code>global $wpdb;
$count = $wpdb->get_var(
'SELECT COUNT( comment_id ) FROM '. $wpdb->comments .'
WHERE user_id = '.$user->ID.'
AND comment_approved = "1"
AND comment_typ... | [
{
"answer_id": 104787,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>Your basic question is a pure SQL question.</p>\n\n<pre><code>$count = $wpdb->get_var(\n 'SELECT COUNT( c... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104782",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16048/"
] | I am using the code below to count the number of comments by a certain user:
```
global $wpdb;
$count = $wpdb->get_var(
'SELECT COUNT( comment_id ) FROM '. $wpdb->comments .'
WHERE user_id = '.$user->ID.'
AND comment_approved = "1"
AND comment_type NOT IN ("pingback", "... | Your basic question is a pure SQL question.
```
$count = $wpdb->get_var(
'SELECT COUNT( comments.comment_ID ) FROM '. $wpdb->comments .' as comments
LEFT JOIN '.$wpdb->commentmeta.' AS cmeta ON comments.comment_ID = cmeta.comment_id
WHERE user_id = 1
AND comment_approved = "1"
AND comment_type NOT IN ("pingb... |
104,784 | <p>Please See Attached Image Below In Comment</p>
<p>I am using a table to display content on my page.</p>
<p>I am using the twenty eleven theme. I would like to limit the number of rows on the page. i created a custom sidebar template for the page. anyone have any idea how i can limit the number of rows to 20 rows p... | [
{
"answer_id": 104788,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 2,
"selected": false,
"text": "<p>If you're inserting html directly into the content area, create a separate table for each page and use the <a href... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104784",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34714/"
] | Please See Attached Image Below In Comment
I am using a table to display content on my page.
I am using the twenty eleven theme. I would like to limit the number of rows on the page. i created a custom sidebar template for the page. anyone have any idea how i can limit the number of rows to 20 rows per page and anyth... | If you're inserting html directly into the content area, create a separate table for each page and use the [`<!--nextpage-->` quicktag](http://codex.wordpress.org/Write_Post_SubPanel#Quicktags) to separate pages. |
104,808 | <p>How do I hide my super admin from the users list?
My client has to be the ability to create users, but not edit/see my super admin user.
Is that possible?</p>
| [
{
"answer_id": 104820,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>This should help you, I guess (only make sure you're hiding proper user):</p>\n\n<p><a href=\"https:/... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104808",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34641/"
] | How do I hide my super admin from the users list?
My client has to be the ability to create users, but not edit/see my super admin user.
Is that possible? | I would recommend the following:
The Editor user role in WordPress cannot by default edit users. You may want to add that capability for clients whom you keep as 'Editors'. This will let the Editor add new users (create new users), delete users, and edit users. This is done by adding capabilities to the Editor role wi... |
104,815 | <p>Hi i'm using this code below, which links the title of the post to the first attachment in the post. But how do I change it so that it grabs the thumbnail instead?</p>
<pre><code><?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'offset' => 0,
'orderby' => 'menu_order',
'order'... | [
{
"answer_id": 104819,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>If you want title to link to post thumbnail instead of first attachment, then something like this sho... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104815",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32447/"
] | Hi i'm using this code below, which links the title of the post to the first attachment in the post. But how do I change it so that it grabs the thumbnail instead?
```
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'offset' => 0,
'orderby' => 'menu_order',
'order' => 'asc',
'post_status' => n... | I can't tell if you want a link to the thumbnail or you want the image to be the thumbnail.
To get the image assigned to the post as the thumbnail image, use [`get_the_post_thumbnail`](http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail):
```
$thumb = get_the_post_thumbnail($post_id, 'thumbnail');
... |
104,818 | <p>I just found this reference of WP Customizer types of data input: <a href="https://gist.github.com/Abban/2968549" rel="nofollow">https://gist.github.com/Abban/2968549</a></p>
<p>But I wonder if there's an option to have for instance a range slider? Something that would allow users to pick a value between <code>50px... | [
{
"answer_id": 104819,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>If you want title to link to post thumbnail instead of first attachment, then something like this sho... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104818",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17167/"
] | I just found this reference of WP Customizer types of data input: <https://gist.github.com/Abban/2968549>
But I wonder if there's an option to have for instance a range slider? Something that would allow users to pick a value between `50px` and `200px` or between `1em` and `2em`? Ideally it should also allow switching... | I can't tell if you want a link to the thumbnail or you want the image to be the thumbnail.
To get the image assigned to the post as the thumbnail image, use [`get_the_post_thumbnail`](http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail):
```
$thumb = get_the_post_thumbnail($post_id, 'thumbnail');
... |
104,838 | <p>Usually I use this method to test whether a plugin is active (usually my own).</p>
<p>This would be in the plugin I'm checking for:</p>
<pre><code>function my_plugin_setup() {
// setup code here
}
add_action( 'plugins_loaded', 'my_plugin_setup' );
</code></pre>
<p>From another file or plugin I would use <code... | [
{
"answer_id": 105132,
"author": "Weston Ruter",
"author_id": 8521,
"author_profile": "https://wordpress.stackexchange.com/users/8521",
"pm_score": 1,
"selected": false,
"text": "<p>To do literally what you're wanting here, the easiest way is to store the instance of the plugin class in ... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104838",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4999/"
] | Usually I use this method to test whether a plugin is active (usually my own).
This would be in the plugin I'm checking for:
```
function my_plugin_setup() {
// setup code here
}
add_action( 'plugins_loaded', 'my_plugin_setup' );
```
From another file or plugin I would use `has_filter` on the function which is ... | To do literally what you're wanting here, the easiest way is to store the instance of the plugin class in a global variable at the end of your plugin:
```
class My_Plugin {
static $instance;
function __construct(){} /* or private, with singleton get_instance() method */
function setup(){ ... }
}
$my_plugin... |
104,839 | <p>I have problem in my first theme design, and I think you can help me easily!(I searched my problem several times in Google and WordPress codex but I cant find exactly that I want!!)</p>
<p>I want to displaying my "<strong>yesterday</strong>'s last post's Custom filed, from Unique terms of one Taxonomies" in a cell ... | [
{
"answer_id": 105132,
"author": "Weston Ruter",
"author_id": 8521,
"author_profile": "https://wordpress.stackexchange.com/users/8521",
"pm_score": 1,
"selected": false,
"text": "<p>To do literally what you're wanting here, the easiest way is to store the instance of the plugin class in ... | 2013/06/30 | [
"https://wordpress.stackexchange.com/questions/104839",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34760/"
] | I have problem in my first theme design, and I think you can help me easily!(I searched my problem several times in Google and WordPress codex but I cant find exactly that I want!!)
I want to displaying my "**yesterday**'s last post's Custom filed, from Unique terms of one Taxonomies" in a cell of table!
In another c... | To do literally what you're wanting here, the easiest way is to store the instance of the plugin class in a global variable at the end of your plugin:
```
class My_Plugin {
static $instance;
function __construct(){} /* or private, with singleton get_instance() method */
function setup(){ ... }
}
$my_plugin... |
104,858 | <p>Problem with the nonce field. Trying to figure out why the meta box won't display the saved field after page refresh, i.e. enter code in code field. Hit save. The code just entered does not reappear in the code field. Thank you.</p>
<p>Here is the code I'm using: </p>
<pre><code>$meta_box_code = array(
'id' ... | [
{
"answer_id": 105132,
"author": "Weston Ruter",
"author_id": 8521,
"author_profile": "https://wordpress.stackexchange.com/users/8521",
"pm_score": 1,
"selected": false,
"text": "<p>To do literally what you're wanting here, the easiest way is to store the instance of the plugin class in ... | 2013/07/01 | [
"https://wordpress.stackexchange.com/questions/104858",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | Problem with the nonce field. Trying to figure out why the meta box won't display the saved field after page refresh, i.e. enter code in code field. Hit save. The code just entered does not reappear in the code field. Thank you.
Here is the code I'm using:
```
$meta_box_code = array(
'id' => 'id-meta-box-c... | To do literally what you're wanting here, the easiest way is to store the instance of the plugin class in a global variable at the end of your plugin:
```
class My_Plugin {
static $instance;
function __construct(){} /* or private, with singleton get_instance() method */
function setup(){ ... }
}
$my_plugin... |
104,896 | <p><em>Original Question:</em></p>
<p>I'm trying to add an input field to 'Pages > Edit Page'. The use of this input field will be for a user to add an ID of a slider, so that that slider will be page specific.</p>
<p>Example:</p>
<ul>
<li>User adds slide ID to input field on Edit Page screen.</li>
<li>Page pulls in... | [
{
"answer_id": 104898,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 1,
"selected": false,
"text": "<p>First of all, you should use custom fields, if you want to assign some additional value to post/page ... | 2013/07/01 | [
"https://wordpress.stackexchange.com/questions/104896",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34380/"
] | *Original Question:*
I'm trying to add an input field to 'Pages > Edit Page'. The use of this input field will be for a user to add an ID of a slider, so that that slider will be page specific.
Example:
* User adds slide ID to input field on Edit Page screen.
* Page pulls in that ID.
---
Thank you to all of you wh... | **functions.php**
```
// Add custom Slider ID field to 'Edit Page'
add_action( 'add_meta_boxes', 'cd_meta_box_add' );
function cd_meta_box_add() {
add_meta_box( 'my-meta-box-id', 'Slider', 'cd_meta_box_cb', 'page', 'normal', 'high' );
}
function cd_meta_box_cb( $post ) {
$values = get_post_custom( $post->ID );... |
104,911 | <p><strong>Overview:</strong><br>
On my site I want to do a customer area. There is a form where the visitor enters a name (e.g. "event_xyz") and a password. Only some well informed circles (participants of the event xyz who want to download some files) will know the access data.
By submitting, the visitor is redirecte... | [
{
"answer_id": 104912,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": false,
"text": "<p>You will need to hook that code so that it runs before any data is sent to the browser. </p>\n\n<pre><code>f... | 2013/07/01 | [
"https://wordpress.stackexchange.com/questions/104911",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34790/"
] | **Overview:**
On my site I want to do a customer area. There is a form where the visitor enters a name (e.g. "event\_xyz") and a password. Only some well informed circles (participants of the event xyz who want to download some files) will know the access data.
By submitting, the visitor is redirected to a pp-redire... | Finally, I found the solution:
*form.php*
```
<form action="<?php echo bloginfo('template_directory'); ?>/pp-redirect.php" method="post">
Event: <input name="event" type="text" size="25" /><br />
Passwort: <input name="post_password" type="password" size="25" /><br />
<input name="submit" type="submit" value="Los" />... |
104,927 | <p>For example, <code>http://example.com/?cat=6&tag=books</code> lists posts that belong to category ID 6 and tagged 'books' (i.e. posts that satisfy both conditions).</p>
<p>Similarly, <code>http://example.com/feed/?cat=6&tag=books</code> does the same for feeds.</p>
<p>Now, lets say that my blog has a custo... | [
{
"answer_id": 105253,
"author": "Greeso",
"author_id": 34253,
"author_profile": "https://wordpress.stackexchange.com/users/34253",
"pm_score": -1,
"selected": false,
"text": "<p>You may have to look into using wp_query. in which you set your own query to display any category you like, a... | 2013/07/01 | [
"https://wordpress.stackexchange.com/questions/104927",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10691/"
] | For example, `http://example.com/?cat=6&tag=books` lists posts that belong to category ID 6 and tagged 'books' (i.e. posts that satisfy both conditions).
Similarly, `http://example.com/feed/?cat=6&tag=books` does the same for feeds.
Now, lets say that my blog has a custom taxonomy called 'edition', with terms 'usa', ... | In general circumstances, using URL parameters, you can list posts that belong to a specific category AND a custom taxonomy, like this:
```
http://example.com/category/cars/?edition=usa
```
Where, `category` is the Category base you are using for categories on your site (WordPress Dashboard > Settings > Permalinks >... |
104,938 | <p>I'm using the <a href="http://wordpress.org/plugins/widget-logic/" rel="nofollow">Widget Logic plugin</a> to show widgets on certain pages using Wordpress Conditional Tags (or any general PHP code).</p>
<p>What I would like to do is only show a widget on child pages, not top level pages. I tried both of the followi... | [
{
"answer_id": 105253,
"author": "Greeso",
"author_id": 34253,
"author_profile": "https://wordpress.stackexchange.com/users/34253",
"pm_score": -1,
"selected": false,
"text": "<p>You may have to look into using wp_query. in which you set your own query to display any category you like, a... | 2013/07/01 | [
"https://wordpress.stackexchange.com/questions/104938",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/15621/"
] | I'm using the [Widget Logic plugin](http://wordpress.org/plugins/widget-logic/) to show widgets on certain pages using Wordpress Conditional Tags (or any general PHP code).
What I would like to do is only show a widget on child pages, not top level pages. I tried both of the following but they both return true on all ... | In general circumstances, using URL parameters, you can list posts that belong to a specific category AND a custom taxonomy, like this:
```
http://example.com/category/cars/?edition=usa
```
Where, `category` is the Category base you are using for categories on your site (WordPress Dashboard > Settings > Permalinks >... |
104,945 | <p>I created a custom menu with dropdowns. (just CSS no JavaScript).<br>
I also added a custom CSS class for the first menu item.</p>
<p>So far so good.</p>
<p>The point were I get stuck is adding a custom dropdown only for the first menu item which is different from the other item dropdowns. Also I would like to set... | [
{
"answer_id": 143311,
"author": "Musa Haidari",
"author_id": 49445,
"author_profile": "https://wordpress.stackexchange.com/users/49445",
"pm_score": 0,
"selected": false,
"text": "<p>This question has been <a href=\"https://wordpress.stackexchange.com/questions/66498/add-menu-page-with-... | 2013/07/01 | [
"https://wordpress.stackexchange.com/questions/104945",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34805/"
] | I created a custom menu with dropdowns. (just CSS no JavaScript).
I also added a custom CSS class for the first menu item.
So far so good.
The point were I get stuck is adding a custom dropdown only for the first menu item which is different from the other item dropdowns. Also I would like to set a different has-c... | Well, the answer depends on what you mean by "custom dropdown only for the first menu item which is different from the other item dropdowns" - different how? If it's just stylistic, that extra class should be enough. You just have to make sure the css for it is specific enough to override the defaults. So if your css s... |
104,961 | <p>I'm using a plugin called <a href="http://wordpress.org/plugins/float-left-right-advertising/" rel="nofollow">Float Left Right Advertising</a> however I don't want to work on the homepage.</p>
<p>I tried adding this code into the functions.php but it doesn't work:</p>
<pre><code>add_action( 'float_left_right_adver... | [
{
"answer_id": 104954,
"author": "Wyck",
"author_id": 1509,
"author_profile": "https://wordpress.stackexchange.com/users/1509",
"pm_score": 2,
"selected": false,
"text": "<p>Most SSL issues are due to plugins/themes using the wrong code to load CSS/JS. </p>\n\n<ul>\n<li><p>Under WordPres... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/104961",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34813/"
] | I'm using a plugin called [Float Left Right Advertising](http://wordpress.org/plugins/float-left-right-advertising/) however I don't want to work on the homepage.
I tried adding this code into the functions.php but it doesn't work:
```
add_action( 'float_left_right_advertising' );
function float_left_right_advertis... | We found a solution and it appears to be purely environmental as in a problem in how our environments were setup. As it happens, our MySQL server and our actual server were not on the same box and wordpress needs to explicitly know the difference between request routed to the MySQL box and the box containing the actual... |
104,968 | <p>Before asking question here I want to tell that I have already asked the question in stackoverflow and wordpress forum but have not got any answer. So finally I came here.</p>
<p>I have installed the <a href="http://wordpress.org/plugins/woocommerce/" rel="noreferrer">woocommerce plugin</a> in my <a href="http://wo... | [
{
"answer_id": 104972,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 4,
"selected": true,
"text": "<p>The cart widget isn't showing because it's configured to not show on the <code>cart and checkout pag... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/104968",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27905/"
] | Before asking question here I want to tell that I have already asked the question in stackoverflow and wordpress forum but have not got any answer. So finally I came here.
I have installed the [woocommerce plugin](http://wordpress.org/plugins/woocommerce/) in my [wordpress 3.5.2.](http://wordpress.org/) Everything is ... | The cart widget isn't showing because it's configured to not show on the `cart and checkout page`. If you want to change that take a look at `class-wc-widget-cart.php`, there you find the following line:
```
if ( is_cart() || is_checkout() ) return;
```
Change it to:
```
if ( is_cart() ) return;
```
To show t... |
104,973 | <p>when I load the default jquery-ui-autocomplete script from wordpress via </p>
<pre><code>wp_enqueue_script( 'jquery-ui-autocomplete', '', array( 'jquery-ui-widget', 'jquery-ui-position' ), '1.8.6' );
</code></pre>
<p>it is embedded, and all works fine, except the annoying notice message in debug mode:</p>
<blockq... | [
{
"answer_id": 104980,
"author": "RRikesh",
"author_id": 17305,
"author_profile": "https://wordpress.stackexchange.com/users/17305",
"pm_score": 2,
"selected": false,
"text": "<p>Are you sure it is not loading? I tried this(using WordPress 3.6-beta1):</p>\n\n<pre><code>function add_scrip... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/104973",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12614/"
] | when I load the default jquery-ui-autocomplete script from wordpress via
```
wp_enqueue_script( 'jquery-ui-autocomplete', '', array( 'jquery-ui-widget', 'jquery-ui-position' ), '1.8.6' );
```
it is embedded, and all works fine, except the annoying notice message in debug mode:
>
> Notice: wp\_enqueue\_script was ... | Are you sure it is not loading? I tried this(using WordPress 3.6-beta1):
```
function add_scripts(){
wp_enqueue_script( 'jquery-ui-autocomplete' );
}
add_action('wp_enqueue_scripts', 'add_scripts');
```
I got jQuery and jQuery migrate in the header:
```
<script type='text/javascript' src='http://localhost/wordpre... |
104,986 | <p>My users can link to things that don't exist on the page. That's something I chose because it is the best option for my concept. Anyway, what I want to do is this... Let's say I clicked on a link that should link to the post "Hello World", but as said, this post does not exist...</p>
<p><strong>What I want to do is... | [
{
"answer_id": 104980,
"author": "RRikesh",
"author_id": 17305,
"author_profile": "https://wordpress.stackexchange.com/users/17305",
"pm_score": 2,
"selected": false,
"text": "<p>Are you sure it is not loading? I tried this(using WordPress 3.6-beta1):</p>\n\n<pre><code>function add_scrip... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/104986",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32731/"
] | My users can link to things that don't exist on the page. That's something I chose because it is the best option for my concept. Anyway, what I want to do is this... Let's say I clicked on a link that should link to the post "Hello World", but as said, this post does not exist...
**What I want to do is show this post\... | Are you sure it is not loading? I tried this(using WordPress 3.6-beta1):
```
function add_scripts(){
wp_enqueue_script( 'jquery-ui-autocomplete' );
}
add_action('wp_enqueue_scripts', 'add_scripts');
```
I got jQuery and jQuery migrate in the header:
```
<script type='text/javascript' src='http://localhost/wordpre... |
104,991 | <p>On a date archive page when no posts exist (for that date) WordPress throws across to the 404 page.</p>
<p>Is there a way to make WordPress continue to use the original archive instead of the 404. That way I can use <code>if ( have_posts() )</code> condition to output a "No posts found" message.</p>
| [
{
"answer_id": 105002,
"author": "Ben Everard",
"author_id": 29,
"author_profile": "https://wordpress.stackexchange.com/users/29",
"pm_score": 2,
"selected": false,
"text": "<p>Okay, on reflection I'm not sure if I'm asking too much of WP. I guess from an SEO point of view I do want empt... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/104991",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29/"
] | On a date archive page when no posts exist (for that date) WordPress throws across to the 404 page.
Is there a way to make WordPress continue to use the original archive instead of the 404. That way I can use `if ( have_posts() )` condition to output a "No posts found" message. | Okay, on reflection I'm not sure if I'm asking too much of WP. I guess from an SEO point of view I do want empty pages to 404, I certainly don't want them indexed.
I decided instead to use the 404 template to output the "No posts found" message, but because the functions `is_date()`, `is_day()` (et al) will not work o... |
104,995 | <p>i have a little problem: I can not order my events as i wish. I would like to order my upcoming events in ascending order...</p>
<p>I am using the following: </p>
<pre><code>new WP_Query(
array(
'author' => $current_user->ID,
'post_type' =>'tribe_events',
'orderby' => 'meta_va... | [
{
"answer_id": 104996,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>Format of this meta is OK - it should work. I'm not sure what you're doing in this query args, though... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/104995",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31366/"
] | i have a little problem: I can not order my events as i wish. I would like to order my upcoming events in ascending order...
I am using the following:
```
new WP_Query(
array(
'author' => $current_user->ID,
'post_type' =>'tribe_events',
'orderby' => 'meta_value',
'meta_key' => '_Event... | Format of this meta is OK - it should work. I'm not sure what you're doing in this query args, though. You use meta query incorrectly.
If you do it like this, it should work fine:
```
$my_query = new WP_Query(
array(
'author' => $current_user->ID,
'post_type' => 'tribe_events',
'orderby'... |
105,008 | <p>I have created a membership site which is working how I would like in that non-members cannot view private pages.</p>
<p>However, I want that when someone who has not logged in, clicks on a link that links to a private page, they should be directed to my login page.</p>
<p>The closest I can figure out is using pos... | [
{
"answer_id": 105011,
"author": "GhostToast",
"author_id": 13676,
"author_profile": "https://wordpress.stackexchange.com/users/13676",
"pm_score": 0,
"selected": false,
"text": "<p>Try something like this in your header or appropriate template file:</p>\n\n<pre><code>$not_auth_redirect ... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/105008",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31382/"
] | I have created a membership site which is working how I would like in that non-members cannot view private pages.
However, I want that when someone who has not logged in, clicks on a link that links to a private page, they should be directed to my login page.
The closest I can figure out is using post\_password\_requ... | The function you are using-- [`post_password_required`](http://codex.wordpress.org/Function_Reference/post_password_required)-- is true for ***password protected pages***, not for ***private*** pages. I am honestly not sure which you mean, but if you do mean "private" as in most of your description then...
I am not aw... |
105,012 | <p>I've used WordPress before but only through the website. This is the first time I've actually installed WP and I'm loving all of the customization options that are available to me now.</p>
<p>I'm a bit confused about how to actually make my blog accessible to the public though. I'm working through MAMP on Mac OS. U... | [
{
"answer_id": 105011,
"author": "GhostToast",
"author_id": 13676,
"author_profile": "https://wordpress.stackexchange.com/users/13676",
"pm_score": 0,
"selected": false,
"text": "<p>Try something like this in your header or appropriate template file:</p>\n\n<pre><code>$not_auth_redirect ... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/105012",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34827/"
] | I've used WordPress before but only through the website. This is the first time I've actually installed WP and I'm loving all of the customization options that are available to me now.
I'm a bit confused about how to actually make my blog accessible to the public though. I'm working through MAMP on Mac OS. Under wp-ad... | The function you are using-- [`post_password_required`](http://codex.wordpress.org/Function_Reference/post_password_required)-- is true for ***password protected pages***, not for ***private*** pages. I am honestly not sure which you mean, but if you do mean "private" as in most of your description then...
I am not aw... |
105,022 | <p>I have a directory website and am doing a bit of a redesign/restructure. I have quite a few meta fields for each entry, i.e. address, city, country, website, where to buy their products, social links, background and so on.</p>
<p>I don't display all the meta data in the same place in my layout. So my question: Is i... | [
{
"answer_id": 105011,
"author": "GhostToast",
"author_id": 13676,
"author_profile": "https://wordpress.stackexchange.com/users/13676",
"pm_score": 0,
"selected": false,
"text": "<p>Try something like this in your header or appropriate template file:</p>\n\n<pre><code>$not_auth_redirect ... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/105022",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5391/"
] | I have a directory website and am doing a bit of a redesign/restructure. I have quite a few meta fields for each entry, i.e. address, city, country, website, where to buy their products, social links, background and so on.
I don't display all the meta data in the same place in my layout. So my question: Is it more eff... | The function you are using-- [`post_password_required`](http://codex.wordpress.org/Function_Reference/post_password_required)-- is true for ***password protected pages***, not for ***private*** pages. I am honestly not sure which you mean, but if you do mean "private" as in most of your description then...
I am not aw... |
105,049 | <p>I'm trying to add a footer area to wordpress so I can drop widgets and things there. I see my footer area in the admin section, but if I add a text (or any other) widget and then save it, nothing shows up on the footer. If I refresh the page, the widget that I dragged to the right in my footer area is no longer li... | [
{
"answer_id": 105052,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 1,
"selected": false,
"text": "<p>You are using <code>get_sidebar</code> incorrectly. That function <a href=\"http://codex.wordpress.org/Funct... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/105049",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14569/"
] | I'm trying to add a footer area to wordpress so I can drop widgets and things there. I see my footer area in the admin section, but if I add a text (or any other) widget and then save it, nothing shows up on the footer. If I refresh the page, the widget that I dragged to the right in my footer area is no longer listed ... | You are using `get_sidebar` incorrectly. That function ["Includes the sidebar.php template file from your current theme's directory."](http://codex.wordpress.org/Function_Reference/get_sidebar) And if you include a parameter, it loads a file matching that parameter name, not a sidebar of that name.
>
> If a name ($na... |
105,069 | <p>How would I modify the following SQL Query to allow me to search multiple meta keys at once? e.g. user_business AND user_about</p>
<p>In the end I'll be searching about 40 - 50 different meta keys; or if there's an option to search ALL of them, that'd be even better.</p>
<pre><code><?php
/**
* @package WordPre... | [
{
"answer_id": 105090,
"author": "MadtownLems",
"author_id": 16666,
"author_profile": "https://wordpress.stackexchange.com/users/16666",
"pm_score": 2,
"selected": false,
"text": "<p>You'll want to use the 'meta_query' argument of WP_Query ( <a href=\"http://codex.wordpress.org/Class_Ref... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/105069",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31784/"
] | How would I modify the following SQL Query to allow me to search multiple meta keys at once? e.g. user\_business AND user\_about
In the end I'll be searching about 40 - 50 different meta keys; or if there's an option to search ALL of them, that'd be even better.
```
<?php
/**
* @package WordPress
* @subpackage them... | Actually the way I solved this issue was instead of supplying a key name, I left the field blank which returned worked for all meta keys. |
105,088 | <p>I missed the title on custom post types on new or edit page; I have added some custom fields, but Title disappeared.</p>
<pre><code>register_post_type( 'videos', array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'exclude_from_search' =&g... | [
{
"answer_id": 105091,
"author": "JMau",
"author_id": 31376,
"author_profile": "https://wordpress.stackexchange.com/users/31376",
"pm_score": 2,
"selected": false,
"text": "<p>You missed this in your code :</p>\n\n<pre><code>'supports' => array( 'title', 'editor', 'author', 'thumbnail... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/105088",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10218/"
] | I missed the title on custom post types on new or edit page; I have added some custom fields, but Title disappeared.
```
register_post_type( 'videos', array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'exclude_from_search' => true,
'query_var' => t... | By declaring a value for the parameter 'supports', you override the default output which shows the 'title' and 'editor'. <http://codex.wordpress.org/Function_Reference/register_post_type>
I recommend removing the 'supports' parameter if you don't need any other post fields (reduce clutter on the page) or just re-itera... |
105,097 | <p>I created a custom post type and gave it the following capabilities:</p>
<pre><code>add_action( 'init', 'create_team_page_post_type' );
function create_team_page_post_type() {
$args = array(
'labels' => team_page_post_type_labels( 'Team Page' ),
'public' => true,
'publicly_queryable' => true,
... | [
{
"answer_id": 105098,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/register_post_type#Parameters\" rel=\"nofollow\">The... | 2013/07/02 | [
"https://wordpress.stackexchange.com/questions/105097",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34045/"
] | I created a custom post type and gave it the following capabilities:
```
add_action( 'init', 'create_team_page_post_type' );
function create_team_page_post_type() {
$args = array(
'labels' => team_page_post_type_labels( 'Team Page' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
... | You are mixing hyphens and underscores in the cap names you are adding to the administrator role. These don't always correspond to the caps you created. |
105,137 | <p>I'm using <code>wp_nav_menu</code> for a submenu that I only want to display (including the surrounding html) when there are sub-menu items to display.</p>
<p>The problem is, the function is always returning with either the menu items (when it's supposed to), or with an empty list when there's nothing to display. I... | [
{
"answer_id": 105110,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 4,
"selected": true,
"text": "<p>The featured image itself-- the actual <code>.jpg</code>, or <code>.png</code>, most likely-- is saved to <co... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105137",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32155/"
] | I'm using `wp_nav_menu` for a submenu that I only want to display (including the surrounding html) when there are sub-menu items to display.
The problem is, the function is always returning with either the menu items (when it's supposed to), or with an empty list when there's nothing to display. I need it to (and thou... | The featured image itself-- the actual `.jpg`, or `.png`, most likely-- is saved to `wp-content/uploads` with primary image data saved to `$wpdb->posts` as an `attachment` post type. Additional relevant data for the image is saved in `$wpdb->postmeta`.
What makes an image "featured" or not is an entry in `$wpdb->post... |
105,168 | <p>I need to create a search page that will display anything related to the supplied search.
i.e. <code>comments</code> containing it, <code>events</code>, <code>posts</code>, <code>CPT</code>s and <code>users</code> with that name.</p>
<p>How can I search for users in the site who's first or last name contains the sea... | [
{
"answer_id": 105173,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 6,
"selected": true,
"text": "<h2>Searching the main table</h2>\n\n<p>Simply use <a href=\"http://codex.wordpress.org/Class_Reference/WP_User_Query\... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105168",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/395/"
] | I need to create a search page that will display anything related to the supplied search.
i.e. `comments` containing it, `events`, `posts`, `CPT`s and `users` with that name.
How can I search for users in the site who's first or last name contains the search phrase ? | Searching the main table
------------------------
Simply use [`WP_User_Query`](http://codex.wordpress.org/Class_Reference/WP_User_Query) with a search argument.
So if you want to search for example for a user with a keyword in his `user_email` or similar columns from the `{$wpdb->prefix}users` table, then you can do ... |
105,174 | <p>When upgrading our portfolio I'm looking for something that shows the number of posts in a (current) category of a post type.</p>
<p>Example: I have a category with 'features'. Each feature has it's own description, apps related and blog related posts page</p>
<p>I'm fetching the current category with:</p>
<pre><... | [
{
"answer_id": 105175,
"author": "Md Toufiqul Islam",
"author_id": 21268,
"author_profile": "https://wordpress.stackexchange.com/users/21268",
"pm_score": -1,
"selected": false,
"text": "<p>You can have post count from $post variable after query_posts as</p>\n\n<pre><code>query_posts(\"p... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105174",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/20548/"
] | When upgrading our portfolio I'm looking for something that shows the number of posts in a (current) category of a post type.
Example: I have a category with 'features'. Each feature has it's own description, apps related and blog related posts page
I'm fetching the current category with:
```
<?php $cat_id = get_que... | Public API for the rescue
-------------------------
`category` is a Taxonomy that's already built in. Therefore it's quite easy to get its term count with [`get_terms( $tax, array( /* args */ ) );`](http://queryposts.com/function/get_terms/)
```
$terms = get_terms( 'category', array(
'fields' => 'count',
) );
``... |
105,195 | <p>I'm using the free Lensa theme and it seems like it inserts a "more" tag in every single post when viewing by category, and the point at which it inserts it is proportional to the length of the post.</p>
<p><a href="http://daswanderlust.com/blog" rel="nofollow">http://daswanderlust.com/blog</a></p>
<p>That quote i... | [
{
"answer_id": 105175,
"author": "Md Toufiqul Islam",
"author_id": 21268,
"author_profile": "https://wordpress.stackexchange.com/users/21268",
"pm_score": -1,
"selected": false,
"text": "<p>You can have post count from $post variable after query_posts as</p>\n\n<pre><code>query_posts(\"p... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105195",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34827/"
] | I'm using the free Lensa theme and it seems like it inserts a "more" tag in every single post when viewing by category, and the point at which it inserts it is proportional to the length of the post.
<http://daswanderlust.com/blog>
That quote is only about 10 words long but gets truncated after the 6th word or so. I ... | Public API for the rescue
-------------------------
`category` is a Taxonomy that's already built in. Therefore it's quite easy to get its term count with [`get_terms( $tax, array( /* args */ ) );`](http://queryposts.com/function/get_terms/)
```
$terms = get_terms( 'category', array(
'fields' => 'count',
) );
``... |
105,198 | <p>I am a beer distributor and I need site visitors to enter their license # on certain pages but there is no way for me to know all of the licenses in the state. I am currently using the default wordpress password protect page feature in the "Publish" section.</p>
<p>Is there a php file that I can change where instea... | [
{
"answer_id": 105175,
"author": "Md Toufiqul Islam",
"author_id": 21268,
"author_profile": "https://wordpress.stackexchange.com/users/21268",
"pm_score": -1,
"selected": false,
"text": "<p>You can have post count from $post variable after query_posts as</p>\n\n<pre><code>query_posts(\"p... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105198",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34875/"
] | I am a beer distributor and I need site visitors to enter their license # on certain pages but there is no way for me to know all of the licenses in the state. I am currently using the default wordpress password protect page feature in the "Publish" section.
Is there a php file that I can change where instead of havin... | Public API for the rescue
-------------------------
`category` is a Taxonomy that's already built in. Therefore it's quite easy to get its term count with [`get_terms( $tax, array( /* args */ ) );`](http://queryposts.com/function/get_terms/)
```
$terms = get_terms( 'category', array(
'fields' => 'count',
) );
``... |
105,201 | <p>I am currently upgrading my WP to 3.2.1 to 3.5.2, and for one section of my posts it seems like the featured image has disappeared. However, I just checked the the wp_posts table in the database through phpmyadmin and looked for one of my posts that had this issue. My <code>img</code> tags are being produced dynamic... | [
{
"answer_id": 105175,
"author": "Md Toufiqul Islam",
"author_id": 21268,
"author_profile": "https://wordpress.stackexchange.com/users/21268",
"pm_score": -1,
"selected": false,
"text": "<p>You can have post count from $post variable after query_posts as</p>\n\n<pre><code>query_posts(\"p... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105201",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34348/"
] | I am currently upgrading my WP to 3.2.1 to 3.5.2, and for one section of my posts it seems like the featured image has disappeared. However, I just checked the the wp\_posts table in the database through phpmyadmin and looked for one of my posts that had this issue. My `img` tags are being produced dynamically, but the... | Public API for the rescue
-------------------------
`category` is a Taxonomy that's already built in. Therefore it's quite easy to get its term count with [`get_terms( $tax, array( /* args */ ) );`](http://queryposts.com/function/get_terms/)
```
$terms = get_terms( 'category', array(
'fields' => 'count',
) );
``... |
105,205 | <p>I'm trying to get <a href="http://example.com/site/vendors/?u=abc" rel="nofollow">http://example.com/site/vendors/?u=abc</a> to rewrite to <a href="http://example.com/site/vendors/abc" rel="nofollow">http://example.com/site/vendors/abc</a> but I can't for the life of me figure out how to get the url rewrites to work... | [
{
"answer_id": 105216,
"author": "David Kryzaniak",
"author_id": 31548,
"author_profile": "https://wordpress.stackexchange.com/users/31548",
"pm_score": 1,
"selected": false,
"text": "<p>I believe this is what you are looking for:</p>\n\n<pre><code>RewriteRule ^/site/vendors/([^/]*)$ /si... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105205",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31784/"
] | I'm trying to get <http://example.com/site/vendors/?u=abc> to rewrite to <http://example.com/site/vendors/abc> but I can't for the life of me figure out how to get the url rewrites to work.
/site/ is the root directory for my WP installation
/vendors/ is a page | assuming `u` is a custom query var, you have to first add it to the array of recognized query vars:
```
function wpa_query_vars( $query_vars ){
$query_vars[] = 'u';
return $query_vars;
}
add_filter('query_vars', 'wpa_query_vars');
```
Then add an internal rewrite rule that accepts anything appended to `vendo... |
105,210 | <p>My blog is photo-oriented and the theme has a special excerpt function that, for better or for worse, I'd like to keep using. Anyway, it displays the excerpt and then the "More", but it just completely cuts of the excerpt, which I think looks a bit odd, especially mid sentence. </p>
<p>Not really sure what kind of ... | [
{
"answer_id": 105212,
"author": "Austin Biggs",
"author_id": 31784,
"author_profile": "https://wordpress.stackexchange.com/users/31784",
"pm_score": 1,
"selected": true,
"text": "<p>I have a custom except function I use all the time, it will cut off in the middle of a sentence, but it w... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105210",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34827/"
] | My blog is photo-oriented and the theme has a special excerpt function that, for better or for worse, I'd like to keep using. Anyway, it displays the excerpt and then the "More", but it just completely cuts of the excerpt, which I think looks a bit odd, especially mid sentence.
Not really sure what kind of change has... | I have a custom except function I use all the time, it will cut off in the middle of a sentence, but it works great. Just drop this baby into your functions.php and then `<?php the_excerpt_truncate(100); ?>` just change the 100 to your desired character limit.
```
// THE EXCERPT MAX CHAR
function the_excerpt_truncate... |
105,217 | <p>I'm trying to create an advanced, reusable query function.</p>
<p>I need to query by category OR a category + a tag.</p>
<p>I know how to do this with custom fields (meta queries) but how do I do it with simple categories and tags?</p>
<p>A pseudo SQL Query would be:</p>
<pre><code>Select * from Posts where ( ca... | [
{
"answer_id": 105221,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": false,
"text": "<p>I am not 100% sure what you are asking but as written that is going to be wrong. <code>tax_query</code> is ... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105217",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14862/"
] | I'm trying to create an advanced, reusable query function.
I need to query by category OR a category + a tag.
I know how to do this with custom fields (meta queries) but how do I do it with simple categories and tags?
A pseudo SQL Query would be:
```
Select * from Posts where ( cat_id = 1 OR (cat_id = 5 AND tag_id ... | I am not 100% sure what you are asking but as written that is going to be wrong. `tax_query` is an array of arrays but you have an array of array of arrays. You create the third array when you put `$taxQuery` into `array($taxQuery)`. This should be more correct:
```
$args = array(
'post_type' => $postT... |
105,225 | <p>Thank you for reading! There's a lot redirecting going on on the site I'm creating. </p>
<p>For example, </p>
<ul>
<li><p>if not logged in user access a "private" page, he will be redirected to a custom login page.</p></li>
<li><p>if the user logs in, he will be redirected to the last page he visited before access... | [
{
"answer_id": 105221,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": false,
"text": "<p>I am not 100% sure what you are asking but as written that is going to be wrong. <code>tax_query</code> is ... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105225",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13010/"
] | Thank you for reading! There's a lot redirecting going on on the site I'm creating.
For example,
* if not logged in user access a "private" page, he will be redirected to a custom login page.
* if the user logs in, he will be redirected to the last page he visited before accessing the login form.
Let's call the pa... | I am not 100% sure what you are asking but as written that is going to be wrong. `tax_query` is an array of arrays but you have an array of array of arrays. You create the third array when you put `$taxQuery` into `array($taxQuery)`. This should be more correct:
```
$args = array(
'post_type' => $postT... |
105,241 | <p>I've been having a difficult time adding custom post type capabilities to roles (<a href="https://wordpress.stackexchange.com/questions/105097/adding-capabilities-to-default-roles">Adding capabilities to default roles</a>) and I suspect that my muddling around may have caused some problems. I also have installed and... | [
{
"answer_id": 105243,
"author": "livearoha",
"author_id": 25235,
"author_profile": "https://wordpress.stackexchange.com/users/25235",
"pm_score": 3,
"selected": true,
"text": "<p>I use <a href=\"http://wordpress.org/plugins/user-role-editor/\" rel=\"nofollow\">User Role Editor</a>. You ... | 2013/07/03 | [
"https://wordpress.stackexchange.com/questions/105241",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34045/"
] | I've been having a difficult time adding custom post type capabilities to roles ([Adding capabilities to default roles](https://wordpress.stackexchange.com/questions/105097/adding-capabilities-to-default-roles)) and I suspect that my muddling around may have caused some problems. I also have installed and de-installed ... | I use [User Role Editor](http://wordpress.org/plugins/user-role-editor/). You can delete added roles, and reset roles from the plugin page.
To reset the administator role, you can, as of WP 3.4+, add
```
define('URE_SHOW_ADMIN_ROLE', 1);
```
to your *wp-config.php* file. After having done so, you need to go to *Use... |
105,257 | <p>I am pulling my hair out trying to figure this out. I have followed the wordpress codex here for AJAX: <a href="http://codex.wordpress.org/AJAX_in_Plugins" rel="nofollow">http://codex.wordpress.org/AJAX_in_Plugins</a></p>
<p>All I keep returning is 0, I never get a 1. Any idea why? My code is as follows.</p>
<p>PH... | [
{
"answer_id": 105259,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 2,
"selected": false,
"text": "<p>I'll guess that you're testing this by entering your admin email address. Have a look at the Codex page for <a hre... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105257",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18241/"
] | I am pulling my hair out trying to figure this out. I have followed the wordpress codex here for AJAX: <http://codex.wordpress.org/AJAX_in_Plugins>
All I keep returning is 0, I never get a 1. Any idea why? My code is as follows.
PHP:
```
add_action('wp_enqueue_scripts', 'live_validation' );
add_action('wp_ajax_vali... | Found the problem. It always helps to read the codex thoroughly!
>
> "ATTENTION: When you are writing a plugin (in plugin wp\_ajax usage)
> place lines below in your main plugin file, e.g. myplugin.php"
>
>
>
<http://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_%28action%29>
Just make sure all of you... |
105,263 | <p>I have a custom page <code>resources-search.php</code> template which handles search results for the search form. And in my <code>function.php</code> I have the following array:</p>
<pre><code>$YearList = array('2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013');
</cod... | [
{
"answer_id": 105259,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 2,
"selected": false,
"text": "<p>I'll guess that you're testing this by entering your admin email address. Have a look at the Codex page for <a hre... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105263",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34576/"
] | I have a custom page `resources-search.php` template which handles search results for the search form. And in my `function.php` I have the following array:
```
$YearList = array('2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013');
```
Yes, You guessed it right. Its an a... | Found the problem. It always helps to read the codex thoroughly!
>
> "ATTENTION: When you are writing a plugin (in plugin wp\_ajax usage)
> place lines below in your main plugin file, e.g. myplugin.php"
>
>
>
<http://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_%28action%29>
Just make sure all of you... |
105,279 | <p>I'm including a file by <code>include_once</code>:</p>
<pre><code>include_once( trailingslashit( get_stylesheet_directory() ) . '/recaptchalib.php' );
</code></pre>
<p>However I get warning from theme check plugin:</p>
<pre><code>INFO: The theme appears to use include or require.
If these are being used to inclu... | [
{
"answer_id": 105259,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 2,
"selected": false,
"text": "<p>I'll guess that you're testing this by entering your admin email address. Have a look at the Codex page for <a hre... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105279",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34897/"
] | I'm including a file by `include_once`:
```
include_once( trailingslashit( get_stylesheet_directory() ) . '/recaptchalib.php' );
```
However I get warning from theme check plugin:
```
INFO: The theme appears to use include or require.
If these are being used to include separate sections of a template from independ... | Found the problem. It always helps to read the codex thoroughly!
>
> "ATTENTION: When you are writing a plugin (in plugin wp\_ajax usage)
> place lines below in your main plugin file, e.g. myplugin.php"
>
>
>
<http://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_%28action%29>
Just make sure all of you... |
105,281 | <p>I need to translate my Wordpress in Italian.</p>
<p>Following the instruction written on WordPress in Your Language, I've searched my .mo file inside the Language Repository but I've some problems.</p>
<p>The folder structure is not as expected, there are lots of folders that don't make me any sense:</p>
<pre><co... | [
{
"answer_id": 105259,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 2,
"selected": false,
"text": "<p>I'll guess that you're testing this by entering your admin email address. Have a look at the Codex page for <a hre... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105281",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32321/"
] | I need to translate my Wordpress in Italian.
Following the instruction written on WordPress in Your Language, I've searched my .mo file inside the Language Repository but I've some problems.
The folder structure is not as expected, there are lots of folders that don't make me any sense:
```
branches/
buddypress/
mu/... | Found the problem. It always helps to read the codex thoroughly!
>
> "ATTENTION: When you are writing a plugin (in plugin wp\_ajax usage)
> place lines below in your main plugin file, e.g. myplugin.php"
>
>
>
<http://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_%28action%29>
Just make sure all of you... |
105,299 | <p>I have installed <a href="http://wordpress.org/plugins/disqus-comment-system/" rel="nofollow">Disqus Comment System</a> 2.74 in my Worpress version 3.5.2.<br>
I want to disable disqus from all pages except Blog post.</p>
<p>Is there any way to do this?</p>
| [
{
"answer_id": 105316,
"author": "Adam",
"author_id": 13418,
"author_profile": "https://wordpress.stackexchange.com/users/13418",
"pm_score": 1,
"selected": false,
"text": "<p>I downloaded the source and took a look, I see that Disqus hooks onto the <code>comments_template</code> filter ... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105299",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34468/"
] | I have installed [Disqus Comment System](http://wordpress.org/plugins/disqus-comment-system/) 2.74 in my Worpress version 3.5.2.
I want to disable disqus from all pages except Blog post.
Is there any way to do this? | I downloaded the source and took a look, I see that Disqus hooks onto the `comments_template` filter so you can try this;
```
//hook onto comments_template filter with priority 1
add_filter( 'comments_template' , 'disable_disqus', 1 );
function disable_disqus($file) {
//if not blog page, remove disqus filter
i... |
105,303 | <p>I am trying to convert a HTML and CSS template that uses <code>.js</code> files as well, into a WP theme on my localhost. The <code>index.html</code> has the following:</p>
<pre><code><head>
<title>Home</title>
<meta charset="utf-8">
<link rel="icon" href="img/favicon.ico" type="image/x-... | [
{
"answer_id": 105316,
"author": "Adam",
"author_id": 13418,
"author_profile": "https://wordpress.stackexchange.com/users/13418",
"pm_score": 1,
"selected": false,
"text": "<p>I downloaded the source and took a look, I see that Disqus hooks onto the <code>comments_template</code> filter ... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105303",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34825/"
] | I am trying to convert a HTML and CSS template that uses `.js` files as well, into a WP theme on my localhost. The `index.html` has the following:
```
<head>
<title>Home</title>
<meta charset="utf-8">
<link rel="icon" href="img/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="img/favicon.ico" type="i... | I downloaded the source and took a look, I see that Disqus hooks onto the `comments_template` filter so you can try this;
```
//hook onto comments_template filter with priority 1
add_filter( 'comments_template' , 'disable_disqus', 1 );
function disable_disqus($file) {
//if not blog page, remove disqus filter
i... |
105,306 | <p>I am building a client portal where my clients can log in and see all their pending projects, completed projects and create new projects.</p>
<p>Though I'm stuck at the start.</p>
<p>The dropdown menu is called "My Projects"<br>
If "User 1" is logged in and they click on "My Projects" then I need that link to link... | [
{
"answer_id": 105312,
"author": "richbai90",
"author_id": 34097,
"author_profile": "https://wordpress.stackexchange.com/users/34097",
"pm_score": 0,
"selected": false,
"text": "<p>WordPress has a built in function for getting the current user:</p>\n\n<pre><code><?php wp_get_current_u... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105306",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34903/"
] | I am building a client portal where my clients can log in and see all their pending projects, completed projects and create new projects.
Though I'm stuck at the start.
The dropdown menu is called "My Projects"
If "User 1" is logged in and they click on "My Projects" then I need that link to link to:
`mysite.co... | I think you can make this much easier than you are. Just create a `my-projects` page and forget about the custom rewrite. Why? Because a user will only need to see their own projects. No need for a just rewrite because you can [get the current user any time](http://codex.wordpress.org/Function_Reference/wp_get_current_... |
105,346 | <p>Is there some way - a plugin, a technique, some file to edit - to define some custom markup to be interpreted, parsed and replaced with custom, generated content when generating posts?</p>
<p>The simplest example of what I want would be smileys, getting a <code>:)</code> or in text of the post replaced by a specifi... | [
{
"answer_id": 105312,
"author": "richbai90",
"author_id": 34097,
"author_profile": "https://wordpress.stackexchange.com/users/34097",
"pm_score": 0,
"selected": false,
"text": "<p>WordPress has a built in function for getting the current user:</p>\n\n<pre><code><?php wp_get_current_u... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105346",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34912/"
] | Is there some way - a plugin, a technique, some file to edit - to define some custom markup to be interpreted, parsed and replaced with custom, generated content when generating posts?
The simplest example of what I want would be smileys, getting a `:)` or in text of the post replaced by a specific `<img scr="...">` w... | I think you can make this much easier than you are. Just create a `my-projects` page and forget about the custom rewrite. Why? Because a user will only need to see their own projects. No need for a just rewrite because you can [get the current user any time](http://codex.wordpress.org/Function_Reference/wp_get_current_... |
105,349 | <p>On <a href="http://codex.wordpress.org/Designing_Headings#H3_and_H4_Headings" rel="nofollow">this</a> article, it was said that you can use the <code>h4</code> tag to create a subheader to break up long posts. However, whenever I wrap text in the tags, it displays the tags as regular characters. Wordpress doesn't se... | [
{
"answer_id": 105352,
"author": "livearoha",
"author_id": 25235,
"author_profile": "https://wordpress.stackexchange.com/users/25235",
"pm_score": 2,
"selected": true,
"text": "<p>You easily add an H4 tag in the \"Visual\" version of the editor (the tab on the upper right corner of the e... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105349",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34914/"
] | On [this](http://codex.wordpress.org/Designing_Headings#H3_and_H4_Headings) article, it was said that you can use the `h4` tag to create a subheader to break up long posts. However, whenever I wrap text in the tags, it displays the tags as regular characters. Wordpress doesn't seem to recognize the use of HTML. I have ... | You easily add an H4 tag in the "Visual" version of the editor (the tab on the upper right corner of the editor) by selecting the text you want to be the subheader at the top of the rich text editor there is a buttom at the end of the first row of icons called the "Kitchen Sink", click this to expose all the options th... |
105,350 | <p>I am currently developing a portfolio section on my website and when the single posts are viewed, there are some previous and next links to take the user to the next post.</p>
<p>Upon reaching the first post single view, the previous button takes the user to the fifth post in the series rather than looping to numbe... | [
{
"answer_id": 105352,
"author": "livearoha",
"author_id": 25235,
"author_profile": "https://wordpress.stackexchange.com/users/25235",
"pm_score": 2,
"selected": true,
"text": "<p>You easily add an H4 tag in the \"Visual\" version of the editor (the tab on the upper right corner of the e... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105350",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23507/"
] | I am currently developing a portfolio section on my website and when the single posts are viewed, there are some previous and next links to take the user to the next post.
Upon reaching the first post single view, the previous button takes the user to the fifth post in the series rather than looping to number 12 in th... | You easily add an H4 tag in the "Visual" version of the editor (the tab on the upper right corner of the editor) by selecting the text you want to be the subheader at the top of the rich text editor there is a buttom at the end of the first row of icons called the "Kitchen Sink", click this to expose all the options th... |
105,364 | <p>I just noticed there was this script in my source code:</p>
<pre><code><script src='/google_analytics_auto.js'></script>
</code></pre>
<p>I did not insert this script and I have no plugins, so I don't know why it's there? Does someone know how to remove that?</p>
| [
{
"answer_id": 105368,
"author": "markratledge",
"author_id": 268,
"author_profile": "https://wordpress.stackexchange.com/users/268",
"pm_score": 2,
"selected": false,
"text": "<p>Check <code>header.php</code> and <code>footer.php</code>; sounds like that link is part of your theme and i... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105364",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I just noticed there was this script in my source code:
```
<script src='/google_analytics_auto.js'></script>
```
I did not insert this script and I have no plugins, so I don't know why it's there? Does someone know how to remove that? | The reason is you are using HostGator and enable the feature is Google Analytics Integration, by enable this one, HostGator will automatically add this snipped of code into your main website and all of it sub or add-on domain:
```
<script src='/google_analytics_auto.js'></script></head>
```
I my self also faced with... |
105,376 | <p>I am pretty new to Wordpress, especially when PHP programming is concerned. I am using <a href="http://ciola.cubellthemes.com/category/music/rock/" rel="nofollow noreferrer">Ciola Theme from Theme Forest</a>. What I would like to achieve is to display a sub menu under the main menu, but only for a specific category.... | [
{
"answer_id": 105411,
"author": "Bindiya Patoliya",
"author_id": 34932,
"author_profile": "https://wordpress.stackexchange.com/users/34932",
"pm_score": 0,
"selected": false,
"text": "<p>Hello Rafał Wyszomirski,</p>\n\n<p>No need to create second menu.You can create submenu pages(as a c... | 2013/07/04 | [
"https://wordpress.stackexchange.com/questions/105376",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34921/"
] | I am pretty new to Wordpress, especially when PHP programming is concerned. I am using [Ciola Theme from Theme Forest](http://ciola.cubellthemes.com/category/music/rock/). What I would like to achieve is to display a sub menu under the main menu, but only for a specific category. I added menu in theme's **core-function... | Yes,You can do it by
```
if(is_category()) {
wp_nav_menu( array(
'theme_location' => 'menu-97226',
'walker' => new Menu_Walker_97226()
) );
}
```
while calling menu in header file. |
105,400 | <p>I am trying to utilize WP_Error for my plugin, but nothing happens. Is this too late for WP_Error? Too early? Or am I doing something else wrong?</p>
<pre><code>function cpt_pre_post_publish(){
return new WP_Error('error', __('Error!' ));
}
add_action('pre_get_posts', 'cpt_pre_post_publish');
</code></pre>
| [
{
"answer_id": 105410,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>Actions don't typically <code>return</code> data, so I doubt you will get this working the way you are trying... | 2013/07/05 | [
"https://wordpress.stackexchange.com/questions/105400",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10175/"
] | I am trying to utilize WP\_Error for my plugin, but nothing happens. Is this too late for WP\_Error? Too early? Or am I doing something else wrong?
```
function cpt_pre_post_publish(){
return new WP_Error('error', __('Error!' ));
}
add_action('pre_get_posts', 'cpt_pre_post_publish');
``` | Actions don't typically `return` data, so I doubt you will get this working the way you are trying to. Something like...
```
function cpt_pre_post_publish(){
global $my_error;
$my_error = new WP_Error('error', __('Error!' ));
}
add_action('pre_get_posts', 'cpt_pre_post_publish');
```
... should set a variable th... |
105,426 | <p>I am using wp_localize_script to pass a couple of values from my theme options to a javascript file. First I got the values from my theme options:</p>
<pre><code>$options = get_option('theme');
$flex_auto = $options["slide-auto"];
$flex_animation = $options["slide-animation"];
$flex_direction = $options["slide-di... | [
{
"answer_id": 105427,
"author": "Mike Madern",
"author_id": 24806,
"author_profile": "https://wordpress.stackexchange.com/users/24806",
"pm_score": 3,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>$options = get_option( 'theme' );\n\nwp_localize_script( 'flexslider', 'flex_v... | 2013/07/05 | [
"https://wordpress.stackexchange.com/questions/105426",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18937/"
] | I am using wp\_localize\_script to pass a couple of values from my theme options to a javascript file. First I got the values from my theme options:
```
$options = get_option('theme');
$flex_auto = $options["slide-auto"];
$flex_animation = $options["slide-animation"];
$flex_direction = $options["slide-direction"];
... | Try this:
```
$options = get_option( 'theme' );
wp_localize_script( 'flexslider', 'flex_vars', array (
'flex_auto' => ($options['slide-auto']) ? 'true' : 'false',
'flex_animation' => $options['slide-animation'],
'flex_direction' => $options['slide-direction']
) );
```
Assuming `slide-auto` is the option you m... |
105,454 | <p>I've found this great plugin <em>Custom Post Type Permalinks</em> by a Japenese developer which is awesome at generating hierarchical permalink structures for Custom Post Types. Only I'm having an issue which I cannot get around and am looking for a solution. </p>
<p>I have a custom post type <code>classes</code> a... | [
{
"answer_id": 105427,
"author": "Mike Madern",
"author_id": 24806,
"author_profile": "https://wordpress.stackexchange.com/users/24806",
"pm_score": 3,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>$options = get_option( 'theme' );\n\nwp_localize_script( 'flexslider', 'flex_v... | 2013/07/05 | [
"https://wordpress.stackexchange.com/questions/105454",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/19337/"
] | I've found this great plugin *Custom Post Type Permalinks* by a Japenese developer which is awesome at generating hierarchical permalink structures for Custom Post Types. Only I'm having an issue which I cannot get around and am looking for a solution.
I have a custom post type `classes` and a taxonomy `classes_categ... | Try this:
```
$options = get_option( 'theme' );
wp_localize_script( 'flexslider', 'flex_vars', array (
'flex_auto' => ($options['slide-auto']) ? 'true' : 'false',
'flex_animation' => $options['slide-animation'],
'flex_direction' => $options['slide-direction']
) );
```
Assuming `slide-auto` is the option you m... |
105,471 | <p>I want to display post categories in theme settings, and I successfully did that using this code:</p>
<pre><code><?php /* Get the list of categories */
$categories = get_categories();
foreach ( $categories as $category) :
$selected = '';
?>
<option <?php... | [
{
"answer_id": 105427,
"author": "Mike Madern",
"author_id": 24806,
"author_profile": "https://wordpress.stackexchange.com/users/24806",
"pm_score": 3,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>$options = get_option( 'theme' );\n\nwp_localize_script( 'flexslider', 'flex_v... | 2013/07/05 | [
"https://wordpress.stackexchange.com/questions/105471",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34951/"
] | I want to display post categories in theme settings, and I successfully did that using this code:
```
<?php /* Get the list of categories */
$categories = get_categories();
foreach ( $categories as $category) :
$selected = '';
?>
<option <?php echo $option ?> value="<?... | Try this:
```
$options = get_option( 'theme' );
wp_localize_script( 'flexslider', 'flex_vars', array (
'flex_auto' => ($options['slide-auto']) ? 'true' : 'false',
'flex_animation' => $options['slide-animation'],
'flex_direction' => $options['slide-direction']
) );
```
Assuming `slide-auto` is the option you m... |
105,492 | <p>I am using <a href="http://wordpress.org/plugins/infinite-scroll/" rel="nofollow">infinite scroll</a> of my local theme here and it is causing some CSS issues. I was hoping if I ran this by some of you, you might have a solution to offer.</p>
<p>This is pretty much the layout:</p>
<pre><code>#wrap {
width: 938px;
... | [
{
"answer_id": 105505,
"author": "s1lv3r",
"author_id": 27536,
"author_profile": "https://wordpress.stackexchange.com/users/27536",
"pm_score": 2,
"selected": true,
"text": "<p>You've got to take the <code>type</code> in <code>:nth-of-type()</code> literally. It only takes into account t... | 2013/07/05 | [
"https://wordpress.stackexchange.com/questions/105492",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32290/"
] | I am using [infinite scroll](http://wordpress.org/plugins/infinite-scroll/) of my local theme here and it is causing some CSS issues. I was hoping if I ran this by some of you, you might have a solution to offer.
This is pretty much the layout:
```
#wrap {
width: 938px;
overflow: hidden;
background-color: aqua;
borde... | You've got to take the `type` in `:nth-of-type()` literally. It only takes into account the type of the element (in this case `DIV`). The selector doesn't matter.
`:nth-of-type()` works the same, except that it only considers element of the given type.
<http://quirksmode.org/css/selectors/nthchild.html>
Unfortunatel... |
105,495 | <p>I'm attempting to create a custom field on my page creation that allows a user to choose which menu to display on the page. Right now I have my custom meta field setup, but can't figure out how to make a drop down menu of the available menus. Is there a function that I could use and then for loop though?</p>
<p>Tha... | [
{
"answer_id": 105499,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>It is not intuitive but <code>get_terms</code> will do it, if I understand what you need.</p>\n\n<pre><code>v... | 2013/07/05 | [
"https://wordpress.stackexchange.com/questions/105495",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25283/"
] | I'm attempting to create a custom field on my page creation that allows a user to choose which menu to display on the page. Right now I have my custom meta field setup, but can't figure out how to make a drop down menu of the available menus. Is there a function that I could use and then for loop though?
Thanks! | It is not intuitive but `get_terms` will do it, if I understand what you need.
```
var_dump(get_terms( 'nav_menu'));
```
If you look in the `*_term_taxonomy` table you can see why. The menus are stored as a taxonomy named `nav_menu`.
This won't get you things like page menus, only the intentionally created menus. |
105,496 | <p>So far this is the code I have in my index.php file:</p>
<pre><code><?php
// Custom code to offset posts and setup pagination
$page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$ppp = get_option( 'posts_per_page' );
if ( $page == 1 )
$offset = 6... | [
{
"answer_id": 105520,
"author": "Shahinul Islam",
"author_id": 34971,
"author_profile": "https://wordpress.stackexchange.com/users/34971",
"pm_score": 2,
"selected": false,
"text": "<p>I think your searching for this solution </p>\n\n<p><a href=\"http://codex.wordpress.org/Making_Custom... | 2013/07/05 | [
"https://wordpress.stackexchange.com/questions/105496",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34965/"
] | So far this is the code I have in my index.php file:
```
<?php
// Custom code to offset posts and setup pagination
$page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$ppp = get_option( 'posts_per_page' );
if ( $page == 1 )
$offset = 6;
else
... | You are going about this the hard way, and the less efficient way. You already have a Loop on the page. You should be able to use that and that alone.
```
if (have_posts()) {
while (have_posts()) {
the_post();
if (6 < $wp_query->current_post) {
// formatting for your first six posts
} else {
... |
105,508 | <p>I'm still getting to grips with functions and experimenting with different php functions.</p>
<p>I've created a function what I want to use in sync with my custom metabox excerpt. It will basically sanitize the data and make sure its 150 characters long and the first word starts with a capital letter.</p>
<p>My co... | [
{
"answer_id": 105520,
"author": "Shahinul Islam",
"author_id": 34971,
"author_profile": "https://wordpress.stackexchange.com/users/34971",
"pm_score": 2,
"selected": false,
"text": "<p>I think your searching for this solution </p>\n\n<p><a href=\"http://codex.wordpress.org/Making_Custom... | 2013/07/05 | [
"https://wordpress.stackexchange.com/questions/105508",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32672/"
] | I'm still getting to grips with functions and experimenting with different php functions.
I've created a function what I want to use in sync with my custom metabox excerpt. It will basically sanitize the data and make sure its 150 characters long and the first word starts with a capital letter.
My code is very loose ... | You are going about this the hard way, and the less efficient way. You already have a Loop on the page. You should be able to use that and that alone.
```
if (have_posts()) {
while (have_posts()) {
the_post();
if (6 < $wp_query->current_post) {
// formatting for your first six posts
} else {
... |
105,537 | <p>I'm building a small gallery plugin and I'd like to only load scripts/styles onto the page IF the gallery has been loaded via the template tag. The template tag can take a post ID parameter when used to call a post's gallery from wherever you need within the theme.</p>
<p>I know how to do this on singular pages (I ... | [
{
"answer_id": 105539,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 1,
"selected": false,
"text": "<p>For scripts this is no-brainer - just enqueue inside <code>my_gallery()</code> function and they will be output in ... | 2013/07/06 | [
"https://wordpress.stackexchange.com/questions/105537",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4999/"
] | I'm building a small gallery plugin and I'd like to only load scripts/styles onto the page IF the gallery has been loaded via the template tag. The template tag can take a post ID parameter when used to call a post's gallery from wherever you need within the theme.
I know how to do this on singular pages (I can just l... | For scripts this is no-brainer - just enqueue inside `my_gallery()` function and they will be output in footer (since header already passed).
However stylesheets are a challenge, they are only supposed to work in `head` section and enqueueing for footer is not supported.
Essentially you need to know if function was c... |
105,555 | <p>I am attempting to use :</p>
<pre><code>add_filter( 'the_content', 'filter_function_name' );
</code></pre>
<p>To find all of the anchor tags in my post which link to a .mp3 file, and then replace them with a jplayer instance that would play the file, instead of just having the link to be file being displayed.</p>
... | [
{
"answer_id": 105539,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 1,
"selected": false,
"text": "<p>For scripts this is no-brainer - just enqueue inside <code>my_gallery()</code> function and they will be output in ... | 2013/07/06 | [
"https://wordpress.stackexchange.com/questions/105555",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33573/"
] | I am attempting to use :
```
add_filter( 'the_content', 'filter_function_name' );
```
To find all of the anchor tags in my post which link to a .mp3 file, and then replace them with a jplayer instance that would play the file, instead of just having the link to be file being displayed.
So, I am trying to get all of... | For scripts this is no-brainer - just enqueue inside `my_gallery()` function and they will be output in footer (since header already passed).
However stylesheets are a challenge, they are only supposed to work in `head` section and enqueueing for footer is not supported.
Essentially you need to know if function was c... |
105,560 | <p>My code call menu:</p>
<pre><code>$defaults = array(
'theme_location' => '',
'menu' => '',
'container' => 'div',
'container_class' => true,
'container_id' => 'btn',
'menu_class' => true,
'menu_id' => '',
'echo' => t... | [
{
"answer_id": 105562,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 2,
"selected": false,
"text": "<p>This will replace the last occurrence of your <code>after</code> string.</p>\n\n<pre><code>function replace_... | 2013/07/06 | [
"https://wordpress.stackexchange.com/questions/105560",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34980/"
] | My code call menu:
```
$defaults = array(
'theme_location' => '',
'menu' => '',
'container' => 'div',
'container_class' => true,
'container_id' => 'btn',
'menu_class' => true,
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page... | This will replace the last occurrence of your `after` string.
```
function replace_last_nav_item($items, $args) {
return substr_replace($items, '', strrpos($items, $args->after), strlen($args->after));
}
add_filter('wp_nav_menu','replace_last_nav_item',100,2);
```
Pure CSS will do this too:
```
.btn_bar:last-chil... |
105,581 | <p>Why am I able to use WP_Query methods without using an object of this class? Sometimes I see examples that are using the object:</p>
<pre><code>// The Query
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_tit... | [
{
"answer_id": 105582,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 0,
"selected": false,
"text": "<p>Every request for a WordPress page (a page, a post, a category archive, a tag archive, etc.) generates a <em>main ... | 2013/07/07 | [
"https://wordpress.stackexchange.com/questions/105581",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | Why am I able to use WP\_Query methods without using an object of this class? Sometimes I see examples that are using the object:
```
// The Query
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
```
B... | You are using a `WP_Query` object, you just don't know it (yet).
WordPress generates a `global` called `$wp_query` which is `WP_Query` object. This object is what is responsible for what is called the "main Loop" colloquially. This `$wp_query` object is present on every page that I am aware of. Functions like `the_po... |
105,633 | <p>I want add a pagination</p>
<p>How can I do this on both loop.php and search.php. I want show alphabetic index to search only posts with starting letter = [E] for example. Right now, if I search with E it search for any match, <code>title+content+part of title</code>.</p>
<blockquote>
<p>[A] [B] [C] [D] <strong>... | [
{
"answer_id": 105654,
"author": "Daniel Foltynek",
"author_id": 33517,
"author_profile": "https://wordpress.stackexchange.com/users/33517",
"pm_score": 2,
"selected": false,
"text": "<p>This is the code I get from <a href=\"http://code.hyperspatial.com/\" rel=\"nofollow\">here</a>, but ... | 2013/07/07 | [
"https://wordpress.stackexchange.com/questions/105633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34971/"
] | I want add a pagination
How can I do this on both loop.php and search.php. I want show alphabetic index to search only posts with starting letter = [E] for example. Right now, if I search with E it search for any match, `title+content+part of title`.
>
> [A] [B] [C] [D] **[E]** [F] [G] [H] [I] [J] [K] [L] [M] [N] [O... | This is the code I get from [here](http://code.hyperspatial.com/), but I don't remember the exact page, and this is my working page of [letter B](http://4ella.com/clubs/locali-notturni/locali-ordine-alfabetico/?first_letter=B) on my website (using the same code as you see below)
```
<?php
/*
Template Name: Locali per ... |
105,637 | <p>I've been wondering about this for a while. Is the following <code>if</code> statement safe enough? Is it easy to break through the code and get access to the content when not logged in?</p>
<pre><code><?php if ( is_user_logged_in() ) {
// SECURE CONTENT
} else {
// LANDING PAGE
} ?>
</code></pre>... | [
{
"answer_id": 105642,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>Well, you have to ask yourself \"Secure enough for what?\" I doubt you are a bank or other institution that n... | 2013/07/07 | [
"https://wordpress.stackexchange.com/questions/105637",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23004/"
] | I've been wondering about this for a while. Is the following `if` statement safe enough? Is it easy to break through the code and get access to the content when not logged in?
```
<?php if ( is_user_logged_in() ) {
// SECURE CONTENT
} else {
// LANDING PAGE
} ?>
``` | Well, you have to ask yourself "Secure enough for what?" I doubt you are a bank or other institution that needs exceptionally high security. If you were you'd a team of $100,000+ per year experts to answer this question for you.
With that in mind...
You'd have to subvert the WordPress login system to get past that ... |
105,651 | <p>I’m researching a bit WP_Query and me a problem has arisen.</p>
<p>I have custom fields in tickets and would like to make a WP_Query showing this (put an example):</p>
<pre><code>(field1 = “data1″ AND field2 = “data2″) OR (field1 = “data2″ AND field2 = “data1″)
</code></pre>
<p>To do this I created this query but... | [
{
"answer_id": 105661,
"author": "TheDeadMedic",
"author_id": 1685,
"author_profile": "https://wordpress.stackexchange.com/users/1685",
"pm_score": 1,
"selected": true,
"text": "<p>Unfortunately, meta queries do not support a combination of <code>AND</code> & <code>OR</code>. But wha... | 2013/07/07 | [
"https://wordpress.stackexchange.com/questions/105651",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35016/"
] | I’m researching a bit WP\_Query and me a problem has arisen.
I have custom fields in tickets and would like to make a WP\_Query showing this (put an example):
```
(field1 = “data1″ AND field2 = “data2″) OR (field1 = “data2″ AND field2 = “data1″)
```
To do this I created this query but it returns me well.
```
'meta... | Unfortunately, meta queries do not support a combination of `AND` & `OR`. But what you *can* do, is make two queries, one for each rule, then combine the results.
```
$group_1 = get_posts(
array(
'posts_per_page' => -1,
'fields' => 'ids',
'meta_query' => array (
arra... |
105,696 | <p>Id like to build a search form for a specific custom post type (vehicle) and have filters for that custom posts type's custom meta fields (price, age) and custom taxonomies (make). This will totally replace the sites search and be the only search available so I was going to use search.php within my custom template.<... | [
{
"answer_id": 105705,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 2,
"selected": false,
"text": "<p>If you want to extend your query, you should extend it through the <code>pre_get_posts</code>-filter. Then just do... | 2013/07/08 | [
"https://wordpress.stackexchange.com/questions/105696",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35032/"
] | Id like to build a search form for a specific custom post type (vehicle) and have filters for that custom posts type's custom meta fields (price, age) and custom taxonomies (make). This will totally replace the sites search and be the only search available so I was going to use search.php within my custom template.
I'... | If you want to extend your query, you should extend it through the `pre_get_posts`-filter. Then just do a ["Custom Field" or meta query](http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters).
```
add_action( 'pre_get_posts', 'wpse105969_extended_search' );
function wpse105969_extended_search( $q... |
105,709 | <p>I don't understand why the code below is always displaying the same number of returned post = 5. When I change the <code>$variable</code> value to another <code>post id</code> of a post with an author with another <code>author_id</code>, I always get 5 returned posts, even if the authors have tens of posts. What am ... | [
{
"answer_id": 105714,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 3,
"selected": true,
"text": "<p><a href=\"http://queryposts.com/function/get_posts/\" rel=\"nofollow\"><code>get_posts()</code></a> has some default... | 2013/07/08 | [
"https://wordpress.stackexchange.com/questions/105709",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16048/"
] | I don't understand why the code below is always displaying the same number of returned post = 5. When I change the `$variable` value to another `post id` of a post with an author with another `author_id`, I always get 5 returned posts, even if the authors have tens of posts. What am I doing wrong?
```
$variable=328;
$... | [`get_posts()`](http://queryposts.com/function/get_posts/) has some defaults set, including `numberposts` equal to `5`. Since it's not considered to be a loop by itself those are independent and not affected by admin settings.
So simply pass in arguments `numberposts`/`posts_per_page` (same thing) number for how many ... |
105,715 | <p>I am succesfully pre populating logged in user wordpress user meta into gravity forms, but I can't find a way how to prepopulate buddypress profile data into gravity forms. </p>
<p><strong>Goal</strong></p>
<p>I want to be able to pull from Buddypress Profile data for the logged in user to populate the fields in G... | [
{
"answer_id": 105714,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 3,
"selected": true,
"text": "<p><a href=\"http://queryposts.com/function/get_posts/\" rel=\"nofollow\"><code>get_posts()</code></a> has some default... | 2013/07/08 | [
"https://wordpress.stackexchange.com/questions/105715",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33517/"
] | I am succesfully pre populating logged in user wordpress user meta into gravity forms, but I can't find a way how to prepopulate buddypress profile data into gravity forms.
**Goal**
I want to be able to pull from Buddypress Profile data for the logged in user to populate the fields in Gravity forms such as Phone, Ad... | [`get_posts()`](http://queryposts.com/function/get_posts/) has some defaults set, including `numberposts` equal to `5`. Since it's not considered to be a loop by itself those are independent and not affected by admin settings.
So simply pass in arguments `numberposts`/`posts_per_page` (same thing) number for how many ... |
105,719 | <p>I've put some thought into this but Can't really figure out what direction I take in getting rid of certain terms in my testimonial_category called 'home', 'homeone', hometwo. I only want to stop these displaying in a link format on the relevant page. </p>
<p>Here is the code the process's all the terms within test... | [
{
"answer_id": 105721,
"author": "David Kryzaniak",
"author_id": 31548,
"author_profile": "https://wordpress.stackexchange.com/users/31548",
"pm_score": 0,
"selected": false,
"text": "<p>This is a bit of a hack... (hardcoding variables like this isn't best practice, IMO) but it's good ex... | 2013/07/08 | [
"https://wordpress.stackexchange.com/questions/105719",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34257/"
] | I've put some thought into this but Can't really figure out what direction I take in getting rid of certain terms in my testimonial\_category called 'home', 'homeone', hometwo. I only want to stop these displaying in a link format on the relevant page.
Here is the code the process's all the terms within testimonial\_... | The function [`get_terms`](http://codex.wordpress.org/Function_Reference/get_terms) has a convenient `$args` parameter which allows you to customize your query to meet your needs; in your case, it would be something as simple as:
```
$args = array(
'exclude' => array(1,2,3)
);
$terms = get_terms("testimonia... |
105,729 | <p>I have read other answers, but I don't understand which is more fast (the best and simple for slow server running)?</p>
<p>I have a website with over 1 000 000 hits /day and a slow server with limitations at database connections, so I want to optimise my site.</p>
<p>What do you recommend me to use: WP_Query or qu... | [
{
"answer_id": 105721,
"author": "David Kryzaniak",
"author_id": 31548,
"author_profile": "https://wordpress.stackexchange.com/users/31548",
"pm_score": 0,
"selected": false,
"text": "<p>This is a bit of a hack... (hardcoding variables like this isn't best practice, IMO) but it's good ex... | 2013/07/08 | [
"https://wordpress.stackexchange.com/questions/105729",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35040/"
] | I have read other answers, but I don't understand which is more fast (the best and simple for slow server running)?
I have a website with over 1 000 000 hits /day and a slow server with limitations at database connections, so I want to optimise my site.
What do you recommend me to use: WP\_Query or query\_posts() or ... | The function [`get_terms`](http://codex.wordpress.org/Function_Reference/get_terms) has a convenient `$args` parameter which allows you to customize your query to meet your needs; in your case, it would be something as simple as:
```
$args = array(
'exclude' => array(1,2,3)
);
$terms = get_terms("testimonia... |
105,731 | <p>i'm trying to send push notification when the wordpress admin insert new post.</p>
<p>I was looking for hours where to add my function and after a lot i found core function <code>wp_insert_post</code> inside <code>wp-includes/post.php</code></p>
<p>that function returns the Post_ID, so i added my custom script bef... | [
{
"answer_id": 105734,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>See those two hooks in the hacked Core code you posted?</p>\n\n<pre><code>do_action('save_post', $post_ID, $p... | 2013/07/08 | [
"https://wordpress.stackexchange.com/questions/105731",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35048/"
] | i'm trying to send push notification when the wordpress admin insert new post.
I was looking for hours where to add my function and after a lot i found core function `wp_insert_post` inside `wp-includes/post.php`
that function returns the Post\_ID, so i added my custom script before return:
```
include '../push/send... | See those two hooks in the hacked Core code you posted?
```
do_action('save_post', $post_ID, $post);
do_action('wp_insert_post', $post_ID, $post);
```
Those are what you need to use to do this right.
```
function run_on_update_post($post_ID, $post) {
var_dump($post_ID, $post); // debug
include '../push/sen... |
105,733 | <p>I have a WordPress site that uses courtur theme with woocommerce I didn't install the site so i'm not sure if it was configured correctly.
my URL structure for product-category page as follow:</p>
<p>mysite/shopping/</p>
<p>and my product page url:</p>
<p>Mysite/product-category/category_name/</p>
<p>my category... | [
{
"answer_id": 105734,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>See those two hooks in the hacked Core code you posted?</p>\n\n<pre><code>do_action('save_post', $post_ID, $p... | 2013/07/08 | [
"https://wordpress.stackexchange.com/questions/105733",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35046/"
] | I have a WordPress site that uses courtur theme with woocommerce I didn't install the site so i'm not sure if it was configured correctly.
my URL structure for product-category page as follow:
mysite/shopping/
and my product page url:
Mysite/product-category/category\_name/
my category page breadcrump show as follo... | See those two hooks in the hacked Core code you posted?
```
do_action('save_post', $post_ID, $post);
do_action('wp_insert_post', $post_ID, $post);
```
Those are what you need to use to do this right.
```
function run_on_update_post($post_ID, $post) {
var_dump($post_ID, $post); // debug
include '../push/sen... |
105,750 | <p>I'm trying to find a way to show a widget only if a given sidebar is empty. I'm using <a href="http://wordpress.org/plugins/widget-logic/" rel="nofollow">Widget Logic</a> to control some widgets, but I'm having trouble figuring out how to use it in this case. I've tried to hook on to <code>widget_logic_eval_override... | [
{
"answer_id": 105734,
"author": "s_ha_dum",
"author_id": 21376,
"author_profile": "https://wordpress.stackexchange.com/users/21376",
"pm_score": 3,
"selected": true,
"text": "<p>See those two hooks in the hacked Core code you posted?</p>\n\n<pre><code>do_action('save_post', $post_ID, $p... | 2013/07/08 | [
"https://wordpress.stackexchange.com/questions/105750",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9802/"
] | I'm trying to find a way to show a widget only if a given sidebar is empty. I'm using [Widget Logic](http://wordpress.org/plugins/widget-logic/) to control some widgets, but I'm having trouble figuring out how to use it in this case. I've tried to hook on to `widget_logic_eval_override` which seems like the way to go, ... | See those two hooks in the hacked Core code you posted?
```
do_action('save_post', $post_ID, $post);
do_action('wp_insert_post', $post_ID, $post);
```
Those are what you need to use to do this right.
```
function run_on_update_post($post_ID, $post) {
var_dump($post_ID, $post); // debug
include '../push/sen... |