title: Associate an image with a category?

text: Is it possible to associate an image with a category in Wordpress? I'm outputting a list of all categories and would like to feature an image alongside each category name.


title: Use WP_Query or query_posts() or get_posts() for optimizing a site?

text: I have read other answers, but I don't understand which is more fast (the best and simple for slow server running)? I have a website with over 1 000 000 hits /day and a slow server with limitations at database connections, so I want to optimise my site. What do you recommend me to use: WP_Query or query_posts() or get_posts()? And if I want to show articles in different positions, with different styles can I repeat the function [WP_Query or query_posts() or get_posts()] on every article that I show, or it is best to use it one time and use if $i == 1,2,3 for different styles?


title: Which filters or actions involve with index page for plugin?

text: I decide to manipulate index page or all pages except admin page with plugin but I don't know which filters or actions control index page. for example if I want write plugin that shows a link to admin page which filter or action responsible for it?


title: Inserting HTML elements into table with TinyMCE, security

text: I am working on a wordpress plugin where the administrator can fill out a form that adds products to a table. For most inputs I am using `sanitize_text_field()`, and then inserting the data. But for the description field I am using TinyMCE, and I want the user to be able to paste paypal buttons into it. This means that elements and elements would need to be allowed. I am new to the whole security thing, so I am wondering if there a secure way to do this? For output sanitization I am thinking of using `wp_kses()` sort of like this               $allowed_html = array(         'form' => array(),         'input' => array()     );          wp_kses($string, $allowed_html, $allowed_protocols);      Now that I think about it, `wp_kses()` could be used the same way for input validation as well. Would this be secure? Thanks


title: Any way to update_post_meta with html content? It gets stripped and becomes empty

text:
So I am cloning some divs created from an array using jQuery. Here is an example. I have a drop down list that contains items to add to the meta box. The add button clones a hidden div based on the name in the drop down that matches the rel of the div. This then gets appended into my meta box. So it ends up looking like this.                       echo '
';             // content gets cloned into here             // example div that gets added

                             <input type="button" value="+" class="increase-size">                             <input type="button" value="-" class="decrease-size">                             Quote
                         <input type="hidden" id="page-option-item-type" class="page-option-item-type" value="Tab" name="">                         <input type="hidden" id="page-option-item-size" class="page-option-item-size" value="element1-4" name="">
                             1/4
                                         <input type="button" value="edit" rel="edit-box" id="page-element-edit-box" class="edit-element">                                         <input type="button" value="Remove" class="remove-element" id="delete-element">

Quote
                     <input type="text" id="_cmb_page-option-quote" name="_cmb_page-option-quote" class="cmb_text_small">

             // end example div that gets added                  // getting the values for displaying after save             $values = get_post_custom( $post->ID );             $selected = isset( $values['addddData'] ) ? $values['addddData'][0] : '';             echo $selected;             echo '
';               // Save data from metabox     function save( $post_id, $post )  {              // verify nonce         if ( ! isset( $_POST['wp_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['wp_meta_box_nonce'], basename(__FILE__) ) ) {             return $post_id;         }              // check autosave         if ( defined('DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {             return $post_id;         }              // check permissions         if ( 'page' == $_POST['post_type'] ) {             if ( !current_user_can( 'edit_page', $post_id ) ) {                 return $post_id;             }         } elseif ( !current_user_can( 'edit_post', $post_id ) ) {             return $post_id;         }              $cloned = $_POST['page_selected_elements'];         update_post_meta( $post_id, 'addddData', $cloned );              //print_r($_POST);              }      Now the problem is it will not save the contents inside of the div page_selected_elements I can see the key is added via phpmyadmin, but the meta_value is always empty when I save after cloning items "adding items from drop down". As a test I manually edited the meta_value using phpmyadmin and pasted the example clone div as the value, refreshed and the div was displayed. However once I updated the page the value was removed. As a test I changed the div page_selected_elements to a textarea to test my save function, and that works just fine, text I enter into the text area gets updated and displayed back on the page after the update. Can anyone think what the problem might be? Could it have to do with dynamically added content? Maybe the update is not seeing it. I see the cloned items the whole time during the update but once it reloads the page they are gone and the meta_value is empty.


title: Multisite in subfolder - How to make new sites to be in same level subfolders as the main site

text: I have following situation. I have a WP Multisite installed in subdirectory:               my-domain.com/subfolder/wp-multisite-root      Now normally next sites added would be created like that               my-domain.com/subfolder/wp-multisite-root     my-domain.com/subfolder/wp-multisite-root/site1     my-domain.com/subfolder/wp-multisite-root/site2     my-domain.com/subfolder/wp-multisite-root/site3      Is there any way to have it created like this?               my-domain.com/subfolder/wp-multisite-root     my-domain.com/subfolder/site1     my-domain.com/subfolder/site2     my-domain.com/subfolder/site3      There is one more trick. my-domain.com/subfolder/ contains another non wordpress application.


title: How do I change the value of lang=en-US

text: I have noticed that in the `<html>` tag on my WP site that the language is defined as US English.               <html lang="en-US" prefix="og: http://ogp.me/ns#">      I would like to change it to British English `en-GB` but I'm not sure of the best way. I dug around and found `language_attributes()` in `general-template.php` which makes a call to `get_bloginfo('language')`. I could manually insert the value here but that doesn't seem like the best way to do it. What is the proper way to change this value?


title: Join two wp_query

