title: Taxonomies on Pages with Custom Formatting

text: guys, I'm fairly new to this so thanks in advance for your help and patience. So I've recently started using the WPAlchemy class on my site and it's really been an amazing time-saver. The main thing I'm using it for right now is for what I call my "product detail pages". Basically, I have a bunch of products I feature on my site and I like to offer the same _types_ of information on each detail page, with the same formatting/layout. So what I've done is created a ProductDetail template and written it up to format all of my details that I collect in the ProductDetail metabox (stuff like weight, gender, product name, and other data). Where I was previously creating each detail page from scratch and having to format each page by hand each time, I was starting to have enough products that I got over the by-hand thing really fast. Hence the template, and then hence the metabox...So that part of my project is working like a charm--no issues with the product detail pages so far. But now I'm working on a different part of this project and I find myself at a complete loss. See...What I want to do is create a "category page" for each category that displays a photo for each product in a given category, a short description, and three links: one to the corresponding "detail page", another to the corresponding post that reviews the product, and an affiliate link for the product. I originally figured that I could do this with WPAlchemy metaboxes but Dimas suggested I look into taxonomies instead. In my research, I find that this might be a much better way, as it would give me more freedom in accessing individual details...But I've run into two problems:   1. I can't seem to find sufficient information about using taxonomies with pages. I've found a bunch of information about using them with posts--which is great, but I'm new enough to this that there are differences I can't figure out by myself and there are also things that I wouldn't trust myself to change for fear of screwing the whole thing up. As all of my "product detail pages" are _pages_ , and not _posts_ , I'm not sure how to set up my taxonomies. I'm also starting to wonder if the whole metabox thing would be redundant if I use taxonomies. I'm thinking not, but it's just a question.   2. The other issue is that I've found plenty of information on how to use taxonomies to display, for example, a list of posts that correspond to a given taxonomy. But what if I simply want to display those three things for each product that corresponds to a given taxonomy? (The three things being a photo, a short description, and the three links.) I don't need the whole post (or in my case, the whole page). I just want a super-quick overview of each product, and I have enough products that displaying each page in its entirety would be highly cumbersome for any of my categories. I hope this makes sense... Again, thanks in advance for your patience and help. I'm really struggling with this and it's getting to be quite frustrating, as it's halted production on this part of my site.


title: Customizing WP-syntax to get custom colors

text: I downloaded the WP-syntax plugin and want to customize it to show a black terminal-style background. I edited the file `wp-syntax/wp-syntax.css` to               .wp_syntax {       color: #100;       background-color: black !important;       border: 1px solid silver;       margin: 0 0 1.5em 0;       overflow: auto;     }          /* IE FIX */     .wp_syntax {       overflow-x: auto;       overflow-y: hidden;       padding-bottom: expression(this.scrollWidth > this.offsetWidth ? 15 : 0);       width: 100%;     }          .wp_syntax table {       border-collapse: collapse;     }          .wp_syntax div, .wp_syntax td {       vertical-align: top;       padding: 2px 4px;     }          .wp_syntax .line_numbers {       text-align: right;       background-color: black !important;       color: white !important;       overflow: visible;     }          /* potential overrides for other styles */     .wp_syntax pre {       margin: 0;       width: auto;       float: none;       clear: none;       overflow: visible;       font-size: 12px;       line-height: 1.333;       white-space: pre;       background-color: black !important;          }      However, I am getting a result like ![enter image description here](http://i.stack.imgur.com/Cpg9i.png) Most of the text is barely visible. What modifications should I make to the code in order to get something like this: ![enter image description here](http://i.stack.imgur.com/DoxL4.png)


title: Using $wpdb Class to Pull Recent Comments Across a Network

text: Been looking for a clean and simple way to produce comments from across a network using the $wpdb database class. I did find this answer, which has been protected, and is four years old. I wrapped it in a function and attempted to call it on the front page of my network, but it didn't work. I also played with the mysql statement, but could not get it to produce any output. Here's what I have:               function display_sitewide_comments() {          global $wpdb;     $number = 20; // maximum number of comments to display     $selects = array();     $args = array();     foreach (wp_get_sites( $args ) as $blog)        // select only the fields you need here!        $selects[] = "(SELECT comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_content, post_title, {$blog['blog_id']} as blog_id FROM {$wpdb->base_prefix}{$blog['blog_id']}_comments           LEFT JOIN {$wpdb->base_prefix}{$blog['blog_id']}_posts           ON comment_post_id = id           WHERE post_status = 'publish'             AND post_password = ''             AND comment_approved = '1'             AND comment_type = ''            ORDER BY comment_date_gmt DESC LIMIT {$number})"; // real number is (number * # of blogs)            $comments = $wpdb->get_results(implode(" UNION ALL ", $selects)." ORDER BY comment_date_gmt DESC", OBJECT);          $count = 0;     foreach((array)$comments as $comment):       $count++;       if($count == $number+1) break;        ?>       <li>        <?php echo get_avatar($comment->comment_author_email, 32); ?>        <a href="<?php echo get_blog_permalink($comment->blog_id, $comment->comment_post_ID); ?>" title="commented on <?php echo strip_tags($comment->post_title); ?>">        <?php echo $comment->comment_author; ?> wrote:         <?php echo convert_smilies(wp_trim_excerpt($comment->comment_content)); ?>        (<?php echo human_time_diff(strtotime("{$comment->comment_date_gmt}")); ?>)          </a>       </li>     <?php     endforeach;     }      I'm wondering, since the post is 4 years old, if something has changed in core, or the database structure to make the query obsolete? Or possibly there is an error that I cannot see. In debug mode it does not throw any errors. I also declared and used an empty $args array as was suggested in the original post. Thought this was a very useful function and that more people than me were having trouble with it. Thanks.


title: Menu not saving in dashboard

text: I've created menus in wordpress dashboard countless times and never had a problem saving them until today. Getting this error: "The menu name Main Menu conflicts with another menu name. Please try another." Is this a permissions error or something else? I don't have another menu created. Hoping someone might have come across this and have some ideas. Thanks in advance.


title: How to get boolean if file A is attached to post B

text: I created a kind of customer area using several password-protected posts (for more details check this, but it's not necessary for this new issue: Give visitor access to password protected page/post via external script) On these posts there are several files attached via the plugin "Attachments" (http://wordpress.org/plugins/attachments/). Now, of course I want to prevent the capability to download the files via the direct access but just with the correct login data, so I googled and found this: http://www.stephenharris.info/2012/restricting-direct-access-to-files-in- wordpress/ Short review so you don't have to read it completely:   1. the root .htaccess file is modified so everything (also files in /upload/) will be redirected to index.php   2. an action/function called "maybe_load_file" is added which checks whether the request is coming from the uploads folder and if so outputs the file. My idea was to create a file like "download-redirect.php?id=x". It checks if file with the id x exists, if the referrer is an event post, and if the password cookie is valid. Then it should check **if file with the id x is attached to event/post xyz** , if all of this is true a session variable with password hash and stuff would be set and the user would be redirected to the file path (see above). In my function "maybe_load_file" I would recheck if the referrer is download-redirect.php and if the session variable is set correctly and then output the files. So this is my final question, sorry for my long introduction but I think it is necessary to understand the issue: _How can I check if a file A is attached (via the plugin "attachments") to post B?_


title: SQL query not working in alphabetical post title/content search

text:
I have an ajax request using wp_ajax sending one variable named "q" what I want to do is after the script get's the request to look inside the db and fetch the title and id of the corresponding posts that have either the title or the content "like" the variable so in other words here is my code :               global $wpdb;     $q = $_REQUEST['q'];     $sql = "SELECT * FROM wp_posts WHERE post_type = 'question' AND post_status = 'publish'                  AND post_title LIKE %s OR post_content LIKE %s";     $posts = $wpdb->get_results($wpdb->prepare($sql,like_escape($q),like_escape($q)));                      echo '
';                     foreach($posts as $post){                         echo '
ID).'">'.$post->post_title.'
';                     }                 echo '
';       now I have the following posts : test test 2 Lorem lipsum ... Lorem lipsum ... when I type "te" it should get all the posts because all of them contain "te" in their title but I get nothing on typing "tes" it should get the tow "test" but again I get nothing and so one but if i type the full word "test" it gives me the tow "test" posts for the other one it does not work at all . Can you please advise me on this ? It's getting annoying ... / _Edit_ / I have made the following changes :               $posts = $wpdb->get_results($wpdb->prepare($sql,'%'.like_escape($q).'%','%'.like_escape($q).'%'));      now what happens is that i get all the posts from the db it seams like it ignores the post_type and post_status clauses Regards, Paul.


title: How to set different users for different pages?

text: I am designing a site in which I wish to have different users (logged in) for different pages. Illustration: Suppose I have subscribers A,B,C,D,E,F and pages 1,2 and 3. I wish to have the follwing functionality: A can access pages 1,2 and not 3 B can access pages 1 and not 2 and 3 C can access all pages. I tried using the following plugins: Capability Manager Contexture page security members User access manager user groups page restrict (This can restrict the access of anonymous to certain pages and only logged in users can view locked pages.) But I'm not able get the functionality I require even after using any combinations of above plugins. Require some help, I'm a newbie. Thanks in advance.


title: Show a widget as a sidebar fallback

text: I'm trying to find a way to show a widget only if a given sidebar is empty. I'm using 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, but I'm not sure how to determine if the sidebar will be empty from inside that function. Unfortunately, the widget I want to use is from a 3rd party plugin, and I'd rather not rewrite it. So, I can't easily accomplish this in the source for the widget. **Update:** After looking at the answers and thinking about this more, I have a better understanding of the issue. There's no way to know whether or not a sidebar will be empty until after all of the widgets assigned to that sidebar have been "executed." So, while we are looping through widgets, we can't know if a fallback widget needs to be shown or not. What could work would be to specify a given widget as a fallback. Then, when we're looping through widgets we don't display the fallback, but we save a reference to it in some global variable. Then, when we output the sidebar, if nothing is output, we access our global variable and show the fallback widget. Does that make sense? It seems like a really convoluted solution, so I'm wondering if there's a simpler way.


title: How to allow special characters in comment name?

text: I was having this error that a random post said it had zero posts (using `comments_number()`) and when I went to the comment section it also said "No Comments" but it listed a comment. On a hunch I changed the name from "Name @ Website" to "Name - Website" and it started showing the correct post count. How do I allow special characters in the name?


title: Advice on using Custom Post Types

text: I have 8 custom post types for a lottery website I am currently working, one custom post type for each game that is in the lottery, but I am now wondering if this is the best way to go about this, would I be better off do you think in creating 1 custom post type called draw results, and having all the games results in this one custom post type, and then have categories to select for which game the results apply to, or should I stick with the 8 custom post types, and list them under a game information page in my menu as this is how I currently have it setup. Some games have 5 numbers then the bonus number, others have 6 numbers and the bonus, others have 2 bonus numbers, others have no bonus numbers, but I was just putting these into the wysiwyg editor not using custom fields, am not sure what to use as the title for each post also am thinking from an SEO point of view. Some games are televised, some arent so there will be custom things like presenter, and celebrity guest presenter, aswell as location in some rare cases, its not a big issue for these to be on all draw games even those that aren't televised. This I presume would use the custom meta fields. There could potentially be 8 categories 1 for each game, as I was intending to have a blog section on the site as to why I thought about using custom post types to keep the draw results seperate from the blog. The custom post types wouldn't be hierarchical, there could be 2 categories assign to each draw result one which would be the game it is for, and another which would be simply Draw Results perhaps? The categories and custom post types would be :-   * Lotto   * Lotto Plus 5   * EuroMillions   * Thunderball   * Lotto HotPicks   * Daily Play   * Dream Number   * Lotto Extra I'm in two minds as to what the best way would be, am also trying to think of this from an SEO point of view aswell.


title: Display custom meta box in my template file

text: Need help displaying my custom meta boxes on a template file. Following a tutorial Here's the code from my functions.php:               function get_custom_field( $value ) {     global $post;          $custom_field = get_post_meta( $post->ID, $value, true );     if ( !empty( $custom_field ) )         return is_array( $custom_field ) ? stripslashes_deep( $custom_field ) : stripslashes( wp_kses_decode_entities( $custom_field ) );              return false;      }          // Register the Metabox     function add_custom_meta_box() {         add_meta_box( 'meta-box', __( 'Candidate Information', 'textdomain' ), 'meta_box_output', 'page', 'normal', 'high' );     }     add_action( 'add_meta_boxes', 'add_custom_meta_box' );               // Output the Metabox     function meta_box_output( $post ) {         // create a nonce field         wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' ); ?>              <p>             <label for="textfield"><?php _e( 'Riding' ); ?>:</label>             <input type="text" name="textfield" id="textfield" value="<?php echo get_custom_field( 'textfield' ); ?>" size="50" />         </p>     <?php     }               // Save the Metabox values     function meta_box_save( $post_id ) {         // Stop the script when doing autosave         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;              // Verify the nonce. If insn't there, stop the script         if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;              // Stop the script if the user does not have edit permissions         if( !current_user_can( 'edit_post' ) ) return;              // Save the textfield         if( isset( $_POST['textfield'] ) )             update_post_meta( $post_id, 'textfield', esc_attr( $_POST['textfield'] ) );              }           add_action( 'save_post', 'meta_box_save' );`      And what I've used to call the meta box from within the loop on my 'content- page.php' file.               <?php get_custom_field('textfield') ?>      I'm new to this — it's my first experience with custom meta boxes — and I'm sure I'm making a simple error.