text: So, i have custom posts with this settings: Example 1: have meta_key " **price** " Example 2: have meta_key " **no_price** " So, i want to list this posts ordered by " **price** ". I just want to join these two wp queries:               global $wp_query;          $wpcc_query_args = array(     //'wpcc_archives' => 'yeap',      'tax_query' => array( array( 'taxonomy' => 'wpcc_post_category', 'terms' => $cat_id_arr ) ),     'meta_query' => array( array( 'key' => 'pd_country', 'value' => 'USA' )),     'meta_key' => 'price',     'orderby' => 'meta_value_num',     'order' => 'ASC',     'post_type' => 'wpccposts',     'post_status' => 'publish',     'showposts' => (int)$per_page,     'paged' => $paged     );          $no_price_query = array(     //'wpcc_archives' => 'yeap',      'tax_query' => array( array( 'taxonomy' => 'wpcc_post_category', 'terms' => $cat_id_arr ) ),     'meta_query' => array( array( 'key' => 'pd_country', 'value' => 'USA' )),     'meta_key' => 'no_price',     'post_type' => 'wpccposts',     'post_status' => 'publish',     'showposts' => (int)$per_page,     'paged' => $paged     );      Here is a code to the first query:                       $wpcc_archives = new WP_Query( $wpcc_query_args );     $TEMP_query = $wp_query;         $wp_query = NULL;         $wp_query = $wpcc_archives;      Anyway to join these queries? Example of what i want:   * Title X - 50 dollars   * Title Y - 100 dollars   * Title Z - N/A   * Title F - Contact Us 50, 100 = meta_key price N/A, Contact Us = meta_key no_price


title: Installed WordPress Location

text: can i install wordpress on my sub-domain while all its contents/post are on the root domain? Ex. `admin.mydomain.com/wp-admin....` then the contents/post or homepage must be in `mydomain.com` and `mydomain.com/hello-world` ?


title: How to loop through custom posts in admin edit screen

text: How can I access the loop that displays all the custom posts in a custom post type's `edit.php` page? Is there some sort of hook for this? I want to do some condition checking on the data that is being pulled during the loop and it doesn't seem like WP offers any obvious solution.


title: Custom Post Types vs. Advanced Custom Fields (with Repeater Field add-on)

text: My goal is to give end users on my projects the maximum amount of control without making them work with any code. I've been using Advanced Custom Fields ("ACF") along with the Repeater Field add-on for some time now with great results, but I'm torn between two setups. **The problem:** A site needs to list employees on a page. They will not and should not be visible anywhere else. **Old way:** In the past I would setup a CPT for employees, plug in a quick `WP_Query` on that page template and be done with it. Then I added ACF and the Repeater Field add-on to my workflow. The new workflow allows me to setup a repeatable field where the admin can select a post object from a dropdown (filterable by post type). Admins can select the employee CPT object and keep adding or removing these as needed with the Repeater Field. They can even drag and drop the fields to reorder them. **Problem with the old setup:** The drawbacks I found to this approach are the repercussions of creating a CPT: mainly that the CPT is individually visible should a visitor stumble upon its URL and can be indexed by search engines. Template redirects and `robots.txt` can solve these issues but I wonder if there is a more efficient way... **The alternative:** Why not setup the repeatable fields directly on the page that's meant to display the employee data and include ACF fields I would normally include in the employee custom post type like name, image, bio, etc.? To me, this is a far cleaner and more efficient solution. This way, admins don't need to create a CPT and then go to the employees page and add the CPT they just added to the repeatable field that's setup there; they just input the employee data directly on the page where it's meant to be displayed. No template redirects or `robots.txt` tweaks necessary and they edit everything from within one window. I realize this solution may only be workable in a scenario where these **faux CPTs** only need to display on one particular page. Can anyone make a good case for or against a setup like this?


title: add <div> to end of post in the loop with plugin

text: I'm looking to add a `<div>` with some more html content to the bottom of specific posts in the loop. The `the_post` action can be used to add the `<div>` to the beginning of the post in the loop, but I'm hoping to add it to the end. EDIT The closest things I've been able to do is to add a classname to the desired post in the loop using `post_class`. Then I used `jQuery(.classname).append('<div>custom content</div>)` to add the custom content. The problem is, mixing jQuery and php in this manner seems to be less than optimal because I want to pass php info to the custom content...


title: Add index for post_title field to get similar post using full-text search

text: Currently, there are too many of my blog posts (about 700,000 articles) In my blog function "related articles" I'm thinking to use full-text search function to display the following related articles: Index field: `POST_TITLE (wp_posts)`               ALTER TABLE wp_posts ADD INDEX (POST_TITLE (300));      Use with full-text search query:               $ sql = "SELECT ID FROM wp_posts WHERE MATCH (POST_TITLE) AGAINST ($ title)      Where `$ title` is `POST_TITLE` the current article I am hesitated to do this So if I do have the data on display are all related and not speed up query?


title: how to use tax_query to apply both terms or one if one is empty

text:
I'm having trouble with getting tax_query to act as a filter for posts. What I would like is to have it so it will display cpt's that have the terms of county and status but also work if terms are not provided for status or county. So have the posts show if it has the term of "Adams" county in the County taxonomy and the the term of "Locked" in the Status taxonomy. But it needs to also work if a County is not provided, just a status and vice-versa. Here is my code:                   <?php         $args = array(             'post_type' => 'property',             'posts_per_page' => 5000,             'tax_query' => array(                 'relation' => 'AND',                 array(                 'taxonomy' => 'Status',                 'field' => 'slug',                 'terms' => explode( ',', $st_term_final_string    )                 ),                 array(                 'taxonomy' => 'County',                 'field' => 'slug',                 'terms' =>  explode( ',', $il_term_final_string )                 )             )         );         $loop = new WP_Query( $args );         while ( $loop->have_posts() ) : $loop->the_post();             the_title();             echo '
';             echo get_the_post_thumbnail();             the_content();             echo '
';         endwhile;         ?>      Any hints to put me in the right direction? Thanks in advance


title: wordpress changing host breaks image links

text: I recently migrated my wordpress install from godaddy to a VPS that I setup. So far, everything but the images works. Not too sure why, but the images in posts appear broken, though if they are clicked on they will open the correct image. I've looked for a solution, but everything seems to be related to changing domains, whereas my domain remains the same, just redirected. Thanks,


title: How do I filter title and alt attributes in the gallery shortcode?

text: I am displaying a post gallery inside a custom post type, using the following in my single-custom.php template: `<?php echo do_shortcode('[gallery id="'.$post->ID.'" link="file" columns="5" orderby="menu_order"]'); ?>` One of the things included in the output is `title="filename"` in the `<img>` tag, like so: `<img width="150" height="150" src="http://mydomain.com/wp- content/uploads/DSC_0036-150x150.jpg" class="attachment-thumbnail" alt="DSC_0036" title="DSC_0036" />` I do not want to output the title attribute. Mostly, I don't want crappy filenames in the hover-over text, but there are hundreds of images and I'm not prepared to go into the Media Gallery and edit the title for each one. I'd prefer to also change the `alt` attribute to the post name, perhaps. Is there a way to filter the gallery to output the post name in the alt and title attributes, instead of the filename?


title: Creating a wordpress plugin where users can override templates

text: I see plugins where users can override the plugin templates by creating files inside of their own theme folder, how does this work? Is this a built-in part of wordpress or does it have to be written in?


title: How do i link gallery thumbnails to different url's using the wp native gallery?

text: Is it possible to link each gallery thumbnail if i use the built in WordPress native gallery?


title: Can't style custom menu

text:
I have a Wordpress menu on my site generated by code:               <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-primary' ) ); ?>      When I assign the menu called "Categories" to the "Primary Menu" location, this generates front end code of:

             Environmental

      The following CSS is not being applied:               .nav-primary {         display: block;     }     .nav-primary ul {         list-style-type: none !important;         background-color: rgba(0,0,0,0.25) !important;         padding: 5px !important;         border-radius: 8px !important;         -moz-border-radius: 8px !important;         -webkit-border-radius: 8px !important;     }     .nav-primary ul li {         display: inline-block !important;         background-color: rgba(0,0,0,0.25) !important;         margin-right: 5px !important;         height: 32px !important;         padding-top: 8px !important;         border-radius: 8px !important;         -moz-border-radius: 8px !important;         -webkit-border-radius: 8px !important;     }     .nav-primary ul li a {         text-decoration: none !important;         color: #fff !important;         margin: 8px 14px 0 14px !important;     }      How do I style this menu when the ID being output on the front end is generated from the name of the menu in Appearance > Menus ? If I deploy this theme to the public, I will never be able to anticipate what the name of the menu will be, and the generated ID will always take precedence over the class.


title: Content of post does not end up in "ShareThis" mail

text: I am using the ShareThis plugin in my blog. When I click on the email tab and send a mail to my friend, only the post title and post link is included in the mail. Contents are not showing up in the mail. What can I do to change this?


title: If has $title in widgets

text:
I'm writing a widget to display 125 x 125 pixel ads. There are 6 spaces for the ads and currently all works. However, I would to add some conditional logic so that if nothing is entered in the values in the widget admin for an ad, then no add is shown. I think this can be done by using PHP if or something, I can't remember what it is exactly. I need it with the `<?php & ?>` tags on. It needs to check if `$adone` exists and if not display an empty space. I know this code here is wrong but something like this:               <?php if_has($adone_img)  ?>     /** Ad 1 code here */     <?php else : ?>     <?php endif; ?>      **The widget class:**               <?php     /**      * square_ad Class      */     class square_ad extends WP_Widget {         /** constructor */         function square_ad() {             $widget_ops = array('classname' => 'square_ad', 'description' => 'Up to 6 125px by 125px ads for your sidebar.');             $control_ops = array('id_base' => 'square_ad');             $this->WP_Widget('square_ad', 'SILVERLINE 125 Ad', $widget_ops, $control_ops);           }              /** @see WP_Widget::widget */         function widget( $args, $instance ) {             extract( $args );             $title = apply_filters( 'widget_title', $instance['title'] );                  $adone_img = apply_filters( 'adone', $instance['adone_img'] );             $adone_link = apply_filters( 'adone', $instance['adone_link'] );                  $adtwo_img = apply_filters( 'adtwo', $instance['adtwo_img'] );             $adtwo_link = apply_filters( 'adtwo', $instance['adtwo_link'] );                      $adthree_img = apply_filters( 'adthree', $instance['adthree_img'] );             $adthree_link = apply_filters( 'adthree', $instance['adthree_link'] );                  $adfour_img = apply_filters( 'adfour', $instance['adfour_img'] );             $adfour_link = apply_filters( 'adfour', $instance['adfour_link'] );                  $adfive_img = apply_filters( 'adfive', $instance['adfive_img'] );             $adfive_link = apply_filters( 'adfive', $instance['adfive_link'] );                  $adsix_img = apply_filters( 'adsix', $instance['adsix_img'] );             $adsix_link = apply_filters( 'adsix', $instance['adsix_link'] );                  echo('
');             echo($title);             echo('
');             echo('
');      ?>                    <a href="<?php echo ($adone_link);?>"><img class="box-container" src="<?php echo ($adone_img);?>" width="125" height="125" />     <a href="<?php echo ($adtwo_link);?>"><img align="right" class="box-container" src="<?php echo ($adtwo_img);?>"  width="125" height="125" />
     <a href="<?php echo ($adthree_link);?>"><img class="box-container" src="<?php echo ($adthree_img);?>" width="125" height="125" />     <a href="<?php echo ($adfour_link);?>"><img align="right" class="box-container" src="<?php echo ($adfour_img);?>"  width="125" height="125" />
     <a href="<?php echo ($adfive_link);?>"><img class="box-container" src="<?php echo ($adfive_img);?>" width="125" height="125" />     <a href="<?php echo ($adsix_link);?>"><img class="box-container" src="<?php echo ($adsix_img);?>" width="125" height="125" />

                  <?php          }              /** @see WP_Widget::update */         function update( $new_instance, $old_instance ) {             $instance = $old_instance;             $instance['title'] = strip_tags($new_instance['title']);                  $instance['adone_img'] = strip_tags($new_instance['adone_img']);             $instance['adone_link'] = strip_tags($new_instance['adone_link']);                  $instance['adtwo_img'] = strip_tags($new_instance['adtwo_img']);             $instance['adtwo_link'] = strip_tags($new_instance['adtwo_link']);                  $instance['adthree_img'] = strip_tags($new_instance['adthree_img']);             $instance['adthree_link'] = strip_tags($new_instance['adthree_link']);                  $instance['adfour_img'] = strip_tags($new_instance['adfour_img']);             $instance['adfour_link'] = strip_tags($new_instance['adfour_link']);                  $instance['adfive_img'] = strip_tags($new_instance['adfive_img']);             $instance['adfive_link'] = strip_tags($new_instance['adfive_link']);                  $instance['adsix_img'] = strip_tags($new_instance['adsix_img']);             $instance['adsix_link'] = strip_tags($new_instance['adsix_link']);             return $instance;         }              /** @see WP_Widget::form */         function form( $instance ) {             if ( $instance ) {                 $title = esc_attr( $instance[ 'title' ] );                 $adone_img = esc_attr( $instance[ 'adone_img' ] );                 $adone_link = esc_attr( $instance[ 'adone_link' ] );                      $adtwo_img = esc_attr( $instance[ 'adtwo_img' ] );                 $adtwo_link = esc_attr( $instance[ 'adtwo_link' ] );                      $adthree_img = esc_attr( $instance[ 'adthree_img' ] );                 $adthree_link = esc_attr( $instance[ 'adthree_link' ] );                      $adfour_img = esc_attr( $instance[ 'adfour_img' ] );                 $adfour_link = esc_attr( $instance[ 'adfour_link' ] );                      $adfive_img = esc_attr( $instance[ 'adfive_img' ] );                 $adfive_link = esc_attr( $instance[ 'adfive_link' ] );                      $adsix_img = esc_attr( $instance[ 'adsix_img' ] );                 $adsix_link = esc_attr( $instance[ 'adsix_link' ] );             }             else {                 $title = __( '', 'text_domain' );             }             ?>
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
Ad One
             <label for="<?php echo $this->get_field_id('adone_img'); ?>"><?php _e('Image URL:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adone_img'); ?>" name="<?php echo $this->get_field_name('adone_img'); ?>" type="text" value="<?php echo $adone_img; ?>" />             <label for="<?php echo $this->get_field_id('adone_link'); ?>"><?php _e('AD Link:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adone_link'); ?>" name="<?php echo $this->get_field_name('adone_link'); ?>" type="text" value="<?php echo $adone_link; ?>" />
Ad Two
             <label for="<?php echo $this->get_field_id('adtwo_img'); ?>"><?php _e('Image URL:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adtwo_img'); ?>" name="<?php echo $this->get_field_name('adtwo_img'); ?>" type="text" value="<?php echo $adtwo_img; ?>" />             <label for="<?php echo $this->get_field_id('adtwo_link'); ?>"><?php _e('AD Link:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adtwo_link'); ?>" name="<?php echo $this->get_field_name('adtwo_link'); ?>" type="text" value="<?php echo $adtwo_link; ?>" />
Ad Three
             <label for="<?php echo $this->get_field_id('adthree_img'); ?>"><?php _e('Image URL:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adthree_img'); ?>" name="<?php echo $this->get_field_name('adthree_img'); ?>" type="text" value="<?php echo $adthree_img; ?>" />             <label for="<?php echo $this->get_field_id('adthree_link'); ?>"><?php _e('AD Link:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adthree_link'); ?>" name="<?php echo $this->get_field_name('adthree_link'); ?>" type="text" value="<?php echo $adthree_link; ?>" />
Ad Four
             <label for="<?php echo $this->get_field_id('adfour_img'); ?>"><?php _e('Image URL:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adfour_img'); ?>" name="<?php echo $this->get_field_name('adfour_img'); ?>" type="text" value="<?php echo $adfour_img; ?>" />             <label for="<?php echo $this->get_field_id('adfour_link'); ?>"><?php _e('AD Link:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adfour_link'); ?>" name="<?php echo $this->get_field_name('adfour_link'); ?>" type="text" value="<?php echo $adfour_link; ?>" />
Ad Five
             <label for="<?php echo $this->get_field_id('adfive_img'); ?>"><?php _e('Image URL:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adfive_img'); ?>" name="<?php echo $this->get_field_name('adfive_img'); ?>" type="text" value="<?php echo $adfive_img; ?>" />             <label for="<?php echo $this->get_field_id('adfive_link'); ?>"><?php _e('AD Link:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adfive_link'); ?>" name="<?php echo $this->get_field_name('adfive_link'); ?>" type="text" value="<?php echo $adfive_link; ?>" />
Ad Six
             <label for="<?php echo $this->get_field_id('adsix_img'); ?>"><?php _e('Image URL::'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adsix_img'); ?>" name="<?php echo $this->get_field_name('adsix_img'); ?>" type="text" value="<?php echo $adsix_img; ?>" />             <label for="<?php echo $this->get_field_id('adsix_link'); ?>"><?php _e('AD Link:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id('adsix_link'); ?>" name="<?php echo $this->get_field_name('adsix_link'); ?>" type="text" value="<?php echo $adsix_link; ?>" />
             <?php          }          } // class square_ad          // register square_ad widget     add_action( 'widgets_init', create_function( '', 'return register_widget("square_ad");' ) );


title: In which directory do I find the HTML file of my wordpress pages?

text: I would like to manually edit the code my my wordpress pages. The WP interface only allows me to individually edit the CSS or PHP. The Page Edit feature gives me access to a certain part of the code, excluding the Body Tag. Kindly help me locate my files on the server. Thanks for your help! :)


title: Add javascript to wp_head with call to plugin options?

text: I am trying to write a plugin in wordpress and have been doing it in stages, I understand how to add javascript to the wp_head however adding multiple function calls to the plugins options is something I don't think I'm understanding. This is my first attempt at trying to write a plugin so I know I am going about this wrong. Any feedback is greatly appreciated! If I have:                   function tweet_feed_it() {         echo '<script type="text/javascript">             $(document).ready(function() {                 $(".tweet").tweet({                 modpath: "path/to/plugin/twitter/",                 username: "twitter_username",                 join_text: "auto",                 count: tweet_count,                 auto_join_text_default: "We tweeted,",                  auto_join_text_ed: "We",                 auto_join_text_ing: "We were",                 auto_join_text_reply: "We replied to",                 auto_join_text_url: "We were checking out",                 loading_text: "loading tweets..."                         });                      });                </script>'};     // Add to head     add_action('wp_head', 'tweet_feed_it');      The script shows up in wp_head fine. But in my wordpress plugin I have set some options and I want to call them to use within the script tags. I will show what i have tried so you get an idea of what I am trying to accomplish at least:                   class TweetFeedIt {         function tweet_feed_it() {             function twitter_username_callback() {                 function tweet_count_callback() {         printf( '<script type="text/javascript">                 $(document).ready(function() {                 $(".tweet").tweet({                 modpath: "http://test.phoenixlaef.com.au/wp-content/plugins/Tweet-Feed/twitter/",                 username: "twitter_username",                 join_text: "auto",                 count: tweet_count,                 auto_join_text_default: "We tweeted,",                  auto_join_text_ed: "We",                 auto_join_text_ing: "We were",                 auto_join_text_reply: "We replied to",                 auto_join_text_url: "We were checking out",                 loading_text: "loading tweets..."             });         });     </script>     '     , esc_attr( $this->options['twitter_username']), esc_attr( $this->options['tweet_count'])                     );                 }             }         }     }     // Add to head     add_action('wp_head', 'tweet_feed_it', 'twitter_username_callback', 'tweet_count_callback');      Do I need to register the option settings to use it like this or is what I am trying to do just not practical? Thanks for your help in advance :)


title: On home page remove link from logo

text: I'd like to remove the link that is generated around the logo when users are on the home page. Does wordpress have a built in function so I can wrap an if condition around the logo in the template so if the current page is the home page I can have the output without the a tag, and the else would simply be the current code.


title: What are some examples of well-written plugins that exemplify wordpress plugin best practices?

text: I've searched through the stack exchange for wordpress and was unable to come up with an answer to this question. All of the wordpress codex's examples and external resources come from 2004-2006. I'd love an example of a popular Wordpress plugin that is also well-written. As I'm fairly new to programming (less than 1 year in), this would be immensely helpful.


title: How To Add Custom Form Fields To The User Profile Page?

text: The user profile page has the following fields: Username   First Name   Last Name   Nickname Display name Contact Info E-mail Website AIM Yahoo IM   Jabber / Google Talk How can more fields be added to this section. Field such as Phone number, address, or anything else.


title: Customize field names in backend profile edit page through function.php

text: > **Possible Duplicate:**   >  How To Add Custom Form Fields To The User Profile Page? I want to change a the names of some of the fields in the edit profile page in the backend. For instance, instead of it saying "Twitter", I want it to display "Enter Twitter ID". I am aware that I can do this by editing the core WP files, but to avoid redoing the same process, how can I do this through the function.php file? What code can I enter that would make this possible?


title: Is wordpress big enough for my project

text: I have a site some having job postings running using jobber base. Now I am going to shift it in WP using jobroller theme that is of 99 USD. I am a developer who always like MVC rather than these CMS. I was thinking of doing it in Yii. But now I came to know about job roller. So I have 2 questions? Is jobroller worth 99 USD and will it work for my product? Can WP handle this if I want to do changes every week. As I told earlier, I am also a developer. So I will be doing changes in it but I doubt that I will not be able to do this in such friendly way as it can be easily done in an MVC framework. I am always in favor of OOP and MVC. But I actually don't have much time to develop my own. So guys please advise me that should I spend some more time and do it in MVC once or I should once continue with WP? Can any one tell me about big sites that are developed in WP? I will be thankful if any one can give me good advise?


title: How to protect uploads in multisite if user is not logged in?

text: I am trying to set up a multisite intranet (using subdomains) where content on each sub-site is only accessible to users logged into their respective site. The problem I am having is trying to restrict access to uploaded files (e.g. http://example.org/wp-content/uploads/2011/12/dummy.pdf) to logged in users only. Similar to How to Protect Uploads, if User is not Logged In?, how would I enable one of the solutions proposed by hakre or Frank Bueltge for a multisite installation? I have been scouring the net and Wordress Answers but haven’t managed to find something that I can get to work. Related answers are:   * How to make media upload private?   * Protect Uploads in Multisite Also, I am new to PHP and still learning how WordPress works under the hood, so detailed information about what I need to do and what goes where would be much appreciated. Thanks!


title: Hiding posts and pages in panel

text: I found out this code and works ok for hide pages in admin page listing, but I need someway to do this to thousand pages:               add_action( 'pre_get_posts' ,'hide_pages_87ff65f5f' );          function hide_pages_87ff65f5f( $query ) {              if( !is_admin() )             return $query;              global $currentpage;            $pages = array('2389','2605','2640','2970','2626');            if( 'edit.php' == $currentpage && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) )         $query->set( 'post__not_in', $pages );              return $query;     }      Because I migrated a large static site I want to hide several pages and posts types from this specific month and year, I tried query and get_posts but something is not working, or maybe is not possible here :S Infact I need to hide the content on every context in admin panel such parent option box, but this is quite enough for now. Thanks a lot for any help!


title: Displaying categories items among posts

text: I'm making a website with lots of custom posts as well as custom hierarchical taxonomies. Default index (archive) page is made of bricks with photo, title and excerpt from posts. And here comes the problem, cause those index/archive pages mustn't contain only posts items (bricks), it should also contain (among the normal post items) bricks showing sub-categories of current. Is it a good way of doing such a thing using categories, and if it is - how to achieve it? EXPLANATION EDIT: By bricks i understand floating containers, just the visual representation of post (or category) data. Floating thumbnails with descriptions. Category archive page would contain items of two types: 1) posts located in current category (not subcategories) and 2) subcategories of current category. It'd be kind like files and folders structure.


title: Sidebar slideshow widget

text: Anyone know any quality image slideshow widgets that can be put on a sidebar?


title: Trying to use .htaccess to redirect /profile to /login-2?action=profile

text: I have a plugin Theme My Login for WordPress 3.0.1 which causes my user's profile pages to be here: domain.com/login-2?action=profile instead of here: domain.com/profile So I am trying to fix it with mod_rewrite like this: RewriteRule ^profile /login-2?action=profile But it seems to do nothing. I suspect it's some weird thing happening in WordPress but wanted to ask folks here if my rewrite rule looks correct before I dig further. Did I do it right? Update: I had someone suggest I use wp_rewrite - which I noticed has some flush rules functions associated with it; perhaps wp is not noticing my changes to htaccess because a flush is needed first?


title: How to check if certain plugin exists and in expected version

text: I've created plugin that goes to wordpress plugin repositories. Now, I need to create another plugin (sub plugin or child plugin you may call) that require this certain plugin to be already installed and activated. I know I can use `register_activation_hook`. However, how do I check using that hook? Or, maybe there's another solution exists?


title: Import and export links from WordPress.com to private site

text: Is there some way to export/import links from a wordpress.com site to a private site? I have a rather large directory of links. I fetch the opml file and the category levels are there, but when I use the Bloggroller importer, it doesn't create the categories? Help would be appreciated.


title: Questions about meta box: nonce and parameters available

text: 1st question is: is a nonce required for a meta box? i read on the wordpress codex `add_meta_box` and they have a nonce for the meta box, i'd thought that maybe the add post form will already include a nonce?               echo '<input type="hidden" name="myplugin_noncename" id="myplugin_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';      2nd question is: whats the parameters available for the function that creates the markup of the meta box. from what i read in profesional wordpress looks like               function pp_meta($post, $box)      how will i know what parameters are available in such functions? and what does `box` refer to?


title: Get fuzzy matches from get_term_by

text: I would like to get a term, knowing only part of its slug. The way my slugs are set up, make it so the category name appears before a language code, and I sometimes need to get the term just from the category name and language code concatenated together, but if that exact term doesn't exist, I don't get anything from get_term_by. That would be okay, except, some of my terms are in multiple languages, and when I know the category and the language, say it's apple in french and english, and I need to find that term from just knowing that I am dealing with apple, and I'm in english. More concrete example: > term name: apple_en_fr > > I want to search for apple_en or apple_fr and get that term. How could one go about getting a fuzzy match, like that?


title: Change post status based on user role

text: I have a site I'm working on where users pay a monthly fee to be able to add content to the site and they are assigned a custom user role when registered. When their subscription is up their user role is changed to a subscriber. It's using Gravity Forms and their authorize.net plugin for the subscription.               // Set user role to subscriber after subscription expires     add_action( 'gform_authorizenet_subscription_canceled', 'downgrade_user_role', 10, 4 );          function downgrade_user_role( $entry, $subscription_id, $transaction_id, $new_payment_amount ) {         $user = GFUserData::get_user_by_entry_id( $entry['id'] );         $user->set_role( 'subscriber' );     }      I'm then trying to figure out how to change the post status once their subscription is up so the content wouldn't be active unless their subscription was. I was thinking of changing the post status to draft when the user role is changed to a subscriber but not sure how to go about doing that. Another option would be to only include the posts by certain user roles in the query but haven't been able to find a way to do that either. Anyone have any thoughts or ideas on how I could achieve this? Thanks


title: Use another menu when logged in

text: Before the update to WP 3.6 I could add this code in the header.php of the theme, which made it possible to have another menu when logged in:                       <?php             if( is_user_logged_in() ) {                 $menu = 'logged-in';             } else {                 $menu = 'logged-out';             }                  wp_nav_menu( array(                 'menu'              => $menu,                 'theme_location'    => 'menu',                 'sort_column'       => 'menu_order',                 'menu_class'        => 'sf-menu',                 'fallback_cb'       => 'default_menu'             )); ?>      I have made the two menus called "logged-in" and "logged-out" in the WP admin panel. But after the update, this doesn't work anymore. How can I change the menu when logged in in the correct way? _(PS: The theme is WPExplorer's Adapt theme.)_ **Note:** Actually, all I need is to change one specific button in the menu, so it is different when the user is logged in - in that case that menu button will be a "Member profile" button instead of a "Log in" button. If that can be done without changing the entire menu, that would be much better.


title: wp_next_scheduled not working with variables

text: Here is the code:                   <?php while ($parent->have_posts() ) : $parent->the_post(); ?>         <?php $timi = get_field('timi', $post->ID); ?>         <?php $timi2 = $timi / 2;               //$int_timi = intval($timi2);               $current_id = $post->ID;               //$curent_id_str = strval($curent_id);               echo $timi2;               echo $current_id;               $next_time = wp_next_scheduled( 'dothisinanhourhook', array( $current_id, $timi2));               echo $next_time;               ?>      The cron is running normaly, even though, I can't get next timestamp due to $current_id. If I enter its value as a string, it works. Any ideas?


title: Post/Custom Post Type URL Access

text: Is there a way to prevent people from visiting a post's permalink? A lot of times we create posts or custom post types that end up being included as part of the content of a page or some other feature and are not always intended to be viewed individually. A good example might be for a slideshow. You create a few posts where each individual post is the content of a slide in the slideshow. Each one of those posts has a unique permalink, something like `example.com/slide-one`. There's no reason for someone to be able to access that individual post so I would like to "hide" it.


title: Use custom category in more than one custom post

text: I am using a custom category in more that one custom posts.                   register_taxonomy( 'location', array('holiday','resorts' , array(              'hierarchical' => true,              'labels'       => array (                   'name' => 'Locations',                     'singular_name' => 'Location',                         'search_items' => 'Search Location',                        'all_items' => 'All Locations',                     'parent_name' => 'Parent Location',                         'parent_item_colon' => 'Parent Location',                        'edit_item' => 'Edit Location',                      'update_item' => 'Update Location',                    'add_new_item' => 'Add New Location',                        'new_item_name' => 'New Location Name',                      'choose_from_most_used' => 'Choose from the most used Location',                   'separate_items_with_commas' => 'Seperate Location with commas'              ),              'show_ui'       => true,              'query_var'       => true,         );      I have a location category which I am using it in custom posts holiday and resorts I need to display only holidays in taxonomy page? And also the post count shows sum of both custom posts. How to show the counts of each post separately?


title: Set the limit to allow author when make post!

text: I would like to ask something here, The question is, is there any way to set the limit of post that an author can post? For example, I have a few authors on my site, but I want to allow each of them to make only 1 post and edit only post that they have posted. Appreciate your answers. Thank you!


title: Editor can't login after WP Visited Countries plugin is installed

text: I have installed http://wordpress.org/plugins/wp-visited-countries/ plugin. When the user (Role: Editor) try to login - I got "You do not have sufficient permissions to access this page." When I disable the plugin it allows user to login.


title: Better to make new wp_query or only modify main query each time?

text: I have a theme where I need multiple queries for each column. Is it better to modify the main query with pre_get_post and reset the loop or create a new query for each of my columns?


title: How to get attached file in wordpress from custom post

text:
I am using the Download monitor plugin I am listing the posts by category the following way               $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );           <?php                      $args = array(                     'post_type' => 'dlm_download',                     'posts_per_page' =>25,                     'numberposts' => null,                     'dlm_download_category' => $term->slug                 );                          $downloads = get_posts($args);                          foreach ($downloads as $download) {                              echo '
';                                  echo '
                                                                          '.$download->post_title.'
';                                   echo '
'.$download->post_excerpt.'
';                              echo '
';                     }                       ?>      But i have no idea how to show custom post attached file. The file is contained i the wp_postmeta table, I tryed with `wp_get_attached_ur($download->ID)` but it returns an empty string Anybodycould please give me a hint?


title: WordPress displays post on subcategory only

text:
I'm using WordPress on developing a site and a self-made template. I got 1 page to display all categories with its post. This is what I want to do:   * Main Category      * subcategory1        * post 1       * subcategory1.2          * post 1.2.1         * post 1.2.2     * subcategory2     * subcategory3 I used `wp_link_category()` to display the category and I searched how to display category with post but the problem is: the post from subcategory 1.2 is also displayed on subcategory 1.   * Main Category      * subcategory1        * post 1       * post 1.2.1       * post 1.2.2       * subcategory1.2          * post 1.2.1         * post 1.2.2     * subcategory2     * subcategory3 How can I remove the post from subcategory 1.2 on subcategory 1? Here's the code I copied and pasted from StackOverflow:               $categories =  get_categories('child_of=4');       foreach  ($categories as $category) {         //Display the sub category information using $category values like $category->cat_name         echo '
'.$category->name.'
';         echo '
';              foreach (get_posts('cat='.$category->term_id) as $post) {             setup_postdata( $post );             echo '
ID).'">'.get_the_title().'
';            }           echo '
';     }      I hope you understand me.


title: Why does Google Webmaster Tools say my whole site is blocked by robots.txt when I have no robots.txt?

text: I submitted a sitemap for my WordPress site to Google Webmaster Tools. Several times. I keep getting the same messages: "Url blocked by robots.txt." and "Sitemap contains urls which are blocked by robots.txt." But I have no robots.txt anywhere. It seems my entire site and every link on it is blocked from being crawled by Googlebot. I was using WordPress' Yoast SEO plugin and Cloudflare, but I disabled them and cleared my cache, to no avail. I thought it was Yoast's fault at first. WordPress' "Search engine visibility" setting has "Discourage search engines from indexing this site" unchecked, like it should. Now I'm wondering if WordPress creates its own virtual robots.txt or something that doesn't show up in the site root. What gives? Do I need to wait a few days? I never had a robots.txt to begin with!


title: wp Query Posts to display in Nivo Slider

text:
i have coded a slider into my wordpress theme to use query posts to display the thumbnail and the content however it appears that its displaying the whole posts? and not just the one relating to the slide at that time?

             <?php $the_query = new WP_Query( 'showposts=5' ); ?>             <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>                 <?php the_post_thumbnail(); ?>

<?php the_title(); ?>
                     <?php the_content(); ?>            <?php endwhile;?>
        Please can someone advise what I'm doing wrong? http://www.milknhny.co.uk/PeterWork This is the NIVO Mark up:

         This is an example of a HTML caption with a link.
      As you can see the caption for this is completely outside the wrappers?


title: wordpress custom modules/widget areas on the page? can i make my own?

text: im kind of a wordpress noob so please excuse my inexperience. so long story short, ive been tasked with creating a WP theme (kinda simple) but, one of the areas, around footer area, has a few things they want, like a 2ndary menu/ bread crumbs etc...maybe even custom html box etc that i can do other things with later on, which i know WP provides via plugins / widgets etc but, my question is how can i make a custom area to "hook" these onto a specific area of a page? for example, in joomla, i can mark any part of a page with **named** hooks and thereafter, select whatever module i want to work with, assign said widget to the area by name and thats it, style it there after. Does wordpress have anything like this?i know theyre different platforms but is there anything like it or a wordpress equivalent to achieve this. i see for example that most of the widgets etc, go into the wp_sidebar. can i make my own area or are there other hooks that simulate what i described above? Any tips/answers, links to read/research i gladly and humbly appreciate. Thank you in advanced.


title: Add multiple custom meta boxes to different custom post types

text:
I want to add one custom meta box to a specific custom meta type "chifres" and two custom meta boxes to a specific custom meta type "presse". This is how far I've gotten: Here is my code:               //Add custom metadata     function add_custom_metadata_boxes() {             add_meta_box(             'custom_meta_box', // $id             'Values', // $title             'show_custom_boxes', // $callback             'foo1', //Custom post types             'normal', // $context             'high' // $priority         );     }          $prefix = 'custom_';     $custom_meta_fields = array(         array(                 'name' => 'number',                 'label' => 'Number',                 'id' => $prefix . 'number',                 'type' => 'number',                 'std' => ''         )     );          // The Callback for the first one     function show_custom_boxes() {     global $custom_meta_fields, $post;     // Use nonce for verification     echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';              // Begin the field table and loop         echo '
';         foreach ($custom_meta_fields as $field) {             // get value of this field if it exists for this post             $meta = get_post_meta($post->ID, $field['id'], true);             // begin a table row with             echo '
                    '.$field['label'].'	                    ';                     switch($field['type']) {                         // checkbox                                             case 'number':                                     echo '<input type="number" min="0" step="1" pattern="\d+" placeholder="Fill in a number" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', '
', $field['desc'];                             break;                     } //end switch             echo '
';         } // end foreach         echo '
'; // end table     }          add_action('add_meta_boxes', 'add_custom_metadata_boxes');          function save_custom_meta($post_id) {         global $custom_meta_fields;              // verify nonce         if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))             return $post_id;         // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return $post_id;         // check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id))                 return $post_id;             } elseif (!current_user_can('edit_post', $post_id)) {                 return $post_id;         }              // loop through fields and save the data         foreach ($custom_meta_fields as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];             if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         } // end foreach     }     add_action('save_post', 'save_custom_meta');      The "chifres" box works perfectly, I just can't figure out how I can add other custom meta boxes to another custom post type. Any suggestions?


title: query_post and wpdb returning different results

text: I am trying to get the woocommerce products by category.. When I query using the wpdb it gets the product correctly which exists in the backend products list. But when I query using the query_posts it gets another set of products that is not listed in the backend. Why this discrepancy?                    global $post, $wpdb;                                      $query = "SELECT $wpdb->posts.* FROM $wpdb->posts         LEFT JOIN $wpdb->term_relationships ON         ($wpdb->posts.ID = $wpdb->term_relationships.object_id)         LEFT JOIN $wpdb->term_taxonomy ON         ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)         WHERE $wpdb->posts.post_status = 'publish'         AND $wpdb->term_taxonomy.taxonomy = 'product_cat'         AND $wpdb->term_taxonomy.term_id = 1         $childcond         ORDER BY post_date DESC";               if ($wpdb->num_rows > 0) {             foreach ($postresults as $post) {                    //process product item             }         }      using query_post                query_posts('cat=1&showposts=-1');


title: Wordpress multi-site for subdomains and different domains with one database?

text: I'm working onf a wordpress that has lots of posts. They're not in any language (they are either just images or addresses) but I want to make my site available in other languages (for wordpress texts) using subdomains or completly different domains. For example: My site is in Spanish and this is its URL:               example.es      Now I want to make it available in Basque with the following URL:               eu.example.es      But I also want to make it international and for those cases I want to use a different domain, for example, in french:               example-en-francaise.fr      Each of them would be in a different language but they would all be sharing the same database. What would be the best option for this? Would it be possible to only show the posts that are in the language of the domain (Spanish for .es, French for .fr, etc.)? Thank you in advance.


title: WordPress is hard cropping large and medium images

text: I have a Woo Canvas theme site and sometime in the recent past the image sizing functions stopped working as expected. When you upload an image into the media library and try to insert into a page, the size options are thumb (150x150) medium (300x300) large (1024x1024) and full size. The problem is when you choose medium or large, it crops the image as it would to a hard cropped thumbnail. It is not using the "maximum" size, but cropping the image square to those sizes. The height will be fine (say 1024) but the left and right get cropped to a 1024 width. If you use 'full size' you can then scale the image down fine, retaining aspect ratio. I have dozens of other Canvas sites, I've never seen this before. All the settings in both the WP Settings and Canvas Dynamic Images are the same as a few of the others, but the other sites all soft crop the medium and large to best fit, maintaining aspect ratio. What I've Tried: Disabled all plugins - no change Switched to 2014 theme - the only change is the size of medium/large, it still crops it square. Updated all plugins, and WP core. Canvas is not the most recent, but since it was happening with 2014, didn't think it was an issue. Found nothing in any of the function files. Ideas?


title: How to store widget fields data as an array?

text: I am creating a widget, it needs to store about 10 IDs. Right now I'm using following field method to store each of the ID in a separate field. It stores data of each field in a separately in the wordpress. Is it possible to store the data of all fields in just one row in wordpress for examlpe using an array?               <input          class="widefat"          id="<?php echo $this->get_field_id('item1_id'); ?>"          name="<?php echo $this->get_field_name('item1_id'); ?>"          value="<?php echo $instance['item1_id']; ?>"          />          <input          class="widefat"          id="<?php echo $this->get_field_id('item2_id'); ?>"          name="<?php echo $this->get_field_name('item2_id'); ?>"          value="<?php echo $instance['item2_id']; ?>"          />


title: Modify the output of wp_nav_menu in a very specific way?

text:
I am trying to get wp_nav_menu to output something like this:

Home

|

Contact Us

|

Services

      I'm close, but I can't quite get there. This is what I've done so far, and the output I get: Code:                   <?php              $defaults = array(                 'theme_location'  => 'Primary Menu',                 'menu'            => 'Primary Menu',                 'container'       => 'div',                 'container_class' => 'spanningMenu noPrint',                  'container_id'    => 'topMenu',                 'fallback_cb'     => '',                 'after'           => '
|
',                 'items_wrap'      => '

%3$s

',                  );                  wp_nav_menu($defaults);              ?>      Result:

Home
|

Contact Us
|

Services
|

      So there are three things I still need to do, and I have no idea how to do them:   1. Get rid of all the id and class tags on the li, I'm not sure where these are being generated.   2. Somehow get the "[li class="topMenuDivider"]|[/li]" to appear after the closing li rather than before it.   3. Get rid of the last li that inserts a | Is this possible? Edit: I have solved #2 by changing these lines as follows. It's kind of a hack, but it works:                           'after'           => '

|',                 'items_wrap'      => '

%3$s

',


title: How to search using query LIKE?

text: I'm using Wordpress with Woocommerce and I have a product with name "L-Glutamine". If I search _Gluta_ the site returns me nothing found. If I search _l-gluta_ the site returns me the respective product. This is my site www.lojabrasilsuplementos.com.br How can change the search to find all posts/products whose names matches the search term?


title: are there any downsides to increasing the number of most recent items in a feed

text: The default number of items to show in a rss feed is 10 (Settings-Reading) Is there any reason why I shouldn't show all items. When I use feeds from other sources (not wordpress) it seems like they show all the items. Is there any performance hit on the server for showing a large number of items?


title: Thumbs and pictures not showing anymore

text: After moving my site to a new VPS cloud server, things worked fine for a couple of days, but this morning all of the thumbs and pictures stopped showing, even though they're still in the same directory as before. Also, if I open the media library through WP console, all of the pictures show and when opening any of the posts for editing the pictures are also there. After contacting my hosting service, I was told that they were not going to help me, even though they changed something, as they were working on another issue overnight. The message below shows the message I get when following any of the pictures path on the browser: > A TimThumb error has occured   >  The following error(s) occured: > > You may not fetch images from that site. To enable this site in timthumb, > you can either add it to $ALLOWED_SITES and set ALLOW_EXTERNAL=true. Or you > can set ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs. > > Query String: `src=http://i0.wp.com/ovnihoje.com/wp- > content/uploads/2013/04/dyatlov.jpg?resize=269%2C80&h=80&w=269&a=t&zc=1` > > TimThumb version : 2.8 The timthumb file is set to 'allow_external' but even so it doesn't work. Also, I don't know where that "i0.wp.com" in the URL came from, because the URL for my site is only ovnihoje.com.