title: Preview post not allow for draft

text: I try to Preview post before I publish it in my site. But I get this error message: > You do not have permission to preview drafts. Why does it happen, and how can I stop that?


title: Moving site made easier

text: I have a HUGE pet peeve with Wordpress that honestly drives me crazy. Everytime you move the website, you have to go into the database in the new environment, and change in the table wp_options the "siteurl" and the "home". This is extremely annyoing. I wish that my "moving" procedure would be as simple as:   1. Copy file tree   2. Copy database   3. Done Is there a way to circumvent this?


title: woocommerce how do i add a message/notice in page title bar after page title?

text:
I have this in functions.php but it does nothing.               add_filter( 'woocommerce_page_title', 'my_page_title');     function woo_shop_page_title( $page_title ) {         if($page_title == 'Cart') {             return '
Cart
  Spend $200 to get free shipping!';     }          }


title: Can I get variable into dynamic sidebar?

text: How can I get a variable into a sidebar?               $sidebarnum = 4;          dynamic_sidebar('Footer Widget $sidebarnum'); ?>`


title: Category slug $_SERVER['REQUEST_URI'];

text: I'm not sure whats wrong with this line. Have I place this incorrectly? How do I get it to recognize the $yourcat->slug;                $cat = get_query_var('cat');      $yourcat = get_category ($cat);      $uri = $_SERVER['REQUEST_URI'];      if (($uri == '/category/$yourcat->slug;') {


title: Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?

text: I have spent hours today on a maddening issue I was having with displaying a custom post type. Everything displayed beautifully, except the pagination simply would not work properly. I have a page-template setup to display a "page of posts" (see Codex: Page of Posts) for a custom post type ('news'). I keep getting a 404 error when I click "Older Posts". I noticed a lot of other people have or had this problem. Why is this happening? Here is my query & loop code:               <?php          // Enable Pagination         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;              // The Args         $args= array(             'post_type' => 'news',             'paged' => $paged,             );              // The Query         query_posts($args);               // The Loop         while ( have_posts() ) : the_post(); ?>     // ...


title: Placing widget to menu

text: is there any way to display widget in menu. Actually what i want is "site stat" in the menu. (black area) At the right. link


title: ajax response -1 in wordpress theme

text: I am using ajax in wordpress theme,but ir response -1,why? how to correct this?               function videospage(cnt)     {         var pageno=cnt;              jQuery.ajax({               type: "POST",               url: "<?php echo admin_url('admin-ajax.php'); ?>",               data: {                   action: "myajaxpagination",                   pageno: pageno,               },               success: function(datas){                   alert(datas);               },               error: function(MLHttpRequest, textStatus, errorThrown){                   alert(errorThrown);               }           });            }          add_action('wp_ajax_myajaxpagination', 'my_action_pagination');       function my_action_pagination()     {         $pageno=$_REQUEST['pageno'];         echo $pageno;         die();     }


title: Menu administration, how to allow special charachters

text: I'm new to wordpress, i have created a website, for multilanguage solution i use qTranslation, my menus has also description and this is a problem, how can i allow special charcters here: Here is link for image of my problem: http://s10.postimg.org/9l16qlt61/menu.gif my code look so, but after saving are this charachters missing and a see content from both languages:               <!--:fr-->french content<!--:--><!--:it-->italian content<!--:-->


title: how to add a facebook page latest posts into my wordpress site

text: hi I want to show all the posts of a face-book page in my word press site. I tried "Embedded posts"..but when I give the URL of post it shows the preview as               "This Facebook post is no longer available.       It may have been removed or the privacy settings of the post may have changed."      what should I do for this? any alternative idea? the code i got for embedded post is:


title: How can I make the Twitter Tools plugin hyperlink every link?

text: It appears that (Twitter) shortened links are not auto-hyperlinked whilst non- shortened links are. Is there a patch to make all links hyperlinked - therefore clickable? E.g. http://cl.ly/image/3B2S3z472n0U http://wordpress.org/plugins/twitter-tools/


title: Retaining original image size

text: Since I have a website for **Comic reading** , if I use reduced image sizes, it will also reduce the text which will be difficult to read. I want to retain the image size. No problem even if it creates a scrolling window. The post width should adjust to the image. Anything that will work? I have tried setting 0,0 values in **Settings -> Media**.


title: redirect doesn't work while using example code

text:
I need a PHP page to be secured using wordpress login validation. Therefore I used this piece of code:               $args = array(         'echo' => true,         'redirect' => site_url( $_SERVER['REQUEST_URI'] ),          'form_id' => 'loginform',         'label_username' => __( 'Username' ),         'label_password' => __( 'Password' ),         'label_remember' => __( 'Remember Me' ),         'label_log_in' => __( 'Log In' ),         'id_username' => 'user_login',         'id_password' => 'user_pass',         'id_remember' => 'rememberme',         'id_submit' => 'wp-submit',         'remember' => true,         'value_username' => NULL,         'value_remember' => false );          wp_login_form( $args );      but the redirect doesn't work. When I login as admin user, I get redirected to the wp-admin page. When I login as a user, I get redirected to the front page. :-S so, I tried this:               function login_redirect( $redirect_to, $request, $user ){         return home_url(site_url( $_SERVER['REQUEST_URI'] ));     }          add_filter( 'login_redirect', 'login_redirect', 10, 3 );      Didn’t work… so I gave it a try with this (http://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect) Complete code:               <?php     header( 'Cache-Control: no-store, no-cache, must-revalidate' );     header( 'Cache-Control: post-check=0, pre-check=0', false );     header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );     header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );     header( 'Pragma: no-cache' );          require('../wp-load.php' );          get_header();          function my_login_redirect( $redirect_to, $request, $user ){         //is there a user to check?         global $user;         if( isset( $user->roles ) && is_array( $user->roles ) ) {             //check for admins             if( in_array( "administrator", $user->roles ) ) {                 // redirect them to the default place                 return $redirect_to;             } else {                 return home_url();             }         }         else {             return $redirect_to;         }     }          add_filter("login_redirect", "my_login_redirect", 10, 3);          if ( is_user_logged_in() )      {         echo "Hello. You are logged in
";         wp_loginout();     }     else     {         echo "Hello. please login
";              wp_login_form();         echo"I lost my password";     }          get_footer();      ?>      still...no success. I am using WP version 3.8 =========================================== # added the functions.php file from the theme               <?php     require_once('inc/Sidebar.php');          register_nav_menu( 'top-menu', 'Top Menu' );           /*      * Extending excerpt      */     function custom_excerpt_length( $length ) {         return 350;     }     add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );               //removing default "Continue Reading from Excerpt     function sbt_custom_excerpt_more( $output ) {         return preg_replace('/]+>Continue reading.*?<\/a>/i','',$output);     }     add_filter( 'get_the_excerpt', 'sbt_custom_excerpt_more', 20 );          //redirecting all users to dashboard (only subscribers on home)          function redirect_users($user_login, $user) {         if(!current_user_can("subscriber")) {             wp_redirect(get_admin_url());         }     }     add_action('wp_login', 'redirect_users', 1, 2);          function wpse126853_redirect_to_request( $redirect_to, $request, $user ) {         // instead of using $redirect_to we're redirecting back to $request         return $request;     }     add_filter( 'login_redirect', 'wpse126853_redirect_to_request', 10, 3 );     ?>


title: Share custom field value to twitter while saving custom field in wordpress

text:
I have created a custom field in wordpress which take 5 values from user as input and save them in the database. Now I need to know how to share those value on twitter during insertion. Following is the code snippet.. I have write in comments where i need that tweet code. Find the line with "Now i have the tweet content"               <?php          if( ! function_exists( 'quote_create_post_type2' ) ) :     function quote_create_post_type2() {         $labels = array(             'name' => __( 'ForexPair2' ),             'singular_name' => __( 'ForexPair2' ),             'add_new' => __( 'Add Pair Entry' ),             'all_items' => __( 'All Pairs' ),             'add_new_item' => __( 'Add Pair' ),             'edit_item' => __( 'Edit Pair' ),             'new_item' => __( 'New Pair' ),             'view_item' => __( 'View Pair' ),             'search_items' => __( 'Search Pairs' ),             'not_found' => __( 'No pair found' ),             'not_found_in_trash' => __( 'No pair found in trash' ),             'parent_item_colon' => __( 'Parent pair' )             //'menu_name' => default to 'name'         );         $args = array(             'labels' => $labels,             'public' => true,             'has_archive' => true,             'publicly_queryable' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'supports' => array(                 'title'             ),             'register_meta_box_cb' => 'quote_add_post_type_metabox2'         );         register_post_type( 'quote2', $args );         //flush_rewrite_rules();          }     add_action( 'init', 'quote_create_post_type2' );               function quote_add_post_type_metabox2() { // add the meta box         //add_meta_box( 'quote_metabox', 'quote_metabox', 'quote', 'normal' );         add_meta_box( 'quote_metabox2', 'Pair Entries', 'quote_metabox2', 'quote2', 'normal' );     }               function quote_metabox2() {         global $post2;         // Noncename needed to verify where the data originated         echo '<input type="hidden" name="quote_post_noncename2" id="quote_post_noncename2" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';              // Get the data if its already been entered         $quote_post_entryprice2 = get_post_meta($post2->ID, '_quote_post_entryprice2', true);         $quote_post_stoploss2 = get_post_meta($post2->ID, '_quote_post_stoploss2', true);         $quote_post_pairname2 = get_post_meta($post2->ID, '_quote_post_pairname2', true);         $quote_post_buysell2 = get_post_meta($post2->ID, '_quote_post_buysell2', true);         $quote_post_activity2 = get_post_meta($post2->ID, '_quote_post_activity2', true);         $quote_post_takeprofit2 = get_post_meta($post2->ID, '_quote_post_takeprofit2', true);         // Echo out the field         ?>

                    Pair2:     <select name="quote_post_pairname2" id="e4" style="width:144px;">       <option value="AUD/CAD" <?php if($quote_post_pairname2=="AUD/CAD") echo "selected"; ?> >AUD/CAD</option>      </select>

                 Buy Sell                     <select name="quote_post_buysell2" id="e5" style="width:144px;">                         <option value="Buy" <?php if($quote_post_buysell2=="Buy") echo "selected"; ?> >Buy</option>                         <option value="Sell" <?php if($quote_post_buysell2=="Sell") echo "selected"; ?> >Sell</option>                     </select>

                 Activity                     <select name="quote_post_activity2" id="e6" style="width:144px;">                         <option value="Get Ready" <?php if($quote_post_activity2=="Get Ready") echo "selected"; ?> >Get Ready</option>                         <option value="Active" <?php if($quote_post_activity2=="Active") echo "selected"; ?> >Active</option>                     </select>

                 Entry Price
                     <input type="text" name="quote_post_entryprice2" class="widefat" value="<?php echo $quote_post_entryprice2; ?>">

Stop Loss
                     <input type="text" name="quote_post_stoploss2" value="<?php echo $quote_post_stoploss2; ?>" class="widefat" />

Take Profit
                     <input type="text" name="quote_post_takeprofit2" value="<?php echo $quote_post_takeprofit2; ?>" class="widefat" />

     <?php     }          function quote_post_save_meta2( $post_id, $post2 ) { // save the data         // verify this came from the our screen and with proper authorization,         // because save_post can be triggered at other times         if( !wp_verify_nonce( $_POST['quote_post_noncename2'], plugin_basename(__FILE__) ) ) {             return $post2->ID;         }              // is the user allowed to edit the post or page?         if( ! current_user_can( 'edit_post', $post2->ID )){             return $post2->ID;         }         // ok, we're authenticated: we need to find and save the data         // we'll put it into an array to make it easier to loop though         ?>              <?php         //------------------Twitter Code Start Here ---------------//         $msg = "Grip Forex Updated Rates:\n";              $msg.="Entry Price: ";         $msg.=$_POST['quote_post_entryprice2'];              $msg.="\nStop/Loss: ";         $msg.=$_POST['quote_post_stoploss2'];              $msg.="\nPait Name: ";         $msg.=$_POST['quote_post_pairname2'];              $msg.="\nBuy/Sell: ";         $msg.=$_POST['quote_post_buysell2'];              $msg.="\nActivity: ";         $msg.=$_POST['quote_post_activity2'];              $msg.="\nTake Profit: ";         $msg.=$_POST['quote_post_takeprofit2'];              //Now I have the tweet content here i want to use twitter code to directly tweet from here ..          //Is this possible or suggest me another solution.              //---------------------Twitter Option Ends Here ---------------------//              $quote_post_meta['_quote_post_entryprice2'] = $_POST['quote_post_entryprice2'];         $quote_post_meta['_quote_post_stoploss2'] = $_POST['quote_post_stoploss2'];         $quote_post_meta['_quote_post_pairname2'] = $_POST['quote_post_pairname2'];         $quote_post_meta['_quote_post_buysell2'] = $_POST['quote_post_buysell2'];         $quote_post_meta['_quote_post_activity2'] = $_POST['quote_post_activity2'];         $quote_post_meta['_quote_post_takeprofit2'] = $_POST['quote_post_takeprofit2'];         // add values as custom fields         foreach( $quote_post_meta as $key => $value ) { // cycle through the $quote_post_meta array             // if( $post->post_type == 'revision' ) return; // don't store custom data twice             $value = implode(',', (array)$value); // if $value is an array, make it a CSV (unlikely)             if( get_post_meta( $post2->ID, $key, FALSE ) ) { // if the custom field already has a value                 update_post_meta($post2->ID, $key, $value);             } else { // if the custom field doesn't have a value                 add_post_meta( $post2->ID, $key, $value );             }             if( !$value ) { // delete if blank                 delete_post_meta( $post2->ID, $key );             }         }     }     add_action( 'save_post', 'quote_post_save_meta2', 1, 2 ); // save the custom fields     endif; // end of function_exists()      if( ! function_exists( 'view_quotes_posts2' ) ) : // output     function view_quotes_posts2( $num = 4, $do_shortcode = 1, $strip_shortcodes = 0 ) {         $args = array(             'numberposts'     => $num,             'offset'          => 0,             //'category'        => ,             'orderby'         => 'menu_order, post_date', // post_date, rand             'order'           => 'DESC',             //'include'         => ,             //'exclude'         => ,             //'meta_key'        => ,             //'meta_value'      => ,             'post_type'       => 'quote2',             //'post_mime_type'  => ,             //'post_parent'     => ,             'post_status'     => 'publish',             'suppress_filters' => true,         );              $posts = get_posts( $args );         global $wpdb;                $querystr = "select $wpdb->posts.*      FROM $wpdb->posts     WHERE $wpdb->posts.post_type = 'quote2'     ";         $html = '

Pair2	Action2	Status2	Entry Price2	Stop Loss2	Take Profit2
';         foreach ( $posts as $post2 ) {             $meta_entryprice2 = get_post_meta( $post2->ID, '_quote_post_entryprice2', true );             $meta_stoploss2 = get_post_meta( $post2->ID, '_quote_post_stoploss2', true );             $meta_pairname2 = get_post_meta( $post2->ID, '_quote_post_pairname2', true );             $meta_buysell2 = get_post_meta( $post2->ID, '_quote_post_buysell2', true );             $meta_activity2 = get_post_meta( $post2->ID, '_quote_post_activity2', true );             $meta_takeprofit2 = get_post_meta( $post2->ID, '_quote_post_takeprofit2', true );                       $html.='
';             $html .= '                          '.$meta_pairname2.'	                     '.$meta_buysell2.'	                     '.$meta_activity2.'	                     '.$meta_entryprice2.'	                          '.$meta_stoploss2.'	                          '.$meta_takeprofit2.'	             ';             $html.='
';         }         $html .="
";         $html = '
'.$html.'
';         return $html;     }     endif; // end of function_exists()


title: How we stop caching of particular div when i am using w3 total cache plugin?

text: I m using w3 total cache plugin with wooCommerce, it works fine but I have a single issue, which is, it caches the whole page but I do not want to cache the div that is showing amount of the cart. How can I do it?


title: How to return a different page than the one requested

text: **Description of the problem** I am now developing a plugin whose purpose is to change the contents of the page a user requested depending on different variables (like, for example, user's location). By default, when a user types the address http://example.com/foo/bar, the associated page (e.g. ID=1) is retrieved from the data base and sent back to the user. What I want to do, however, is to return page ID=1 only if the user is from the US; if she is from Germany, I'd like to return page ID=2... **Solution 1 (almost works, but it does not include all I need)** If only the content and/or title were to be changed, the solution seems pretty straight forward:               function change_title( $title, $id ) {        if ( $id == 1 && user_is_from_germany() ) {           $new_id = 2;           global $wpdb;           $aux_post = get_post( $new_id, ARRAY_A );           if ( $aux_post )              $title = $aux_post['post_title'];        }        return title;     }     add_filter( 'the_title', 'example_change_title', 10, 2 );          function example_change_content( $content ) {        // Similar as the function example_change_title     }     add_filter( 'the_content', 'example_change_content' );      Unfortunately, this is **not** what I need. I want to change the whole page, including any page attributes like its template (landing page, one-side bar, ...), theme-specific options related to the page, etc. **Solution 2 (almost works, but it changes the URL)** In order to change the whole page, I found the action `pre_get_posts`. Using this action, I can change the query that retrieves the page **before** it is returned to the user:               function change_page( $query ) {        $id = $query->get_vars['page_id'];        if ( $id == 1 && user_is_from_germany() )           $query->get_vars['page_id'] = 2;     }     add_action( 'pre_get_posts', change_page );      Unfortunately, changing the query before the page is returned changes the URL too (.../foo/bar becomes .../foo/bar2). **Question** Is there any way I can return the page I want without modifying the URL?


title: One set of categories for multiple custom posts

text: Hi I have a site which has 3 different custom post types. At the moment each post type has it own custom taxonomy which is linked to the post type like a native category. What I would like is one custom taxonomy which links to all three post types.


title: Template for custom post with custom taxonomy

text: The theme that I'm developing is basically a portfolio, where the projects are custom post type and they are divided in categories (custom taxonomies). Here is how I'm defining both:               $labels = array(         'name' => _x('My Portfolio', 'post type general name'),         'singular_name' => _x('Portfolio Item', 'post type singular name'),         'add_new' => _x('Add New', 'portfolio item'),         'add_new_item' => _x('Add New Portfolio Item', 'add new portfolio item'),         'edit_item' => _x('Edit Portfolio Item', 'edit portfolio item'),         'new_item' => _x('New Portfolio Item', 'new portfolio item'),         'view_item' => __('View Portfolio Item'),         'search_items' => __('Search Portfolio'),         'not_found' => __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );     $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'menu_icon' => null,         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => null,         'supports' => array(null)     );     register_post_type('portfolio', $args);          register_taxonomy('project_category', array('portfolio'), array(         'hierarchical' => true,         'label' => "Project Categories",         'singular_label' => "Project Category",         'rewrite' => true     ));      So in the homepage I'm listing all terms for the tax. "project_category" and I want a template file for a single term (for example, "jQuery Plugins" or "WordPress Themes") where I can list all project with that term. I looked in the WP template hierarchy and I believe the template that I need is               taxonomy-$taxonomy.php      My file is named taxonomy-project_category.php and it doesn't find it. I also tried with taxonomy.php, term.php, archive.php ... no success. I think the problem is with the links:               <a href="<?php echo $term->slug; ?>"><?php echo $term->name; ?>      Any ideas? Cheers


title: query_posts ignores the argument

text: The query_posts totally ignores the day argument. I'm trying this:               $day = date('j');     query_posts('day='.$day);          if (have_posts()):        while (have_posts()): the_post();        //show posts        endwhile;        wp_reset_query();     endif;      What I'm doing wrong?


title: what does $options = get_option('test_theme'); do?

text: I'm trying to set up theme options so they save with AJAX, I found this tutorial http://return-true.com/2010/01/using-ajax-in-your-wordpress-theme- admin/ it's calling               $options = get_option('test_theme');      but I don't understand what that is returning. it calls this right before the form, presumably to loop through the options? the data is actually getting saved, it's just not being represented when the page is refreshed.


title: Show all sticky posts, WITH pagination

text: Trying to get a custom admin link working for a custom post type. I've managed to add a link to show all "sticky" posts next to the usual "All", "Published", "Trash", etc., but the actual query isn't working as I'd like it to. In pre_get_posts, I'm trying to modify the query to do the following: \- show only sticky posts \- respect posts_per_page and pagination settings If I try this:               $query->set('post__in',  get_option('sticky_posts'));     $query->set('posts_per_page', 5);      ...I see all sticky posts, but no pagination. Does having "posts__in" set mean the posts_per_page is disregarded? Thanks for the info. Ditched "posts_per_page" but it didn't make a difference. My debug bar shows:               SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (2382,2358,2334,2331,2301,2298,2280,2262,2220,2226,2193,2157,2163,2136,2130,2109,2100,2084,2072,2026,2020,1961,1934,1846,1834,1756,1738,1709,1688,1552,1543,1498,1488,1482,1476,1438,1432,1412,1406,1400,1394,1391,1388,1358,1340,1319,1285,1282,1269,1227,1212,2621,2674,2659,3300,3313,3414,3560,3314) AND wp_posts.post_type = 'ad_listing' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC


title: Whole bunch of errors on WP website - media upload, edit slugs, edit screen not working

text: I am having a problem which I didn't meet before. I took a client website for just a small bunch of modifications, so I wasn't there when WordPress was installed or when the theme was developed.   But when I enter the admin area, I can not upload media, I can not edit slugs, and on top of all, the "edit" screen for pages and posts is not working: I can't see the text I am typing, I can't see the format buttons, I can't use the visual/html buttons (please see attached). The website in question uses Genesis framework along with a Genesis theme child. It has a bunch of plugins installed. Now I am asking you, in your experience, what could cause these problems?      \- WordPress was installed wrong   \- A plugin is causing the problems   \- It has something to do with Genesis   \- ...?   problem screenshot What do you think?


title: wp_editor() fields on Theme Options Page not saving

text:
_(This is sort of a follow-up tothis question.)_ I'm able to display the two WYSIWYG editors on my theme options page, but the values I enter into the editors aren't saved. I've read a ton of stuff about the Settings API and wp_editor() in hopes of making this work in the most WordPress-friendly way. I feel like I have yet to find a good explanation for how to make `wp_editor()` work in theme settings while still saving properly according to the Settings API. I'm getting the feeling that, despite the `wp_editor()` calls being in the relevant settings field callbacks, the Save process isn't realizing that the editors are associated with valid options. The relevant code from my theme options is below:               //register settings     add_action( 'admin_init', 'us_register_settings' );     function us_register_settings() {         add_settings_section( 'us_settings', 'Settings', 'us_settings_section_cb', 'us_options' );         register_setting( 'us_settings', 'us_authors_desc', 'us_sanitize_wysiwyg' );         register_setting( 'us_settings', 'us_partners_desc', 'us_sanitize_wysiwyg' );         add_settings_field( 'us_authors_desc', 'Author Archives Descriptions', 'us_authors_cb', 'us_options', 'us_settings' );         add_settings_field( 'us_partners_desc', 'Partners Archives Descriptions', 'us_partners_cb', 'us_options', 'us_settings' );     }          function us_settings_section_cb() {         // no need for text here right now     }          function us_authors_cb() {         $us_author_desc = get_option( 'us_authors_desc' );         echo wp_editor( $us_author_desc, 'usauthorsdesc' );     }          function us_partners_cb() {         $us_partners_desc = get_option( 'us_partners_desc' );         echo wp_editor( $us_partners_desc, 'uspartnersdesc' );     }          function us_sanitize_wysiwyg( $input ) {         return $input;     }          function us_options_page() {     ?>

Options
              <form method="post" action="options.php">              <?php         settings_fields( 'us_settings' );         do_settings_sections( 'us_options' );         ?>              <input name="Submit" class="button-primary" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />              </form>
          <?php     }      EDIT: Right now, I'm also not using a call back on my settings. Is that possibly the issue? UPDATE: Added callback function in code. No difference.


title: How do you update a network option value in the DB via a hook

text: I am trying to update the value of an option in the DB for all sites within my multisite, but no success here is the code, been pulling my hair out for the last 2 hours:               function simplifyit_upload_folder($blog_id){           switch_to_blog($blog_id);           update_option('uploads_use_yearmonth_folders', false);                 restore_current_blog();           }           add_action( 'update_wpmu_options', 'simplifyit_upload_folder' );      Thanks to @TheDeadMedic who gave me the answer for filtering but I am looking to update the value in the DB:               add_filter( 'option_uploads_use_yearmonth_folders', '__return_false', 100 );      Sorry for not being clearer I want to make sure that all blogs in the network are set by default to 0 for YYYYMM upload option but would like to have the possibility to let the Network administrator override it via the WP Network panel should he /she wish to do so for individual sites


title: Multiple category posts on one page

text: Is it possible to have a section on a page that shows 2 excerpts from 4 different category posts, including their featured images? All I have so far is something like:                           <?php query_posts("showposts=2&cat=11,12,13,14"); ?>                 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                    <?php the_excerpt(); ?>                    <?php featured-image(); ?>                 <?php endwhile; endif; ?>                      <?php wp_reset_query(); ?>      but I'm not sure if it would display 4 x 2 excerpts with a featured image in each excerpt? My custom categories have been added like this:               function event_post_example() {          register_post_type( 'event_type',         array(         'labels' => array(             'name' => __('Events Posts', 'baretheme'),             'singular_name' => __('Event Post', 'baretheme'),             'all_items' => __('All Event Posts', 'baretheme'),             'add_new' => __('Add New Event Post', 'baretheme'),             'add_new_item' => __('Add New Event Type', 'baretheme'),             'edit' => __( 'Edit', 'baretheme' ),             'edit_item' => __('Edit Post Types', 'baretheme'),             'new_item' => __('New Post Type', 'baretheme'),             'view_item' => __('View Post Type', 'baretheme'),             'search_items' => __('Search Post Type', 'baretheme'),             'not_found' =>  __('Nothing found in the Database.', 'baretheme'),             'not_found_in_trash' => __('Nothing found in Trash', 'baretheme'),             'parent_item_colon' => ''         ), /* end of arrays */         'description' => __( 'This is the example event post type', 'baretheme' ), /* Custom Type Description */         'public' => true,         'publicly_queryable' => true,         'exclude_from_search' => false,         'show_ui' => true,         'query_var' => true,         'menu_position' => 9,         'menu_icon' => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png',         'rewrite'   => array( 'slug' => 'event_type', 'with_front' => false ),         'has_archive' => 'event_type',         'capability_type' => 'post',         'hierarchical' => false,              'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky')         ) /* end of options */     ); /* end of register post type */          register_taxonomy( 'event_cat','event_type',         array(             'labels' => array(             'name' => __( 'Event Categories', 'baretheme' ),             'singular_name' => __( 'Event Category', 'baretheme' ),             'search_items' =>  __( 'Search Event Categories', 'baretheme' ),             'all_items' => __( 'All Event Categories', 'baretheme' ),             'parent_item' => __( 'Parent Event Category', 'baretheme' ),             'parent_item_colon' => __( 'Parent Event Category:', 'baretheme' ),             'edit_item' => __( 'Edit Event Category', 'baretheme' ),             'update_item' => __( 'Update Event Category', 'baretheme' ),             'add_new_item' => __( 'Add New Event Category', 'baretheme' ),             'new_item_name' => __( 'New Event Category Name', 'baretheme' )         ),         'hierarchical' => true,         'show_admin_column' => true,         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'event-slug' ),         )     );          register_taxonomy( 'event_tag','event_type',         array(             'labels' => array(             'name' => __( 'Event Tags', 'baretheme' ),             'singular_name' => __( 'Event Tag', 'baretheme' ),             'search_items' =>  __( 'Search Event Tags', 'baretheme' ),             'all_items' => __( 'All Event Tags', 'baretheme' ),             'parent_item' => __( 'Parent Event Tag', 'baretheme' ),             'parent_item_colon' => __( 'Parent Event Tag:', 'baretheme' ),             'edit_item' => __( 'Edit Event Tag', 'baretheme' ),             'update_item' => __( 'Update Event Tag', 'baretheme' ),             'add_new_item' => __( 'Add New Event Tag', 'baretheme' ),             'new_item_name' => __( 'New Event Tag Name', 'baretheme' )         ),         'hierarchical' => false,         'show_admin_column' => true,         'show_ui' => true,         'query_var' => true,         )     );     }          add_action( 'init', 'event_post_example');


title: Custom Taxonomy Template Variables Available?

text: I have a custom Taxonomy sports and want to edit the front-end display. I have got taxonomy-sports.php and used this code to get the data on the taxonomy, but I feel like it should already be available? Is there a simpler way to do this or is going into $wp_query the way to go?               $sport_slug = $wp_query->query_vars['sports'];     $the_sport = get_term_by( 'slug', $sport_slug, 'sports', ARRAY_A );     print_r($the_sport);      Basically I understand http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display but don't exactly know what is available to me and the best way to get to my taxonomy data on taxonomy-{sometax}.php Thanks, Andrew


title: Slider/text combination plugin

text: I think I may have painted myself into a corner. I need to find a plugin, if such a thing exists, that will be a slider/text combo. My client loves the way the pics on this page slide up to show some text:http://p3mma.com/. The sliders here look like they are a. all images and b. just some sort of javascript and not in WordPress. He would like, when there is a mouseover the image, text about the special event in the picture appear in place of the image. He does not have resources to make new images, so that is out. He will be able to handle uploading a pic and adding some text. To complicate matters, the rough I came up with had the image/rollover area with a kind of odd shape (Featured News Area on the top of the right column): http://blackbeltleadershipacademy.com/idea1and3-updated.jpg. I may, if I'm terribly clever, be able to figure out some css to do the shape (or close to it). So, any ideas how I can this area an **easily editable** rollover with text and images? Yeah, me neither.


title: Plugin can't write to database even though permissions appear correct?

text: I'm using the Formidable Form plugin, and when I try to add a form, the form isn't saved. According to the developer, the user does not have sufficient permissions to write to the database. Here's how my wp-config.php looks:               define('DB_NAME', 'wordpress_clouse');          /** MySQL database username */     define('DB_USER', 'wordpress_user');          /** MySQL database password */     define('DB_PASSWORD', 'mypass');          /** MySQL hostname */     define('DB_HOST', 'localhost');      wordpress_user has 'All Privileges' under phpMyAdmin, so I don't see where the discrepancy is. Why would the plugin be unable to write to the database if permissions appear in order?


title: How can add custom commands in post-new.php in wordpress

text: I am new here. I have a php code that create an html file and upload it inside a folder. How can i add my custom php code inside post-new.php so when the post is published to do this... Also i need to get the post future image path, post url and post title. Thank you all! MY code is:               $my_file = 'myindex.html';     $handle = fopen($my_file, 'w') or die('Cannot open file:  '.$my_file); //implicitly creates file          $stringData = "<!doctype html>\n";     fwrite($handle, $stringData);     $stringData = "\n";     fwrite($handle, $stringData);     $stringData = "\n";     fwrite($handle, $stringData);     $stringData = "<meta charset='utf-8'>\n";     fwrite($handle, $stringData);     $stringData = "<title>MyYiyle</title>\n";     fwrite($handle, $stringData);     $stringData = "<meta property='og:type' content='Article' />\n";     fwrite($handle, $stringData);     $stringData = "<meta property='og:image' content='' />\n";     fwrite($handle, $stringData);     $stringData = "<meta property='og:image:width' content='640' />\n";     fwrite($handle, $stringData);     $stringData = "<meta property='og:image:height' content='360' />\n";     fwrite($handle, $stringData);     $stringData = "<meta name='image' content='' /> \n";     fwrite($handle, $stringData);     $stringData = "\n";     fwrite($handle, $stringData);     $stringData = "\n";     fwrite($handle, $stringData);     $stringData = "\n";     fwrite($handle, $stringData);     $stringData = "\n";     fwrite($handle, $stringData);          if (fclose($handle)){               // FTP access parameters     $host = 'xxx';     $usr = 'xxx';     $pwd = 'xxx';          // file to move:     $local_file = './' . $my_file;     $ftp_path = '/newposts/' . $my_file;          // connect to FTP server (port 21)     $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");          // send access parameters     ftp_login($conn_id, $usr, $pwd) or die("Cannot login");          // turn on passive mode transfers (some servers need this)     //ftp_pasv ($conn_id, true);          // perform file upload     $upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII);          // check upload status:     print (!$upload) ? 'Cannot upload' : 'Upload complete';     print "\n";          /*     ** Chmod the file (just as example)     */          // If you are using PHP4 then you need to use this code:     // (because the "ftp_chmod" command is just available in PHP5+)          /*     if (!function_exists('ftp_chmod')) {        function ftp_chmod($ftp_stream, $mode, $filename){             return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename));        }     }      */          // try to chmod the new file to 666 (writeable)     /*     if (ftp_chmod($conn_id, 777, $ftp_path) !== false) {         print $ftp_path . " chmoded successfully to 666\n";     } else {         print "could not chmod $file\n";     }      */     // close the FTP stream     ftp_close($conn_id);               }


title: Will caching WordPress affect session variables, custom filed updates and displaying images from a non wordpress table?

text: I have a hybrid between a WordPress installation and another database with products data. I have custom php codes which pull product data from the external database. I want to cache everything that's WordPress but let the custom php codes function normally. Can this be done?


title: Display products for a category, sorted by post_excerpt

text: I'd like to display a list of products for a certain category, sorted by the post_excerpt. The original code I used was this:               $args = array(         'tax_query' => array(             array(                 'taxonomy' => 'product_cat',                 'field' => 'slug',                 'terms' => array( 'my-product-category' ),                 'operator' => 'IN'             )         ),         'orderby' => 'post_excerpt',          'order' => 'ASC'     );          $loop = new WP_Query( $args );          This displays the products, but the orderby is ignored in a taxonomy query. So I've changed the query to:               $args = array(                  'post_type' => 'product',                  'orderby' => 'post_excerpt',                  'order' => 'ASC',                 'product_cat' => 'My Product Category',                 'post_status' => 'publish'             );     $loop = new WP_Query( $args );       The products are displayed, but the orderby clause is still ignored.


title: Hightlight unread posts or new posts since last login

text: I have no idea where to start to find something like that. I could try with "visited link" and CSS but but that's not very powerfull. So do you think I could do something like : Last visit = 2 days ago (is there something to display that ?) This post was posted 1h ago This post is more recent than your last visit (login) So, highlight it please ! Please, take in consideration that we don't want to use cookies because we use different devices.


title: Display by tag from different post types

text: I'm trying to display posts within the WP loop and am able to successfully do so with `<?php query_posts('tag_id=10'); ?>` Here the loop will display all posts with the tag ID of 10, but I'd also like the loop to display posts from within a Custom Post type by the same tag. I'm able to successfully display posts with tag_id=10 that originate from a custom post type using `<?php query_posts('tag_id=10&post_type=videos'); ?>` But how can I merge the two? I gave this a shot: `<?php query_posts('tag_id=10', 'tag_id=10&post_type=videos'); ?>` but that had no effect (well actually it broke everything!)


title: Wordpress “Categories to tags converter” not working. Pointing to import.php instead

text: I just imported my posts from blogger into wordpress. In doing this, the tags were converted to categories for some strange reason. I am now trying to convert them back into tag using wordpress' built in converter. However, whenever I click on the "Category to tag converter" link, it directs me to the import page "/import.php". Is there anything i can do to rectify this. Alternatively, could someone please copy the end of the URL for the converter tool's page, and paste it here so i can append it to my blog URL. Im guessing that could work meanwhile. Cheers in advance..


title: How to enable the content editor as a droppable target with jQuery-ui?

text:
I'm trying to enable the WordPress content editor as a droppable using jQuery UI drag and drop. However, I can't get the drag to drop, or the drop event to fire. Is there something I'm missing?

drag one

drag two

drag three

          jQuery("#keywords").find("li").each(function(){jQuery(this).draggable(     {          helper:'clone',          start: function(event, ui){             jQuery(this).fadeTo('fast', 0.5);},              stop: function(event, ui) {                  jQuery(this).fadeTo(0, 1);                  }              });         });          jQuery('#content').droppable(     {          drop: function(event, ui)         {             alert('dropped in content'); //DOES NOT FIRE!!!             jQuery(this).dropIt(ui.draggable.html());         }      });          if(typeof tinyMCE=='object')     {          alert('tinyMCE is active'); //DOES NOT FIRE!!!         jQuery('#editorcontainer').droppable(         {              drop: function(event, ui)              {              alert('dropped in tinyMCE editor'); //DOES NOT FIRE!!!             //Dynamically add content             tinyMCE.activeEditor.execCommand('mceInsertContent', false, 'New content.');             }          });     }


title: Using wp_mail - verify that email was sent?

text: When using wp_mail, is there any way to verify that the email was sent correctly?


title: media page returnig to 404 in rtmedia

text: I am using rtmedia plugin with buddypress plugin to uploading audio, video and image uploading. I am using latest version of both the plugins. But when I browse to media page(i.e http://example.com/members/admin/media/) it returns to a 404 error, don't know what I am doing wrong. Please Help me.


title: Using Geo Data Store Plugin Code

text: I'm trying to simply use the Geo Data Store Plugin Code functions from within my theme files and have never done this. I've tested the $sc_gds to see if isset, yet not getting anything when looping the array (eventually to loop through them as map markers)               $type = "post_type";     $sc_gds = new sc_GeoDataStore();     $ids = (array) $sc_gds->getPostIDsOfInRange( $type, $radius, $lat, $lng );     foreach ($ids as $id) {     print $id;     }      Can someone explain how to use plugin file's public static functions and any information for using getPostIDsOfInRange would be appreciated greatly.


title: Make Permalink go to specific template

text: I have a single post page that contains an audio player. I need place a link on the page that will open up the player in a pop up window. Simple right? My thoughts were that I have an additional link using the_permalink open the post in a new window and just limit the loop to that new audio player. My question is how do I control what template the link (the_permalink) grabs? I'm familiar with the wordpress template hierarchy, and I don't want the permalink to grab single.php, instead i'd like it to grab pop-up-player.php template. Any idea how to do this? I've googled and searched stack exchange but can't seem to find anything related to what I'm trying to do.


title: Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?

text: I've added a `myvar/myvalue` rewrite endpoint to `EP_ALL` which can be added to any URL of a WP installation and a WP plugin will act upon it. That part is cool but it doesn't work when the permalink structure is `/%category%/%postname%/`. It works well with all the built in, selectable structures. There could be other structures it doesn't work with. **Doesn't work = 404 error.** The path looks something like this: `/mycategory/mypost/myvar/myvalue` I got the Rewrite analyzer plugin which tells me that it's interpreted as (top 4, in order): * * * This is not it... (highlighted with yellow) `(.?.+?)/myvar(/(.*))?/?$`   pagename: mycategory/mypost   myvar: myvalue * * * Apparently this gets used but it's still cold... `.?.+?/([^/]+)/myvar(/(.*))?/?$`   attachment: mypost   myvar: /myvalue * * * Plain wrong... `(.?.+?)(/[0-9]+)?/?$`   pagename: mycategory/mypost/myvar   page: /myvalue * * * **This is it, but it fails to realize it!** `(.+?)/([^/]+)/myvar(/(.*))?/?$`   category_name: mycategory   name: mypost   myvar: myvalue * * * And I'm outputting `global $query_string;` which tells me it's   `attachment=mypost&myvar=%2Fmyvalue` (by the way it shouldn't include the %2f - slash). So can someone enlighten me if this is a bug in WP, or is there something I can do about it? My idea is roughly this   `if ( '/%category%/%postname%/' == $wp_rewrite->permalink_structure ){ ... }`   and manually telling WP the category and the name and displaying that content. But I don't know what goes as `...` and what should I hook this into.


title: Wordpress Custom Post Type Front End Data Inputs by User

text: We created a custom post type "items" and its showing at admin end, now we want a user can insert a item from front end and this will be link to a menu item called "My Account" so a user can see his all inserted item and can add new item by clicking a link "Add New Item". How can we achieve this, any help will be highly appreciated.


title: Foreach displays from last to first

text: I created the foreach loop to display post images, but It displays them from last to first, how can I make It to displays from first to last ;) ?                    <?php $args = array(          'post_type' => 'attachment',         'numberposts' => -1,           'post_status' => null,            'post_parent' => $post->ID          );               $attachments = get_posts( $args );           if ( $attachments ) {        foreach ( $attachments as $attachment ) : ?>        <p>                               <?php echo wp_get_attachment_image( $attachment->ID, 'full' ); ?>           </p>             <?php endforeach;               }        ?>


title: Grab next post title in archive page

text: I am using a custom query on a page to display single posts from a specific category, one post per page. Here is my current query:               $results = new WP_Query( array(         'post_type' => 'post',         'posts_per_page' => 1,         'paged' => get_query_var( 'paged' ),         'cat' => 6         ) );      Right now I have pagination setup that displays < Previous and Next > links. I want to replace those links with the title of the next and previous. Is this possible to do since technically this does not live under a "Single" post but rather more of an archive inside of a page? I have tried `next_post_link()`, etc. but since I am only retrieving one post per page, this doesn't work. Ideas?


title: 'Attempt to modify property of non-object' warning

text: I use the bellow function to disable a plugin update. It works, because I use an old version of this plugin and it does not show me that a newer version exists, but, however, I get a warning on line 2: _Attempt to modify property of non-object_. How to fix this?               function my_filter_plugin_updates( $value ) {        unset( $value->response['duplicator/duplicator.php'] ); //Duplicator        return $value;     }          add_filter( 'site_transient_update_plugins', 'my_filter_plugin_updates' );         **UPDATE** I am not a PHP coder, so I do not know if what I did is correct, but this works - no errors, no warnings, no plugin update:               // Disable plugin update     function my_filter_plugin_updates() {        $value = new StdClass;        unset( $value->response['duplicator/duplicator.php'] ); //Duplicator        return $value;     }          add_filter( 'site_transient_update_plugins', 'my_filter_plugin_updates' );


title: Hierarchical Taxonomy Terms Select Menu Output with selected="selected" Set

text: I have been trying to wrap my head around a issue for the past 2 days but despite trying all I could, I can't seem to reach the solution. On the backend, I have a hierarchical taxonomy named "Programs" for the user object. The hierarchy is as follows:               Parent     --  Child     --- Grand Child      I have a frontend user settings form where I'm outputting the terms of this taxonomy using the following code:               $args = array('hide_empty' => false, 'hierarchical' => true, 'parent' => 0);      $terms = get_terms("program", $args);     $fieldName = "programs";          $html = '';     $html .= '<select name="' . $fieldName . '"' . 'class="programs"' . '>';     foreach ( $terms as $term ) {         $selected = $terms[0]->term_id;         $html .= "<option value='".$term->term_id."'".($selected == $term->term_id ? ' selected="selected"' : '').">" . $term->name . '</option>';              $args = array(             'hide_empty'    => false,              'hierarchical'  => true,              'parent'        => $term->term_id         );          $childterms = get_terms("program", $args);              foreach ( $childterms as $childterm ) {                 $selected = $childterms[0]->term_id;                  $html .= "<option value='".$term->term_id."'".($selected == $childterm->term_id ? ' selected="selected"' : '').">" . $term->name . ' > ' . $childterm->name . '</option>';                  $args = array('hide_empty' => false, 'hierarchical'  => true, 'parent' => $childterm->term_id);              $granchildterms = get_terms("program", $args);                  foreach ( $granchildterms as $granchild ) {                     $selected = $granchildterms[0]->term_id;                 $html .= "<option value='".$term->term_id."'".($selected == $granchild->term_id ? ' selected="selected"' : '').">" . $term->name . ' > ' . $childterm->name . ' > ' . $granchild->name . '</option>';             }         }     }     $html .=  "</select>";     echo $html;      This code outputs the following HTML and although when I submit the form, the correct taxonomy term is getting saved in the database, the frontend form always shows "Grand Child 1" as selected, even if "parent" or "child" is set in the database. I also see the first 3 options are getting set as selected while only one should be set as selected at any given time :               <select name="programs" class="programs">         <option value="6" selected="selected">Parent</option>             <option value="7" selected="selected">Parent > Child 1</option>                 <option value="8" selected="selected">Parent > Child 1 > Grand Child 1</option>              <option value="9">Child 2</option>     </select>      Here is a dump of the $terms (parent) variable:               Array     (     [0] => stdClass Object         (             [term_id] => 6             [name] => Parent             [slug] => parent             [term_group] => 0             [term_taxonomy_id] => 6             [taxonomy] => program             [description] =>              [parent] => 0             [count] => 0         )          )     1      Kindly help! Thanks a lot!


title: Is it possible to create nested lists in the WYSIWYG editor?

text: I'm looking to set up WP for a user that does not know or care about HTML, so I need everything to work in the WYSIWYG editor. She'll be working on posts that have lots of nested bullet lists, but I can't seem to figure out how to make it work. Any thoughts? Tabbing didn't work, clicking the buttons didn't work. Hitting 'indent' could be hacked into a solution, but it's certainly not ideal and I don't know how consistent it'll be. I know I can fiddle with the HTML, but like I said, I don't want to get into that. I can copy/paste from Word, but that's a terrible solution. I'm open to a plugin or alternate editor, though that's not ideal either.


title: Display Custom Taxonomy

text: I am using custom post types in a theme optimized for web radios (custom theme). I added a custom post type called "Radio Shows" and registered two custom taxonomies: one hierarchical (like default "categories", I named it GENRE) and the other is not (like "tags", I named it INSTRUMENTS). I've managed to get that custom post type's posts displayed in index.php with the rest of the default post type's posts and also created a page template that displays only the custom post type's posts (Radio Shows).   It works fine, I can see them being displayed normally, in correct order etc. What's not being displayed in both pages (index & template page dedicated to custom post type) is the custom taxonomies. In default posts, inside the loop are being displayed:   1. CATEGORIES   2. TITLE   3. THUMBNAILS   4. CONTENT   5. TAGS.  What I want to achieve is to get GENRE & INSTRUMENT custom taxonomies displayed in the place that CATEGORIES & TAGS do in default post types. Normally I should tell you what I have tried so far... well, I tried at least 20 ways I found on several tutorial websites so it's difficult to list them. None of them worked for me.


title: add image size still doesn't work even after regenerating thumbnails

text: I'm encountering this very frustrating problem where `add_image_size()` just doesn't seem to work at all (in fact, I've never seen it even work before). By not working, I mean not resizing / crop (if I take away my CSS width / height, the thumbnail will be the exact size in which I have uploaded it). I do have:   1. `add_theme_support( 'post-thumbnails' )`   2. `add_image_size( 'small-thumb', 60, 60, true )`   3. `the_post_thumbnail( 'small-thumb' )`   4. And most importantly, yes I've been regenerating my thumbnails close to 50 times now after changing the `add_image_size()` and it's not working. Now I do have a question related to this problem: Does CSS styling like `max- width`/ `max-height`/ `width` / `height` or anything effect WordPress' thumbnail functions? Anyone seem to know what else I can try to fix this? Thanks


title: Get post meta in enqueued js file

text: I am writing a plugin in which I have a js file. I enqueue it with wp_enqueue_script. In this file I have some functions. The functions are triggered by an onclick event of a button. The button is located on edit post page. Now I need those functions to get post meta of the edited post, modify and save. Does anyone have any idea how to do it?


title: Enforcing canonical URLs with multiple custom post types

text: I'm working on a project with several custom post types, where one of the post types is naturally (but not actually in the WordPress sense) the 'parent' of the others. For example, say I have a custom post type called 'book' and another one called 'character', and say I want to have the following custom URL structure:               books/[book-name]/characters/[character-name]      Thus, the canonical URL for the post about the character Thing One in the book The Cat In the Hat would be:                books/cat-in-the-hat/characters/thing-one      A character is associated with a book with a post meta row. I've created custom rewrites to make it work...               add_rewrite_rule (         '^books/([^\/]+)/characters/([^\/]+)/?$',         'index.php?book=$matches[1]&character=$matches[2]&post_type=character'     );      ...but I'd also need to make sure that the 'character post' in the URL belongs to the 'book'...               books/cat-in-the-hat/characters/thing-one     //good     books/anna-karenina/characters/count-vronsky  //good     books/anna-karenina/characters/thing-one      //bad      This can't happen automatically: I have to hook into a filter or an action to check whether the character matches the book, and if not, either redirect to the correct, canonical URL or force a 404. Where's the best place to accomplish this check? My choices (so far) are:   * The `request` filter -- i.e. checking before the main query is instantiated.   * The various WP_Query filters -- i.e. make WP_Query do the checking for me by adding a post meta constraint. I realize this is rather an open-ended question and probably a matter of taste, but any insight into the most code and database efficient way of doing things would be appreciated. Thanks.


title: Missing the first 6 Posts and displaying posts that are after the latest 6

text:
Is it possible to run an array to not show the first 6 posts, but then to show posts labeled 7-15 say? So that way I can display the first 6 posts elsewhere and then the rest somewhere else? More Information: I have a site here: http://universitycompare.com/student-info and I would like the site to display the first 6 post's in images and then the rest as text below in the 'more articles' section. Any more help needed to answer just let me know, the more control over this the better, so I would like to run them separately. If you need to know my PHP that I am using see below: (I have left the HTML mark up in for the mean time so you know how i'm changing the style of it).                   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <?php $the_query = new WP_Query( 'showposts=6' ); ?>         <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

         <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() )         the_post_thumbnail('si-images');?>

<a href="<?php the_permalink() ?>"><?php the_title(); ?>

 Date:           <a style="color:#154157;" href="<?php the_permalink() ?>">         <?php the_time( get_option( 'date_format' ) ) ?>

         <?php endwhile;?>

                              <?php endwhile; endif; ?>


title: Redirect user to a particular link in 10 seconds after using wp_die

text: I want to use some type of functionality               if ( $some_condition == false )     {         wp_die();         // Here i want to redirect page on some URL after 10 seconds     }      I need to do it inside a plugin. Is it possible to do that?


title: Removing an action, or dequeueing style - Both not working

text: What I am wanting to achieve is to remove an action called inside of another action. The action is calling a style, and although I have tried to deregister, and dequeue the style, it is still displaying on the admin pages. Here is the code snippet (inside of WooCommerce):               function woocommerce_admin_menu() {         global $menu, $woocommerce;...              $print_css_on = apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'woocommerce_page_woocommerce_status', 'product_page_woocommerce_attributes', 'edit-tags.php', 'edit.php', 'index.php', 'post-new.php', 'post.php' ) );              foreach ( $print_css_on as $page )             add_action( 'admin_print_styles-'. $page, 'woocommerce_admin_css' );     }     add_action('admin_menu', 'woocommerce_admin_menu', 9);      What I've tried to do:               add_action('init', 'remove_action_123', 999);     function remove_action_123() {             $print_css_on = apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'woocommerce_page_woocommerce_status', 'product_page_woocommerce_attributes', 'edit-tags.php', 'edit.php', 'index.php', 'post-new.php', 'post.php' ) );add_action('init', 'remove_action', 999);                  // Remove 'woocommerce_admin_menu'         foreach ( $print_css_on as $page )         remove_action( 'admin_print_styles-'. $page, 'woocommerce_admin_css' );     }      This is how it's being enqueued:               function woocommerce_admin_css() {         global $woocommerce, $typenow, $post, $wp_scripts;...              if ( $typenow == '' || $typenow == "product" || $typenow == "shop_order" || $typenow == "shop_coupon" ) {             wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css' );         }              do_action('woocommerce_admin_css');     }      So I also tried:               wp_dequeue_style( 'woocommerce_admin_styles' )      But it is still not working. Any ideas on how to successfully remove this css? Thanks! Roc.


title: How to assign a Permalink to a Function

text: In Drupal, you can assign a URI to a function that gets called, like this:               function mymodule_menu() {         return array(             'custom_uri' => array(                 'page callback' => 'my_custom_function',                 [...]             );         );     }      This then tells Drupal to call the function `my_custom_function` whenever the url is `http://www.mysite.com/custom_uri`. In Wordpress I'm trying to accomplish the same idea. I want to have a custom URI that somehow calls a function to render output. From what I've found I can use WP_Rewrite to turn a permalink into a query string and then check for the query string in my plugin. Going that route, how would I display my own content in the site's theme? The other option I've seen is to do it via a shortcode, but then that means either the user generates a page or I do it programmatically (and then probably use WP_Rewrite to set up a custom permalink). This seems messy and I'd rather the user not have to worry about doing any work. Are there any more options?


title: Custom WP_Query with complex 'post_status' argument

text: I'm trying to run a `WP_Query()` with a bit of a twist. I need to include two `post_status`es and specifically exclude another. I've got `WP_Query( array( 'post_status' => array( 'publish', 'customstatus' ) ) );` which works, but it seems to also pull in `auto-draft`, which I can NOT have. Is there a way to do like `'post_status' => array( array('publish', 'customstatus'), 'not_in' => 'auto- draft' ))` where I can include two and exclude one explicitly?


title: Get a single post by a unique meta value

text: Is there a fast way to retrieve a specific post by a unique meta value? I could run a meta_query and then loop through the first value to get the post's ID, but I am wondering if there is any other that I am overlooking. Is it possible to add a column to the wp_posts table? Or is there some other way to add a second unique number to each post? To explain I need to take a WooCommerce order (which is just a post type called 'shop_order') and send it to a 3rd party and they send back a unique reference from their system, which so far I have stored as meta. Normally I would send them the post ID as the order number, because when they send their info back with the post ID as order number it is easy to then set the post meta with the additional info they send. However, there is another plugin ( called Sequential Order numbers ) which filters the post IDs to always show a sequential number. This makes great sense from a human-readable point of view. However, I can't send this sequential order number because when it comes back to me I can't use that value to `update_post_meta` since it isn't post ID in the database. If I send them the actual post ID and the two sides ever have to talk in person they won't be referencing the same order ID number which would be confusing I think (much like this question). So again to try to restate my question... is there a more efficient way to get a post by a second unique value that isn't the post ID?


title: Exclude featured image from gallery in wp-admin

text: Is there a way to prevent the featured image from even showing up in a post's gallery? e.g. when editing the gallery in the admin for a post, the featured image isn't there.


title: Pagination with wp_pagenavi not working on custom page

text:
I am having trouble with `wp_pagenavi` working on the start page using a custom query. It's working well on every standard template like category.php. But not on the homepage. Here is the code:               <?php                  $args=query_posts(array(               'post__not_in'=> array(419),               'post_type' => 'post',               'posts_per_page' => 10,               'paged' => get_query_var('page'), ));                  $my_query = new WP_Query($args);             if( $my_query->have_posts() ) {                    while ($my_query->have_posts()) : $my_query->the_post(); ?>         <?php             $featuredImage = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );                  $s1=strtolower($title);                 ?>         <div id="post-<?php echo $post->ID;?>" <?php $item_format = is_video() ? 'video' : 'post'; post_class('item cf item-'.$item_format); ?>>
             <?PHP 'Id.'" title="'.esc_attr(get_the_title($post->Id)).'" href="'.get_permalink($post->Id).'">'?>                  <a class="clip-link"  title="<?php the_title();?>" href="<?php the_permalink();?>" rel="bookmark">                                              <?php echo'Id)).'" />';?>

              <?php               endwhile;          global $my_query;          $total_pages = $my_query->max_num_pages;                    if($total_pages > 1)              { ?>

                         <?php                          if(function_exists('wp_pagenavi')) {                             wp_pagenavi();                         } else {                             $label = __('« Prev', 'dp');                             if($prev = get_previous_posts_link($label))                                 echo str_replace('<a', '<a clas="prev"', $prev);                             else                                 echo ''.$label.'';                                  $label = __('Next »', 'dp');                             if($next = get_next_posts_link($label))                                 echo str_replace('<a', '<a class="next"', $next);                             else                                 echo ''.$label.'';                         } ?>

         <?php      }          }                wp_reset_query();  // Restore global post data stomped by the_post().         ?>

      The pagination shows up, but the url `/page/2/` is not working, it shows `/page/1/` result.


title: Styling Contact Form 7 fields

text: We are using wordpress plugin contact form 7 and want to specify the width of the subject field (assume answer would apply to setting width of any field) and relocate the Your Email next to the Your Name field. Result would be Email and Name on one line, Subject full width underneath, Your Message underneath Subject. Thanks


title: Purchased Theme to Custom Made Theme?

text: I bought a theme from Themeforest and now I would like to convert it to a custom made theme. I was creating the theme with the Underscores theme: http://underscores.me/ but how do I keep the same custom post types in the next theme? Is this less time consuming than recoding the purchased theme?


title: Admin Panel Menu Classes - Add Them To Anchor

text: I was wondering if there was a way to apply the classes you assign in the Admin Panel Menus to the Anchor Tags instead of The List Items. I tried to use a Walker Class to maybe get the classes out that way but it looks like by the time it gets there they're already in the `$classes` variable (if we're looking at The Walker in The Codex) and the only way I can imagine getting them out is to search the array (or string). `$classes = empty( $item->classes ) ? array() : (array) $item->classes;` Is there a specific way to get those specific classes only that you can assign in the admin panel via Walker or some kind of filter? There is a way using `preg_grep()` but if you're not using font-awesome and your classes are actually unique, this won't work. . . WordPress has to be saving this data somewhere.


title: Single page theme: Can I render other pages with their respective themes within another page?

text:
I'm trying to create a one page theme. I need all the pages created by the admin to show up on one page. I used the following code I found in a similar question in here:               foreach ($pages as $page_data) {         $content = apply_filters('the_content', $page_data->post_content);         $title = $page_data->post_title;         $slug = $page_data->post_name;         echo "
";         echo "
$title
";         echo $content;         echo "
";     }      The problem with this code is that it does not render the page according to the template provided for that page. Is it possible to have each page rendered as they would if their URL was visited? Which leads to my next question; once this is done, a lot of bloat must be loaded (eg. a header, menu, footer etc. for each page). Is it possible for the page template to know if it is being rendered as the "main view" / only view, or is being rendered as part of something else? I'm quite sure this question must have been asked a million times, but I can't seem to find any answers in regard to rendering the view according to the templates, so I hope I don't baffle anyone just by asking :)


title: How to solve the fopen error?

text: I recently updated xampp to 1.8 and enabled xdebug. I'm not sure if this is the reason for this error message which I didn't see before:               Warning: fopen(http://api.wordpress.org/plugins/info/1.0/): in C:\xampp\htdocs\wodpress\wp-includes\class-http.php on line 923      Maybe I did something wrong at server configure. but there isn't really anything more than enable xdebug. Need help!


title: manipulate a plugins shortcode

text: I want to add some javascript directly below content, added by another plugin's shortcode. We are using the NextGen Gallery plugin and there are many articles containing the [nggallery] shortcode. I don't want to change all articles and I don't want to inform all authors to use another shortcode in the future. And I also don't want to modify the original plugin. Is there a way to modify a shortcode like:               function put_script_after_nggallery_shortcode( $atts ){      return "[nggallery $atts] <script>foo();</script>";     }     add_shortcode( 'nggallery', 'put_script_after_nggallery_shortcode' );      or should I hook somehow into the rendering process of the_content() to put my script directily in the_content string after [nggallery id=nnn]. Could that be done with a filter for the_content?


title: Permalinks, how to show them in post

text: So I created page               www.example.com/NEWS/       and I want all the posts from that category to show up there. It does that, but when I add a post (NEWS), the link is :               www.example.com/newpost/       I want to show it as               www.example.com/NEWS/newpost/      Thanks :)