title: Returning error upon comment being flagged as spam

text: Hello Im using a custom filter that hooks to `pre_comment_approved` to look for bad words in a custom way. Now when the comment gets flagged it returns `spam`. How could I post back an error to the comments page so the user is aware that his/her email was sent to spam because of the use of a blacklisted word? Thanks               function my_wp_blacklist_check( $approved , $commentdata ) {          $mod_keys = trim( get_option('blacklist_keys') );     if ( '' == $mod_keys )         return false; // If moderation keys are empty     $words = explode("\n", $mod_keys );          foreach ( (array) $words as $word ) {         $word = trim($word);         str_pad($word, 1, STR_PAD_BOTH);         // Skip empty lines         if ( empty($word) ) { continue; }              // Do some escaping magic so that '#' chars in the         // spam words don't break things:         $word = preg_quote($word, '#');              $pattern = "#\b$word\b#i";         if (preg_match($pattern, $commentdata['comment_content'])) {             return 'spam';         }     }     return true;     }     add_filter( 'pre_comment_approved' , 'my_wp_blacklist_check' , '99', 2 );


title: tax_query not working in template

text: I have a custom post type called 'product' with a registered taxonomy 'product-type'. I want to display all post from a particular taxonomy from custom post type. In my case I want to display all the posts from 'product' post type with a term of 'software'.                   <?php $args = array(              'post_type' => 'product',              'tax_query' => array(                 'taxonomy' => 'product-type',                 'terms' => array('software'),                 'field' => 'slug'             ),             'posts_per_page' => 9,              'orderby' => 'menu_order',              'order' => 'ASC'          );              $query = new WP_Query( $args ); ?>              <ul class="list-products clearfix">              <?php while ( $query->have_posts() ) : $query->the_post(); ?>      This is producing me no results. It's empty. But if I remove the entire `tax_query` from `$arg`               'tax_query' => array(         'taxonomy' => 'product-type',     'terms' => array('software'),     'field' => 'slug'     ),      Everything works fine. I get all the posts from 'product' custom post type.


title: Shortcode is displaying the wrong post_title

text: I have got a shortcode that displays a custom post type, via a `foreach`. The shortcode has been used in the standard post type. I have used `the_title();` in the shortcode. `the_title();` outputs the post_title of the standard post type (which the shortcode is in), rather than `the_title();` of the custom post type. My code:               function faq_register_shortcode()  {         add_shortcode( 'display_faqs', 'mp_faq_shortcode' );       }       function mp_faq_shortcode() {           $args = array( 'post_type' => 'faq_type_mp', 'numberposts' => 3, 'post_status' => 'any', 'post_parent' => null );          $attachments = get_posts( $args );         if ($attachments) {            foreach ( $attachments as $post ) {                       the_title();               the_content();           }         }      }      So for example, if the standard post type (which the shortcode is in), had a `post_title` of 'this is the standard post type', this is what is outputted in the shortcode. I want to display the `post_title` which belongs to the custom post type, NOT the standard post (which the shortcode is in). What have I done wrong please?


title: Redirect URL to an existing page with query string or #! added on

text: I'm trying to make a photo gallery where the individual photos can be shared on Facebook and Twitter, and when you click the link, the photo that was shared will open in a lightbox automatically. Most lightbox plugins provide a deep-linking feature that provides this in the form of a #! after the URL. Unfortunately, both the Facebook (https://www.facebook.com/sharer/sharer.php?u=http://google.com) and Twitter (http://twitter.com/share?text=My%20Tweet&url=http://google.com) share boxes strip out all text after the #. This means that when you try to share a deep- linked lightbox photo, the link just brings you back to the gallery rather than opening that photo. The non-WordPress solution I came up with was to share a static URL and then use a RewriteRule to send them to the correct place. So for example, the user would share "example.com/gallery/123/" on Facebook, and when they went there they would be sent to "example.com/gallery/?photo=123". This would be parsed by Javascript to programmatically click on the correct image and open the lightbox. The RewriteRule I came up with:               RewriteRule ^gallery/(.*)/$ /gallery/?photo=$1 [R]      Does work fine on a static site, but not in WordPress, which is why I'm here! I'd prefer the URL to be /gallery/#!/123, but I know you can't add a #! with RewriteRule, so if anyone can think of a way to do that, it'd be even better!


title: Is there a way to show full images instead of thumbnails with facebook open graph?

text: I am using the facebook plugin. I want the thumbnail to be a full image without the thick grey excerpt box below it. (just like if I were to post the image to facebook directly. My posts are image-only, without titles, so I want my followers to see the entire image. I am hoping to do this using open graph meta tags.....but if It isnt possible, can someone please tell me if there is a plugin that will automatically post the full featured image to facebook once the post is published on my wordpress blog. Thanks so much in advance. option 2: Or Even if I could just remove the grey box below the image, i could resize the image to show all of the text. I do not need the excerpt box. its wasted space below my image. take a look: https://www.facebook.com/pages/Illquotes/415928135179118?ref=hl


title: New Table vs Post / Comment Meta

text: I am working on theme where I am adding vote functionality to comments and posts. What should I use, meta tables or create a new table?


title: wp postviews turned to zero

text: About: wp postviews plugin. A few hours ago, out of the blue, all the post views of our blog show '0 views', though the number of views run into the hundreds for many posts. We have no idea how this came about. Where are the counts for the views per post stored in the database? How can we restore the views for each post/article (I am no specialist)? Surely they are not deleted? I could not find a solution in the WP-Postviews plugin files or documentation. We would very much like to restore the views as they were, so our students can see the response to their posts. Thanks a lot for any help! HP Note: Our 'hosting company' offers no help.


title: Amending PHP for Wordpress Theme

text:
I have downloaded the following theme (http://demo.fabthemes.com/xenastore/) and i need a little help amending the index page. At the moment it lists every product that i have created on the front page - what i would like is for it to only display a select few from a a certain "department" (they don't use categories) - say Featured. Below the 'Slider' and 'Deals' The code is here but i am unsure which part to amend to only display that department and not everything on the site               <?php get_header(); ?>          <?php get_template_part( 'slider' ); ?>               <?php if (of_get_option('w2f_deal_show')== "1") { ?>

<?php echo of_get_option('w2f_lbanner_head'); ?>

<?php echo of_get_option('w2f_lbanner_text'); ?>

<?php echo of_get_option('w2f_mbanner_head'); ?>

<?php echo of_get_option('w2f_mbanner_text'); ?>

<?php echo of_get_option('w2f_rbanner_head'); ?>

<?php echo of_get_option('w2f_rbanner_text'); ?>

         <?php } ?>
         <?php         $temp = $wp_query;         $wp_query= null;         $wp_query = new WP_Query();         $wp_query->query('post_type=product&paged='.$paged);         ?>         <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

<a href="<?php the_permalink() ?>">   <?php the_post_thumbnail( 'product_panel', array('class' => 'impanel') ); ?>

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

<?php echo get_the_term_list( $post->ID, 'department', '', ', ', '' ); ?>

<?php wpe_excerpt('wpe_excerptlength_aside', ''); ?>

                     <?php echo get_post_meta($post->ID, 'WTF_price', true) ?>                      <a href="<?php the_permalink() ?>"> More Info

              <?php endwhile; ?>         <?php getpagenavi(); ?>         <?php $wp_query = null; $wp_query = $temp;?>
               <?php get_footer(); ?>      Thank you in advance for your help


title: get_posts() and filters

text: I've added a custom filter function for `the_posts` filter in a plugin.               add_filter('the_posts', 'posts_filter');     function posts_filter() { … }      This works pretty well in the main loop, that means the posts are filtered in the way I defined in the `posts_filter` function. But I am calling `get_posts()` within an ajax request to get some posts. And there the filters aren't working. `query_posts()` or custom `wp_query` don't work too. So the question is: How can I get posts beside the main loop which are filtered by `the_posts` filter?


title: get_page_children() return only titles

text:
I'm using the following code to get a list of all the pages that are children of my project page and display them in a Recent Projects section of my template's footer element. I've noticed that the `get_page_children()` method returns everything about that page - `post_author`, `post_date`, `post_content`, `post_title`, etc. Is there a way to limit this so that it only returns the `post_title`? Otherwise it is creating unnecessary overhead in querying all these other properties that aren't being rendered in the footer. Also, is there a way to limit the number of objects returned? I only want the most recent four ordered by date descending.
Recent Projects

         <?php         // Set up the objects needed         $my_wp_query = new WP_Query();         $all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));              // Get the page as an Object         $projects =  get_page_by_title('Projects');              // Filter through all pages and find Portfolio's children         $projects_children = get_page_children( $projects->ID, $all_wp_pages );              // echo what we get back from WP to the browser         foreach ($projects_children as $project):         ?>
                 <a href="<?php echo get_permalink($project); ?>"><?php echo var_dump($project);//echo $project->post_title; ?>
         <?php endforeach; ?>


title: How to access data in wordpress database externally using php

text: I want to share data in specific wordpress database tables with an iOS app. The client wants data entry via wordpress form plugins which create their own tables in the wp database. The plugins I've looked at don't have APIs themselves and examples of wordpress REST APIs all use AJAX which I'm not familiar with and/or can only access info in wordpress posts or user data. Is there a way to do this via php that doesn't involve accessing the database directly? I fear changes in database structure with updates could break the app.


title: Wordpress .htaccess file gives issues with subdirectory

text: I have a WordPress installation in the root and a subdirectory, which contains a `index.html` file. This file doesn't give me proper display as what it is supposed to when I access it. But when I rename the `.htaccess` file on root (WordPress main installation), this index file in the subdirectory shows up as it is supposed to. But this makes WordPress non functional. I have no `.htaccess` file in my subfolder. These are the contents of my `.htaccess`:               ## EXPIRES CACHING ##     <IfModule mod_expires.c>     ExpiresActive On     ExpiresByType image/jpg "access 1 year"     ExpiresByType image/jpeg "access 1 year"     ExpiresByType image/gif "access 1 year"     ExpiresByType image/png "access 1 year"     ExpiresByType text/css "access 1 month"     ExpiresByType application/pdf "access 1 month"     ExpiresByType text/x-javascript "access 1 month"     ExpiresByType application/x-shockwave-flash "access 1 month"     ExpiresByType image/x-icon "access 1 year"     ExpiresDefault "access 2 days"     </IfModule>     ## EXPIRES CACHING ##     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


title: Roles and Capabilities in Custom Post Types

text: Is there a way to create one role with one capability and apply it to some of the custom post types? What I am doing right now is ending up with applying capabilities to all of the posts.. creating role:               $wp_roles->add_role( 'member', 'Paid Membership', array(     'has_paid' => true,     'has_registered' => true     ) );      creating a custom post type (i use a class but you ll get the idea)               AN_Posts::AddPostType( static::post_type, array( 'Group', 'Groups', 'groups' ), array( 'description' => 'A user group',      'map_meta_cap' => true,      'capability_type' => 'an_group',      'capabilities' => array( 'read_post' => 'has_registered',     ) ) );      check permission               if ( is_single() && ! current_user_can( 'read_post', $post->ID ) )         $wp_query->is_404 = true;      Any ideas where i am doing it wrong? Thanks!


title: deleted users still show in count?

text: I noticed that deleted users still show in the **count** of the users admin screen. On one blog I deleted 9 users only leaving the admin but it stil shows 9 in the count. In the physical database they are no longer present in the wp_users and wp_users_metadata so.... i guess that the counter is uhm... somewhere else in the database and I set it tot 1 manually in the database?? **update / fix** I notice that the records **wp_capabilities** and **wp_user_level** do not get deleted in the **wp_usermeta** table after deletion after I deleted those 2 records manually in the database the count was back to 1


title: A good plugin/plugin set for a sports team site?

text: Looking for a good plugin or group of plugins to handle fixtures, leagues and results. It needs to handle:   * Fixtures    * Results   * League   * Tables   * Cup routes Any tips would be gratefully received.----


title: Free swf files hosting for wordpress blog

text: Picasa and Flickr provide Photo service. Is there any service for swf files so that i could share and use swf file in my blog? I don't like to upload swf on my wordpress hosting. I believe Google, Microsoft and Yahoo services only.


title: Placing Admin Post Metaboxes in Tabs

text: I am looking for what code one would need to add into the functions.php file which would allow specific metaboxes to show up in tags instead of within their individual metaboxes. Can anyone help with this?


title: Can i categorise my meta box?

text:
I have this code               <?php     $prefix = 'wtf_';          $meta_box = array(         'id' => 'propertybox',         'title' => 'Property listing details',         'page' => 'listings',         'context' => 'normal',         'priority' => 'high',         'fields' => array(                 array(                 'name' => 'Propert ID number',                 'desc' => 'Enter a property ID number, if any ',                 'id' => $prefix . 'pid',                 'type' => 'text',                 'std' => ''             ),                       array(                 'name' => 'Bath',                 'desc' => 'Number of bathrooms.',                 'id' => $prefix . 'bath',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'An',                 'desc' => 'Anul constructiei',                 'id' => $prefix . 'an',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Etaj',                 'desc' => 'Etajul',                 'id' => $prefix . 'etaj',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Balcone',                 'desc' => 'Numar balcoane',                 'id' => $prefix . 'balcon',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Parcare',                 'desc' => 'Numar locuri de parcare',                 'id' => $prefix . 'parcare',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Suprafata totala',                 'desc' => 'Suprafata totala a terenului (Casa/vila)',                 'id' => $prefix . 'suprafatatotala',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Front stradal',                 'desc' => 'Suprafata front stradal',                 'id' => $prefix . 'front',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Suprafata curte libera ',                 'desc' => 'Suprafata curte libera ',                 'id' => $prefix . 'suprafatacurte',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Amprenta casei ',                 'desc' => 'Suprafata amprentei  ',                 'id' => $prefix . 'amprenta',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Regim inaltime',                 'desc' => 'Regim inaltime  ',                 'id' => $prefix . 'inaltime',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Certificat urbanism ',                 'desc' => 'certificat urbanism',                 'id' => $prefix . 'certificat',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Asking price',                 'desc' => 'Enter the actual asking price ',                 'id' => $prefix . 'price',                 'type' => 'text',                 'std' => ''             )                   ),          );               add_action('admin_menu', 'mytheme_add_box');          // Add meta box     function mytheme_add_box() {         global $meta_box;              add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box', $meta_box['page'], $meta_box['context'], $meta_box['priority']);     }          // Callback function to show fields in meta box     function mytheme_show_box() {         global $meta_box, $post;              // Use nonce for verification         echo '<input type="hidden" name="mytheme_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';              echo '
';              foreach ($meta_box['fields'] as $field) {             // get current post meta data             $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '', $field['name'], '	',                     '';             switch ($field['type']) {                 case 'text':                     echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />',                         '
', $field['desc'];                     break;                 case 'textarea':                     echo '<textarea class="theEditor" name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>',                         '
', $field['desc'];                          break;                 case 'select':                     echo '<select name="', $field['id'], '" id="', $field['id'], '">';                     foreach ($field['options'] as $option) {                         echo '<option', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';                     }                     echo '</select>',                     '
', $field['desc'];                     break;                 case 'radio':                     foreach ($field['options'] as $option) {                         echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];                     }                     break;                 case 'checkbox':                     echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                     break;             }             echo    '',                 '
';         }              echo '
';     }          add_action('save_post', 'mytheme_save_data');          // Save data from meta box     function mytheme_save_data($post_id) {         global $meta_box;              // verify nonce         if (!wp_verify_nonce($_POST['mytheme_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }              // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }              // check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }              foreach ($meta_box['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }          ?>      I want the first 3(propert id number, bath, an ) to be categorise in property listing and the others in Mansion listing detalis ![enter image description here](http://i.stack.imgur.com/YG8Pi.jpg) I have done this : but it would not show the first box now the propertybox it is showing just the mansionbox               <?php     $prefix = 'wtf_';          $meta_box = array(         'id' => 'propertybox',         'title' => 'Property listing details',         'page' => 'listings',         'context' => 'normal',         'priority' => 'high',         'fields' => array(                 array(                 'name' => 'Propert ID number',                 'desc' => 'Enter a property ID number, if any ',                 'id' => $prefix . 'pid',                 'type' => 'text',                 'std' => ''             ),                       array(                 'name' => 'Bath',                 'desc' => 'Number of bathrooms.',                 'id' => $prefix . 'bath',                 'type' => 'text',                 'std' => ''             ),         ),          );          $meta_box = array(         'id' => 'mansionbox',         'title' => 'mansion listing details',         'page' => 'listings',         'context' => 'normal',         'priority' => 'high',         'fields' => array(                   array(                 'name' => 'An',                 'desc' => 'Anul constructiei',                 'id' => $prefix . 'an',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Etaj',                 'desc' => 'Etajul',                 'id' => $prefix . 'etaj',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Balcone',                 'desc' => 'Numar balcoane',                 'id' => $prefix . 'balcon',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Parcare',                 'desc' => 'Numar locuri de parcare',                 'id' => $prefix . 'parcare',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Suprafata totala',                 'desc' => 'Suprafata totala a terenului (Casa/vila)',                 'id' => $prefix . 'suprafatatotala',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Front stradal',                 'desc' => 'Suprafata front stradal',                 'id' => $prefix . 'front',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Suprafata curte libera ',                 'desc' => 'Suprafata curte libera ',                 'id' => $prefix . 'suprafatacurte',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Amprenta casei ',                 'desc' => 'Suprafata amprentei  ',                 'id' => $prefix . 'amprenta',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Regim inaltime',                 'desc' => 'Regim inaltime  ',                 'id' => $prefix . 'inaltime',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Certificat urbanism ',                 'desc' => 'certificat urbanism',                 'id' => $prefix . 'certificat',                 'type' => 'text',                 'std' => ''             ),                        array(                 'name' => 'Asking price',                 'desc' => 'Enter the actual asking price ',                 'id' => $prefix . 'price',                 'type' => 'text',                 'std' => ''             )                   ),          );


title: Using URL parameters, list posts from category and custom taxonomy

text: For example, `http://example.com/?cat=6&tag=books` lists posts that belong to category ID 6 and tagged 'books' (i.e. posts that satisfy both conditions). Similarly, `http://example.com/feed/?cat=6&tag=books` does the same for feeds. Now, lets say that my blog has a custom taxonomy called 'edition', with terms 'usa', 'uk', 'china', and so on, under it. The URL `http://example.com/?edition=usa,china` lists posts that belong to both editions 'usa' and 'china'. And `http://example.com/category/cars/?edition=usa` lists those posts from category 'Cars' **that also belong to** the custom taxonomy term 'usa'. ## The problem I use the code below in my functions.php:               add_filter('pre_get_posts','better_editions_archive');     function better_editions_archive( $better_editions_query ) {              /* Looks like this line needs to be changed, not sure how */         if ( $better_editions_query->is_tax( 'edition' ) && $better_editions_query->is_main_query() ) {                  $better_editions_terms = get_terms( 'edition', array( 'fields' => 'ids' ) );             $better_editions_query->set( 'post_type', array( 'post' ) );             $better_editions_query->set( 'tax_query',                 array(                     'relation' => 'OR',                     array(                         'taxonomy' => 'edition',                         'field' => 'id',                         'terms' => $better_editions_terms,                         'operator' => 'NOT IN'                     )                 )             );              }              return $better_editions_query;     }      The code makes sure that if a post is unassigned to any _Edition_ (i.e. if a post is not assigned to any term that belongs to the custom taxonomy 'edition'), the post is shown/listed under all term archives/feeds of the custom taxonomy 'edition'. Now, `http://example.com/category/cars/?edition=usa` only lists posts that belong to the category 'cars' **and specifically marked** 'usa' (a term belonging to the custom taxonomy 'edition'). It doesn't show those posts that aren't assigned to any term in the custom taxonomy 'edition'. How do I fix this? ( **PS:** Setting default terms for posts isn't an option, as we may add more editions later on.) * * * ## Solved but... I've worked out a solution which you can see as an answer to this question. The bounty still stands, so feel free. :)