title: How to log database changes during an upgrade?

text: I have Wordpress installed in a classical LAMP configuration. Is there any way to, in a protected environment (like staging), automatically log all database changes (i.e. drop indexes or alter tables) done by a wordpress upgrade process?


title: Automatic excerpts

text: How to display excerpts in the homepage instead of full post automatically, without the need to insert `<!--more-->` in every post ? I tried this plugin http://wordpress.org/extend/plugins/advanced-excerpt/ which or doesn't work or I can't use it. Here's how I configure it http://wordpress.org/support/topic/plugin-advanced- excerpt-doesnt-work-installed-by-instructions-url- included?replies=1#post-2810718 This is my website. **I solved the problem using Michael's answer, which made my plugin work.** http://wordpress.org/extend/plugins/advanced-excerpt/


title: How to copy/paste web content with photos into my blog

text: I use my wordpress blog for research... When I write about something, the firs thing I do is research of what's already out there on given topic. What I want to do is to be able to copy paste parts of the web pages for reference... If the page is only text... that's grand. But If the page contains pictures, I can't copy that image to my research blog easily... is there a plugin which would allow me to copy parts of webpages (with pictures) into my blog - same as I was using microsoft word for note taking. Thanks Edit: Actually I need something which will enable me to use my wordpress as evernote... I want to store content on my blog and be able to access it later... Easily