title: Create Mashable Follow-like Facebook, Twitter login/connect?

text: Hi want to ask if anyone can share an idea on how Mashable registration works? Basically the only option you have to register to their site is by Facebook or Twitter, after you login to one of them it automatically create a wp_user. No more Wordpress login/Regs needed. I know many plugins like _Simple Facebook/Twitter/Google connect *_ are available, but i haven't found any plugin related to this one like Mashable have. If anyone can help me on this that will be great. [*] : Simple Facebook Connect, Simple Twitter Connect, Simple Google Connect — by Otto


title: blog posts sorting doesnt work while using get_query_var

text: I'm trying to show the latest posts using the `get_query_var` function. The function filters the posts according to their category. When I'm displaying the posts on the page they appear unsorted although I've added the `$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;`   `$args=array(`   `'category__in'=>array( $cat),`   `'order' => ASC,`   `'caller_get_posts' => 1,`   `'paged'=>$paged,`   `'orderby' => date,`   `);`   `query_posts($args);` How can I sort properly?


title: Creating post content from external web scraper via JSON or RPC

text: I'm looking for a way to post content from a web scraper external to our Wordpress site to post content its scraped into our site. Right now, I have the scraped content formatted into JSON. Could I somehow use the JSON API to post that json formatted data into a WP site, or would I need to use the XML- RPC approach? **Edit:** I'm actually trying to help a scattershot writing community by bringing together various poems and stories published over twenty different websites run by the writers individually. They would like a site showcasing their work as a whole. No spamming is taking place here.... The scraper, which is written in Python (using a framework called Scrapy), can output what it scrapes in JSON. Let's say, I have a title and description and those are outputted as title: Story Name and description: This story is about this. I want to then post those two bits of data into Wordpress, on a different server, as a post type of Story. I'm asking, since my research shows that the XML-RPC methodology may be old, if the newer JSON API supports this and where I could find a good example. I've been looking for examples but so far haven't found any. Edit: So it seems that coupled with the downvotes and the fact that I failed to identify myself as a non-spammer, this thread might be going the way of many threads in the open source community...however, for the sake of anyone trying to go down the same path as me, who are simply looking for working examples of how to use the JSON API to post content, I did find this discussion. So far I've been able to create a nonce, which is hopeful. now I think I need to write a controller for my next step so I can actually post content of type post: http://wordpress.org/support/topic/plugin-json-api-how-to-add-a-comment-or- post This is the url I tried after generating a nonce for myself... I got an error: http://mysite.com/?json=post.create_posts&nonce='5d3f89d00e'&title='testingpost'&content='this%20is%20mypost%20stuff'&status=publish Which currently returns: {"status":"error","error":"Unknown controller 'post'."}