title: contextual_help, change the "Help" tab label

text: Is there any way to change the "Help" tabs label? I speak about the top right tab to toggle the contextual help. I'm looking to change "Help" label by "Documentation". I work on WordPress 3.3 and 3.4 beta Thanks for your advices


title: Removing widget without using unregister_widget

text: I want to remove some plugin widget showing from wp-admin/widgets.php but i dont want to use unregister_widget because i am using this widget automatically from php files.. Basically i dont want clients see this widget as option in wp- admin/widgets.php but i want to use this widget from php files. I thought css display:none as solution but widget div IDs are not static seems Any idea?


title: Get blog id of subdirectory multisite blog from name - *outside* of wordpress request processing

text: I have a Zend Framework 1.11.1 MVC application that has Wordpress 3.7.1 installed as a subdirectory multisite network below its "public" directory. It uses must-use plugins to ensure that only logged-in users of the MVC application can access any of the blogs. Basically, the earliest MU plugin runs the ZF application's bootstrap to get access to the ZF logged-in state, and hooks 'after-setup-theme' to a function that checks the MVC login state and permissions database and either just returns to allow access, or redirects to a page in the MVC application that explains why access to the blog was not allowed. It's actually a bit more complicated (e.g. it creates a blog on the fly for a logged-in MVC user if one doesn't already exist), but that's the gist of it. Within the plugins, I can call `get_blog_id_from_url` to get the blog id from the request, and in principle it would return 0 if there is no such blog. But if the request is for a blog that does not exist, then I get a 404 before any must use plugin runs. I can work around that by issuing the requests to the root blog, and passing the site name information as a GET parameter. But what I'd really like to do is have the MVC application code check for the existence of a particular blog, **without actually issuing a request to wordpress**. I guess I could explicitly connect to the wordpress database and query the wp_blogs table, but I wanted to avoid getting that "intimate" with the wordpress code. But figuring out the load dependencies needed in order to be able to call `get_blog_id_from_url` from MVC code was pretty tough. I wound up trying something like this:               public function get_blog_id_for_mvc_request($blogname) {         global $wpdb;         $orig_uri = $_SERVER['REQUEST_URI'];         // $_SERVER['REQUEST_URI'] = PATH_CURRENT_SITE;         // but PATH_CURRENT_SITE is not yet defined, so hardwire for now         $_SERVER['REQUEST_URI'] = '/wp/';         require_once(APPLICATION_PATH . '/../public/wp/wp-load.php');         $site_id = get_blog_id_from_url(DOMAIN_CURRENT_SITE, PATH_CURRENT_SITE . (strlen($blogname) ? "$blogname/" : ""));         $_SERVER['REQUEST_URI'] = $orig_uri;         return $site_id;     }      Modifying and restoring $_SERVER['REQUEST_URI'] made me feel pretty queasy, but looking at the wordpress code there appeared to be no other way. This function actually did work in terms of getting the correct site id and continuing on to the MVC page that used the site id. But after the page was rendered in the browser, httpd crashed (Apache 2.2.14 with PHP 5.3.1 on XP): ![enter image description here](http://i.stack.imgur.com/fbRQk.jpg) Does anyone have any suggestions, either for tracking down/fixing the server crash, or for accessing the database directly in a simple and reliable way?


title: What Does this Code Snippet Do?

text: I got this error message when I was installing a plugin: "Unable to locate WordPress Content directory (wp-content)". I found a solution here: http://wordpress.org/support/topic/cannot-find- content-directory-wp-content They suggested adding the following code to the wp-config.php file:               if(is_admin()) {         add_filter('filesystem_method', create_function('$a', 'return "direct";' ));         define( 'FS_CHMOD_DIR', 0751 );     }      This solution worked for me. My questions are: a) What does this code do? b) If I run into the same error on the production server is it safe to use this code? Thank you. -Laxmidi


title: Sticky Posts Not Sticking to Top of Category Archive

text: I'm using my index.php to display post archive pages rather than a specific archive.php file. This works fine, however sticky posts do not stick to the top of it. They do however, stick to the top of the posts page. Are sticky posts not supposed to stick to the top of archive pages? Here is the code for the loop I'm using; loop-index.php \- http://pastebin.com/NHi2tsNM Am I doing something wrong? Or is this just default functionality?


title: debug notice on my WordPress site

text: How can i see notice and warning on WordPress site. Like Notice: undefined variable on line 29. my client have point out these Notice while i am unable to see these notice any help please


title: Is it wrong to use the English version of WordPress to server a site in a different language?

text: I'm building an online store for an Indonesian market, so the front-end must be in Bahasa Indonesian. Will using the English version of WP, and a theme in English without .po files, introduce complications/errors/bad experience if the content is in Bahasa Indonesia? Ie. Incorrect language attributes. Or is it ok to use the English version of WP and fill it with content written in Bahasa Indonesia?


title: How to show a feed that requires user/pass within a sidebar widget?

text: I'm trying to do something and I don't seem to yield any successful results when searching neither at wordpress.org forums nor here. I would like to extend the standard RSS widget so that I can set an user/password for HTTP Authentication in order to fetch the feed items. If there is an existing solution that I'm missing and already provides this feature, any pointer will be much appreciated. Thanks.