title: How go give $value to wp_query

text: Probly easy question but just cant seem to find whats wrong. I cant build a query based on a search when i use ' ' but not when i use a alrdy declared variable. This works               $query2 = new WP_Query( 's='motorkap met' );      while( $query2->have_posts() ) {                 $query2->the_post();     echo the_title();?> </br> <?php     }      This doesnt for some reason.... I cant seem to find how to pass the already declared variable               $zoekterm = removeCommonWords('motorkap met');           $query2 = new WP_Query( 's=$zoekterm' );      while( $query2->have_posts() ) {                 $query2->the_post();     echo the_title();?> </br>      }      Very stupid I know but been searching for over 2 hours alrdy :( must be passing it wrong somehow tried everything from echo, to just $zoekterm to 's='$zoekterm' ' etc...


title: Removing Wordpress Plugin Menu Item for a specific user

text: I want to remove certain dashboard menu times for a specific user. Now this menu consist of plugin menu items as well. One particular plugin I want to hide from the user is Contact Form 7. Here is the code added to the functions.php file to hide the menu items:               function remove_menus()     {         global $menu;         global $current_user;         get_currentuserinfo();         if($current_user->user_login == 'brian')         {             $restricted = array(__('Media'),                                 __('Links'),                                 __('Pages'),                                 __('Comments'),                                 __('Appearance'),                                 __('Plugins'),                                 __('Users'),                                 __('Tools'),                                 __('Settings'),                         __('WPCF7')  //this does not work             );             end ($menu);             while (prev($menu)){                 $value = explode(' ',$menu[key($menu)][0]);                 if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}             }// end while         }// end if     }     add_action('admin_menu', 'remove_menus');       Now everything listed in the code above here is hidden, except for the Contact Form 7 Plugin menu. How do I call the correct plugin name? Thanks


title: pagination custom post type on CP page

text: I know that there are a lot of topics on this question and I've read a lot of them and tried different things. But pagination is still not working. I think it has something to do with the permalink settings. **The situation** I have a custom post type called artists which I link to events. On the artist page I show all the events the artist is linked to (they're linked using the posts 2 posts plugin). I'd like to paginate these events. Let's use ACDC as an example artist. The pagination is showing, and the links point to `root/artist/acdc/page/#` where # is the page number. If I click on page 2 for example I'm not going to `root/artists/acdc/page/2`. The page does seem to load, but I end up at the same URL showing the first 3 posts (`roots/artists/acdc`). So I don't get a 404. When I go to `root/artists/acdc?page=2`, the URL becomes `root/artists/acdc/2/`, but it still displays the 3 posts from page 1. This happens when `'format'` is set to `'/page/%#%'` in `paginate_links`. If I then hover the pagination link for page 3, the link becomes `root/artists/acdc/2/page/3`... **My settings**   * Permalink custom structure: `/%category%/%postname%/`   * I'm using the roots theme which does apply some rewrites, but I as far as I can see there are not rewrites for the permalinks / page structure **Stuf I've already tried**   * Changed 'show maximum of' setting in WP settings from 10 to 1   * Changed `'paged'` to `'page'` in `$paged`   * Going to the URL `root/artists/acdc/page/2`, no luck as described above   * Going to the URL `root/artists/acdc?page=2`, no luck and weird behavior as described above   * Changed `'format'` in `paginate_links` to `'?page=%#%'` **My code (which is on the artist custom post type template but will eventually be stored in functions.php**               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(         'connected_type' => 'artists_to_events',         'connected_items' => get_queried_object(),         'post_type' => 'events',         'post_status' => 'publish',         'posts_per_page' => 3,         'paged' => $paged,         'meta_key' => 'custom_date',         'orderby'=> 'meta_value',         'order' => 'ASC'     );          $query = new WP_Query($args);          $big = 99999999;          echo paginate_links(array(         'base' => str_replace($big, '%#%', get_pagenum_link($big)),         'format' => '/page/%#%',         'total' => $query->max_num_pages,         'current' => max(1, get_query_var('paged')),         'show_all' => false,         'end_size' => 2,         'mid_size' => 3,         'prev_next' => true,         'prev_text' => 'Vorige',         'next_text' => 'Volgende',         'type' => 'list'     ));      Because of the weird URL behaviour I don't really know where the problem lies. Any ideas?