WP Custom Permalink Filter

I've got a custom filter which appends the image #ID to the end of the image href, however it returns 2 x url's. Can anybody see what i'm doing wrong?               function modify_attachment_link($markup, $id, $size, $permalink, $icon, $text) {              $pos = strpos($markup, "href") + 6;         $remainstring = substr($markup, $pos);         $pos2 = strpos($remainstring, "'");         $url = substr($remainstring, 0, $pos2);         $url .= "#image-".$id;         return substr_replace($markup, '' . $url . '', $pos, strlen(''));          }     add_filter( 'wp_get_attachment_link', 'modify_attachment_link', 10, 6 );      Kind regards. :)


Make a really simple gallery structure

The default gallery structure of WordPress is really tortuous:

      Can you help me to output a simple list of images just like:


Automatically set page order on create page

Is there a way to **automatically set page order** to the last order number **upon creating new pages** instead of having it set to 0?


[Plugin: Posts 2 Posts] reciprocal connections

I'm using Posts 2 Posts plugin. I've got 2 custom types : movies and actors. I created a movie => actor connection so that for each movie I can see which actors play in. But as far as I understand, in order to find out all the movies a particular actor has played in, you must create an actor => movie connection AS WELL. So if create a The Dark Knight => Christian Bale connection, I MUST create a Christian Bale => The Dark Knight as well. Because otherwise I won't be able to know that Christian Bale played in that movie based on a "Christian Bale" search. Is that correct ? If so, is there any way to make it less burdensome ?


Populating a page with content from post custom fields

I'm doing up a blog at the moment where each post is accompanied by the name of a song. Adding the songs to the posts is fairly easily done via custom fields. However, I also need to have a page which lists all the songs in one place. Can this be done without using a plugin? If so, how? (And if not, then what's the best plugin to use to do it?) Thanks.


what is the action hook code to supporting product category condition in single product page of woocommerce?

I want to display product attributes of 2 different product category with the help of conditional tags. But the condition was not working               This is the condition that i given       Height:get('height'); ?> Width:get('width'); ?> Thickness:get('thickness'); ?> Frame Size:get('frame_size'); ?> Weight after packing:get('weight_after_packing'); ?> Large:get('large'); ?> Medium:get('medium'); ?> Small:get('small'); ?>               If the condition is working with the help of action hook. But i am not aware abt that .Can u pls help me...


Post visibility on the basis of roles

How to make a post visible to only:   1. The post author, irrespective of its user role.   2. All users from a specific user role. Other then these, no one should be able to see the post. How should I approach this. Note that I have only three user roles in WP. Admin, and 2 other custom roles.


How Do I Use WP_Query to Run This Database Query as Search Result?

I have created a search box with a drop down box of 4 options to customize the search:   * A general default search, no filter   * A custom search according to the post title for a custom post type only.   * A custom search according to the post content for a custom post type only.   * A custom search according to the meta value attached to a post for a custom post type only.  I've built the search box to handle this. It looks like this in the functions.php file:               function r3_search_form( $form ) {         $form = '<form role="search" method="get" id="top_nav_search" action="' . home_url( '/' ) . '" >
                  ' . __('Type of Search:') . '             <select name="type" id="ic_search_type" >                 <option value="all">General Search |search full site contents|</option>                 <option value="name">Mineral Name |search the approved name for the mineral|</option>                 <option value="loc">Locality |search by mine name, district, state, or country|</option>                 <option value="detail">Description |search the description of the mineral|</option>             </select>             ' . __('Search Form:') . '             <input type="text" value="' . get_search_query() . '" name="s" id="s" />             <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
         </form>';              return $form;     }          add_filter( 'get_search_form', 'r3_search_form' );      Using that search box returns a URL with a query string at the end that looks like this: `?type=loc&s=Arizona` . You'll notice that I've only added one additional parameter `type` from what a default search would return. Here's what I'm trying do to. Depending on the search result, I need to alter the main query to behave something like one of the following MySQL queries:   1. SELECT * FROM wp_posts,wp_postmeta WHERE wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_custom_meta_key' AND wp_postmeta.meta_value LIKE '%$search_term%' AND wp_posts.post_type = 'custom-post-type' ORDER BY wp_posts.post_date DESC    2. SELECT * FROM wp_posts WHERE wp_posts.post_title LIKE '%$search_term%' AND wp_posts.post_type = 'custom-post-type' ORDER BY wp_posts.post_date DESC I've found this post over at WordPress forums from two years ago: http://wordpress.org/support/topic/query-posts-by-custom-fields-value This comes pretty close to what I'm wanting to accomplish, but my question is if there is a way to do this within the WP_Query loop exclusively without using the WP database class ($wpdb). I've set up a `pre-get-post` filter function with a switch according to the `type` parameter in the functions.php file to handle this request, but I am not able to get the query to run as described above using just WP_Query class. Can it be done? Thanks.


can't change footer

I've looked at all the help for changing footers but I still have the same problem - I go to appearance, editor, footer.php, change the telephone number that had been previously entered, hit update, and it goes right back to the old telephone number. I checked the permissions and my login is the "owner" and has full permissions for every file. I'm also unable to update plugins or wordpress themes/editions with the login I use for Wordpress. And...I can't seem to get pictures to load at all. Maybe those three go together, but if they don't, I'm most frustrated about the footer issue. I should probably also add that someone else set up the site, and did so under a different computer login. HOWEVER, when I check the details, my login has every single permission the admin does. So I don't think this is the problem. It also says my login is the "owner."


Why do some pages on my site use the previous theme?

I have developed a WordPress website using a Child Theme, I started with Twenty Ten as the base, then I created a new and improved version with Twenty Eleven as the base and some new features, now I have done it again with Twenty Twelve as the Parent theme. The new features are working mostly great, except when viewing certain pages on the site it wants load the Stylesheet, etc. from the previous (Differently named, Twenty Eleven child) theme. Why? URL: http://winemerchantltd.com/   Observe the home page (header, menu, sidebar, etc), then click on the "CLASSES" or "FIND WINE" link to see what I am talking about. Thank You


Why plugin's icon for the menu not found?

Why plugin's icon is not showing in plugin menu ? All code of plugin :               add_action( 'admin_menu', 'register_my_custom_menu_page' );          function register_my_custom_menu_page(){              add_menu_page( 'Site Market', 'Site market', 'manage_options', 'market_admin/index.php', '',              plugins_url( 'market_admin/icon.png' ), 6 );          }


Do Wordpress plugins suport multisite site?

I will build several community sites that somehow similar structure. I will use buddypress. I am new to Wordpress I have used Drupal before. Currently buddypress 1.6.1 version states that it works with multisite configuration. What about other popular plugins do they also work with multisite? In Drupal multisite is straightforward, but I have read some problems with Wordpress multisite plugin support. Which one is less trouble multiple distinct setups for each domain or using one instalation with multisite configuration.


Custom column working problem

I am adding a column to manage number of post shares on twitter. I made this code:               function Twits($url) {     $s = file_get_contents("http://urls.api.twitter.com/1/urls/count.json"."?callback=?&url=".urlencode($url));             //line 1218     preg_match("#(\"count\"):([0-9]*)#",$s,$ar);     return isset($ar[2]) ? $ar[2] : 0;  }          add_filter('manage_posts_columns', 'columns_head');     add_filter('manage_posts_custom_column', 'columns_content', 10, 2);          function columns_head($defaults) {          $defaults['twitter_shares'] = 'Twitter Shares';          return $defaults;      }          function columns_content($column_name, $post_ID) {     if ($column_name == 'twitter_shares') {     echo Twits(get_permalink($post->ID)); }          }      It works fine on localhost, but shows errors and warnings on main site, here are those:               Warning: file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/content/61/10208161/html/.../functions.php on line 1218          Warning: file_get_contents(http://urls.api.twitter.com/1/urls/count.json?callback=?&url=http%3A%2F%2abc123.com%2F2013%2F04%2F02%2Fchanged-into%2F) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/content/61/10208161/html/.../functions.php on line 1218     0      line 1218 is in above code.


Php conditional help needed

I am trying to add conditionals for authorship to show for posts on a specific author id. Would appreciate if someone could give the following a quick look over               <?php if is_author ('2') AND ( is_single() ) {?>     <link rel="author" href="https://plus.google.com/**********"/>     <?php }?>


Remove tags from the kses filter

I know one can modify the kses filter to add new allowed tags to it, but is there a way to remove some of them? I can't find how. I need to disallow DIV tags. Any ideas? Thanks


wp_insert_post incorrectly escapes HTML comments when they include tags

I'm working on writing a script to import data from a custom CMS into Wordpress. As part of this, I need to import the post content exactly, without modifying anything. However, some of the posts contain HTML comments which contain tags, and this seems to be confusing Wordpress. I've distilled my script down into a small representative example:               <?php          $_SERVER['HTTP_HOST'] = 'localhost';     require_once('/var/www/wordpress/wp-load.php');          $post = array(       'post_content' => 'This is ',       'post_status' => 'publish'     );          wp_insert_post($post);      This works fine, and I get exactly what you would expect. If I view the source of the post in my browser, I get:

This is

      But if my comment contains tags in it (for example, replace the `post_content` with `This is <!-- <p>a comment</p> \-->`), Wordpress escapes the comment delimiters and parses the tags inside. The comment becomes visible, and when I view source, it looks like this:

This is <!–
a comment

 –>

      How can I prevent Wordpress from breaking the comment delimiters and parsing the tags inside? For the record, I'm on Wordpress 3.3.1 in Ubuntu 12.04. EDIT: Just tried it on Wordpress 3.4; the problem still occurs.


wp_insert_post to schedule a post - but nothing happens?

I'm trying to schedule a post that is currently a draft:               function schedule() {          $postdate = date('2014-06-11 00:30:00');     $post = array(         'ID' => 11,       'post_status'    => 'future',       'post_type'      => 'post',       'post_author'    => '1',       'ping_status'    => 'closed',       'to_ping'        => 'http://rpc.pingomatic.com/',       'post_date_gmt'  => $postdate     );       wp_insert_post( $post );      }     add_action('wp_head', 'schedule');      Nothing happens to the post in question though, it still remains a draft? Is there some other way to schedule a post, or is something wrong with my code?


Translate placeholder text in search field

I want to translate the placeholder attribute in my search box. I am using the WPML-plugin to translate all text. How can I accomplish this? My code:               <input type="search" class="search-field" placeholder="Your Search term here" value="<?php echo esc_attr( $search ); ?>" name="search">


How to handle cookies from a WordPress plugin on a cached page?

I'm attempting to write a plugin that can work with cookies on a WordPress site that uses page caching (why?). I've been following this tutorial on Esanctuary.net. I'm trying to write to the error_log to see if the cookie logic is working, but for some reason, I'm not getting any logs from the `esanctuary_sidebar_cookie` function when using the wp_ajax hooks. I'm also making use of cookie.js to handle the setting of the cookie. Here is my plugin code:               <?php     /*     Plugin Name: Example     Plugin URI:      Description:      Version: 0.0.1     Author:      Author URI:      */     class Example {              // Constructor         function __construct() {             add_action( 'wp_enqueue_scripts', array( &$this, 'add_js' ) );             add_action( 'wp_ajax_my_action', array( &$this, 'esanctuary_sidebar_cookie' ) );             add_action( 'wp_ajax_nopriv_my_action', array( &$this, 'esanctuary_sidebar_cookie' ) );         }              // PHP4 Constructor         function Example () {             $this->__construct();         }              function add_js() {             if( !wp_script_is( 'cookiejs', 'queue' ) ) {                 wp_enqueue_script( 'cookiejs', plugins_url( basename( __DIR__ ) . '/js/cookie.min.js' ), array( 'jquery' ) );             }             wp_enqueue_script( 'cookieset', plugins_url( basename( __DIR__ ) . '/js/cookie-set.js' ), array( 'jquery' ) );         }              function esanctuary_sidebar_cookie() {             error_log( 'esanctuary' );                  // Check if a cookie has been set             if ( isset($_COOKIE["edition"]) ) {                      // Get the value of that cookie                 $edition = $_COOKIE["edition"];                      // Determine which sidebar to show based on that cookie                 if ($edition == 'new-york') {                     error_log( 'New York' );                 }                      else if ($edition == 'miami') {                     error_log( 'Miami!' );                 }                  } else {                 error_log( 'No!' );             }              }          }          $iMobieLandingLogic = new Example;      Here is my JavaScript code:               jQuery( document ).ready(function() {         if (cookie.enabled()) {             cookie.set('edition', 'new-york');             var allCookies = cookie.all();             console.log( allCookies );         } else {         }              var data = {             action: 'my_action',             whatever: 1234         };              jQuery.post(cookiesetdata.ajaxurl, data, function(response) {         });     });


Wordpress menu links with images & class selection

Link 1

Link 2

Link 3

Link 4

Link 5

Link 6

Link 7

Link 8

      Image 'slash.png' need be at the end of every link but not at last link, How can I implement this kind of menu within wordpress ? How class 'selected' will be applied when link of perticular page is selected?


Should custom meta boxes be able to output shortcodes the same as Wordpress' native post editor?

Simply put: Should custom meta boxes be able to output shortcodes the same way as Wordpress' native post editor? Reason I ask is because Ive created my own custom meta box for inputting a shortcode from the Cart66 plugin in order to output an "Add To Cart" button but when I try - it only prints the text from the shortcode rather than rendering the actual button. My current meta box:                 <?php     //////////////////////////////////////////////////////////////////////     // Register Custom Post Type Meta Box -- Add To Cart Button Field   //     //////////////////////////////////////////////////////////////////////     add_action( 'add_meta_boxes', 'store_button_meta_box_add' );     function store_button_meta_box_add()     {         add_meta_box( 'epr_store_button_meta_id', 'Add To Cart Button [shortcode]', 'store_button_meta_box_cb', 'epr_store', 'side', 'high' );     }          function store_button_meta_box_cb( $post )     {         $values = get_post_custom( $post->ID );         $button = isset( $values['meta_box_button_shortcode'] ) ? esc_attr( $values['meta_box_button_shortcode'][0] ) : '';         wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );         ?>         <p>             <textarea name="meta_box_button_shortcode" id="meta_box_button_shortcode" row="5" style="width:100%; height:100px;text-align:left;"><?php echo esc_textarea($button); ?></textarea>         </p>         <?php        }               add_action( 'save_post', 'epr_button_meta_box_save' );     function epr_button_meta_box_save( $post_id )     {         // Bail if we're doing an auto save         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;              // if our nonce isn't there, or we can't verify it, bail         if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;              // if our current user can't edit this post, bail         if( !current_user_can( 'edit_post' ) ) return;              // now we can actually save the data         $allowed = array(              'a' => array( // on allow a tags                 'href' => array() // and those anchords can only have href attribute             )         );              // Probably a good idea to make sure your data is set         if( isset( $_POST['meta_box_button_shortcode'] ) )             update_post_meta( $post_id, 'meta_box_button_shortcode', wp_kses( $_POST['meta_box_button_shortcode'], $allowed ) );     }     ?>


Add space to the end on a widget

I have a widget that when stacked with another the out put from my widget to the next sit on top of each other. I tried echo `<br>` but that gives me a fatal error. Is there any other code to add to the end to increase the space?                /**      * Register the widget      */     function wpspprofwid_load_widgets() {         register_widget( 'WPS_PRO_Profile_Widget' );     }     add_action( 'widgets_init', 'wpspprofwid_load_widgets' );          /**      * Profile Widget class.      */     class WPS_PRO_Profile_Widget extends WP_Widget {              /**          * Widget setup.          */         public function __construct() {             $widget_ops = array( 'description' => __('Add a custom Profile to your sidebar.') );             parent::__construct( 'nav_menu1', __('WP Symposium PRO Profile'), $widget_ops );         }              // ********************** How to display Widget on Screen *******************************         public function widget($args, $instance) {                  // THIS is where to ADD the code             if ( ! is_user_logged_in() ) {                 echo '';                 return;             }                  // Set Title             $title = apply_filters( 'widget_title', $instance['title'] );                  // Display before widget code             echo $before_widget;                  //Display Title             if ( ! empty( $title ) )                 echo $args['before_title'] . $title . $args['after_title'];                  /* ========================= Avatar image start ====================================*/                  if($instance['avtar_size']!='')             {                      echo do_shortcode('[wps-avatar size="'.$instance['avtar_size'].'"]');             }             /* ========================= Avatar image end ====================================*/             // Do Shortcodes                  echo "
"; // space             echo do_shortcode('[wps-friends-add-button]');             echo "
"; // space                  // ====================== Menu Display ==================================                  //Set Menu title             $mtitle = apply_filters( 'Menu Title', $instance['mtitle'] );                  //Display Title             if ( ! empty( $mtitle ) )                 echo $args['before_mtitle'] . "
$mtitle
" . $args['after_mtitle'];                  // Get menu             $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;                  if($nav_menu != '')             {                 wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) );             }                  /* ========================= Friends shortcode start ====================================*/                  if($instance['friends_shortcode']=='on')             {                 echo "
My Friends
";                 echo do_shortcode('[wps-friends size="35" count=5]');             }                  /* ========================= Friends Page URL start ==================================*/                  echo '
'.$instance['fptitle'].'
';                  /* ========================= First Shortcode section start ===================================*/             //Set Shortcode 1 title             $sc1title = apply_filters( 'Shortcode 1 Title', $instance['sc1title'] );                  //Display Shortcode 1 title             if ( ! empty( $sc1title ) )                 echo $args['before_sc1title'] . "
$sc1title
" . $args['after_sc1title'];                  //Do Shortcode 1             echo do_shortcode($instance['sc1']);             //echo "
";                  /* ========================= Second Shortcode section start ===============================*/                  //Set Shortcode 2 title             $sc2title = apply_filters( 'Shortcode 2 Title', $instance['sc2title'] );                  //Display Shortcode 2 title             if ( ! empty( $sc2title ) )                 echo $args['before_sc1title'] . "
$sc2title
" . $args['after_sc1title'];                  //Do Shortcode 2             echo do_shortcode($instance['sc2']);             //echo "
";                  /* ========================= Third Shortcode section start =====================*/                  //Set Shortcode 3 title             $sc3title = apply_filters( 'Shortcode 3 Title', $instance['sc3title'] );                  //Display Shortcode 3 title             if ( ! empty( $sc3title ) )                 echo $args['before_sc1title'] . "
$sc3title
" . $args['after_sc1title'];                  //Do Shortcode 3             echo do_shortcode($instance['sc3']);             //echo "
";                  /* ========================= Fourth Shortcode section start ==========================*/                  //Set Shortcode 4 title             $sc4title = apply_filters( 'Shortcode 4 Title', $instance['sc4title'] );                  //Display Shortcode 4 title             if ( ! empty( $sc4title ) )                 echo $args['before_sc1title'] . "
$sc4title
" . $args['after_sc1title'];                  //Do Shortcode 4             echo do_shortcode($instance['sc4']);             //echo "
";                  /* ========================= Fifth Shortcode section start ==========================*/                  //Set Shortcode 5 title             $sc5title = apply_filters( 'Shortcode 5 Title', $instance['sc5title'] );                  //Display Shortcode 5 title             if ( ! empty( $sc5title ) )                 echo $args['before_sc1title'] . "
$sc5title
" . $args['after_sc1title'];                  //Do Shortcode 5             echo do_shortcode($instance['sc5']);             //echo "
";                  /* ========================= Sixth Shortcode section start =============================*/                  //Set Shortcode 6 title             $sc6title = apply_filters( 'Shortcode 6 Title', $instance['sc6title'] );                  //Display Shortcode 6 title             if ( ! empty( $sc6title ) )                 echo $args['before_sc1title'] . "
$sc6title
" . $args['after_sc1title'];                  //Do Shortcode 6             echo do_shortcode($instance['sc6']);                  echo $args['after_widget'];                  // Display after widget code             echo $after_widget;         }              // Update the widget settings.         public function update( $new_instance, $old_instance ) {             $instance['title'] = strip_tags( stripslashes($new_instance['title']) );             $instance['avtar_size'] =  strip_tags( stripslashes($new_instance['avtar_size']) );             $instance['mtitle'] = strip_tags( stripslashes($new_instance['mtitle']) );             $instance['nav_menu'] = (int) $new_instance['nav_menu'];             $instance['friends_shortcode'] =  $new_instance['friends_shortcode'];             $instance['fptitle'] = strip_tags( stripslashes($new_instance['fptitle']) );             $instance['friends_url'] = strip_tags( stripslashes($new_instance['friends_url']) );             $instance['sc1title'] = strip_tags( stripslashes($new_instance['sc1title']) );             $instance['sc1'] = strip_tags( stripslashes($new_instance['sc1']) );             $instance['sc2title'] = strip_tags( stripslashes($new_instance['sc2title']) );             $instance['sc2'] = strip_tags( stripslashes($new_instance['sc2']) );             $instance['sc3title'] = strip_tags( stripslashes($new_instance['sc3title']) );             $instance['sc3'] = strip_tags( stripslashes($new_instance['sc3']) );             $instance['sc4title'] = strip_tags( stripslashes($new_instance['sc4title']) );             $instance['sc4'] = strip_tags( stripslashes($new_instance['sc4']) );             $instance['sc5title'] = strip_tags( stripslashes($new_instance['sc5title']) );             $instance['sc5'] = strip_tags( stripslashes($new_instance['sc5']) );             $instance['sc6title'] = strip_tags( stripslashes($new_instance['sc6title']) );             $instance['sc6'] = strip_tags( stripslashes($new_instance['sc6']) );             return $instance;         }              // =============== Displays widget in Admin Panel              public function form( $instance ) {             $title = isset( $instance['title'] ) ? $instance['title'] : '';             $avtar_size = isset( $instance['avtar_size'] ) ? $instance['avtar_size'] : '';             $mtitle = isset( $instance['mtitle'] ) ? $instance['mtitle'] : '';             $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';             $friends_shortcode = isset( $instance['friends_shortcode'] ) ? $instance['friends_shortcode'] : '';             $fptitle = isset( $instance['fptitle'] ) ? $instance['fptitle'] : '';             $friends_url = isset( $instance['friends_url'] ) ? $instance['friends_url'] : '';             $sc1title = isset( $instance['sc1title'] ) ? $instance['sc1title'] : '';             $sc1 = isset( $instance['sc1'] ) ? $instance['sc1'] : '';             $sc2title = isset( $instance['sc2title'] ) ? $instance['sc2title'] : '';             $sc2 = isset( $instance['sc2'] ) ? $instance['sc2'] : '';             $sc3title = isset( $instance['sc3title'] ) ? $instance['sc3title'] : '';             $sc3 = isset( $instance['sc3'] ) ? $instance['sc3'] : '';             $sc4title = isset( $instance['sc4title'] ) ? $instance['sc4title'] : '';             $sc4 = isset( $instance['sc4'] ) ? $instance['sc4'] : '';             $sc5title = isset( $instance['sc5title'] ) ? $instance['sc5title'] : '';             $sc5 = isset( $instance['sc5'] ) ? $instance['sc5'] : '';             $sc6title = isset( $instance['sc6title'] ) ? $instance['sc6title'] : '';             $sc6 = isset( $instance['sc6'] ) ? $instance['sc6'] : '';                  // Get menus             $menus = wp_get_nav_menus( array( 'orderby' => 'name' ) );                  // If no menus exists, direct the user to go and create some.             if ( !$menus ) {                 echo '
'. sprintf( __('No menus have been created yet. Create some.'), admin_url('nav-menus.php') ) .'
';                 return;             }             // ============= Widget Selectio s and inputs             ?>
                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wpspprofwid' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />

Select Avatar Size Below:
             <label for="<?php echo $this->get_field_id( 'avtar_size' ); ?>"><?php _e( 'Avatar Size: ' ); ?>             <select id="<?php echo $this->get_field_id( 'avtar_size' ); ?>" name="<?php echo $this->get_field_name('avtar_size'); ?>">                 <option value=""> - No Avatar - </option>                 <?php                     echo '<option value="200"'. selected( $avtar_size, '200', false ). '>200 x 200px</option>';                     echo '<option value="150"'. selected( $avtar_size, '150', false ). '>150 x 150px</option>';                     echo '<option value="100"'. selected( $avtar_size, '100', false ). '>100 x 100px</option>';                 ?>             </select>

                 <label for="<?php echo $this->get_field_id( 'mtitle' ); ?>"><?php _e( 'User Menu Title:' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('mtitle'); ?>" name="<?php echo $this->get_field_name('mtitle'); ?>" value="<?php echo $mtitle; ?>" />

                 <label for="<?php echo $this->get_field_id( 'nav_menu' ); ?>"><?php _e( 'Set User Menu:' ); ?>                 <select id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">                     <option value="">Select Menu</option>                     <?php                         foreach ( $menus as $menu ) {                             echo '<option value="' . $menu->term_id . '"'                                 . selected( $nav_menu, $menu->term_id, false )                                 . '>'. $menu->name . '</option>';                         }                     ?>                 </select>

Check Box to Show Friends
             <label for="<?php echo $this->get_field_id( 'friends_shortcode' ); ?>"><?php _e( 'Show Friends: ' ); ?>             <input class="checkbox" type="checkbox" <?php checked($friends_shortcode , 'on'); ?> id="<?php echo $this->get_field_id('friends_shortcode'); ?>" name="<?php echo $this->get_field_name('friends_shortcode'); ?>" />

Link for Friends Page - leave blank for no link
             <label for="<?php echo $this->get_field_id( 'fptitle' ); ?>"><?php _e( 'Friend Page Label - ex. See All Friends' ); ?>             <input type="text" class="widefat" id="<?php echo $this->get_field_id('fptitle'); ?>" name="<?php echo $this->get_field_name('fptitle'); ?>" value="<?php echo $fptitle; ?>" />

                 <label for="<?php echo $this->get_field_id( 'friends_url' ); ?>"><?php _e( 'URL to Friends Page:' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('friends_url'); ?>" name="<?php echo $this->get_field_name('friends_url'); ?>" value="<?php echo $friends_url; ?>" />
Add Additional Shortcodes Below:

                 <label for="<?php echo $this->get_field_id( 'sc1title' ); ?>"><?php _e( 'Shortcode 1 Title:' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc1title'); ?>" name="<?php echo $this->get_field_name('sc1title'); ?>" value="<?php echo $sc1title; ?>" />

                 <label for="<?php echo $this->get_field_id( 'sc1' ); ?>"><?php _e( 'Shortcode 1:' ); ?>                 <textarea name="<?php echo $this->get_field_name('sc1'); ?>" id="<?php echo $this->get_field_id('sc1'); ?>" class="widefat"><?php echo $sc1; ?></textarea>

                 <label for="<?php echo $this->get_field_id( 'sc1title' ); ?>"><?php _e( 'Shortcode 2 Title:' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc2title'); ?>" name="<?php echo $this->get_field_name('sc2title'); ?>" value="<?php echo $sc2title; ?>" />

                 <label for="<?php echo $this->get_field_id( 'sc2' ); ?>"><?php _e( 'Shortcode 2:' ); ?>                 <textarea name="<?php echo $this->get_field_name('sc2'); ?>" id="<?php echo $this->get_field_id('sc2'); ?>" class="widefat"><?php echo $sc2; ?></textarea>

                 <label for="<?php echo $this->get_field_id( 'sc3title' ); ?>"><?php _e( 'Shortcode 3 Title:' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc3title'); ?>" name="<?php echo $this->get_field_name('sc3title'); ?>" value="<?php echo $sc3title; ?>" />

                 <label for="<?php echo $this->get_field_id( 'sc3' ); ?>"><?php _e( 'Shortcode 3:' ); ?>                 <textarea name="<?php echo $this->get_field_name('sc3'); ?>" id="<?php echo $this->get_field_id('sc3'); ?>" class="widefat"><?php echo $sc3; ?></textarea>

                 <label for="<?php echo $this->get_field_id( 'sc4title' ); ?>"><?php _e( 'Shortcode 4 Title:' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc4title'); ?>" name="<?php echo $this->get_field_name('sc4title'); ?>" value="<?php echo $sc4title; ?>" />

                 <label for="<?php echo $this->get_field_id( 'sc4' ); ?>"><?php _e( 'Shortcode 4:' ); ?>                 <textarea name="<?php echo $this->get_field_name('sc4'); ?>" id="<?php echo $this->get_field_id('sc4'); ?>" class="widefat"><?php echo $sc4; ?></textarea>

                 <label for="<?php echo $this->get_field_id( 'sc5title' ); ?>"><?php _e( 'Shortcode 5 Title:' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc5title'); ?>" name="<?php echo $this->get_field_name('sc5title'); ?>" value="<?php echo $sc5title; ?>" />

                 <label for="<?php echo $this->get_field_id( 'sc5' ); ?>"><?php _e( 'Shortcode 5:' ); ?>                 <textarea name="<?php echo $this->get_field_name('sc5'); ?>" id="<?php echo $this->get_field_id('sc5'); ?>" class="widefat"><?php echo $sc5; ?></textarea>

                 <label for="<?php echo $this->get_field_id( 'sc6title' ); ?>"><?php _e( 'Shortcode 6 Title:' ); ?>                 <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc6title'); ?>" name="<?php echo $this->get_field_name('sc6title'); ?>" value="<?php echo $sc6title; ?>" />

                 <label for="<?php echo $this->get_field_id( 'sc6' ); ?>"><?php _e( 'Shortcode 6:' ); ?>                 <textarea name="<?php echo $this->get_field_name('sc6'); ?>" id="<?php echo $this->get_field_id('sc6'); ?>" class="widefat"><?php echo $sc6; ?></textarea>
         <?php         }     }


Login redirect to certain bp profile page

Im trying to do a redirect to a certain bp profile page but for some reason it keeps going to the home page on the login. this is my code im not entirely sure what the problem is and why it keeps going to the home page.               add_action('login_form', 'redirect_after_login');     function redirect_after_login() {         global $redirect_to;         if (!isset($_GET['redirect_real'])) {             $redirect_to = bp_core_get_user_domain($user->ID);             $redirect_real = '$redirect_to/mypics';         }     }


Integrating custom API for post content into Admin interface & Public Website

EDITED question to be more specific and added bounty in hopes someone has a solid coded solution: So, here is an interesting task I have been trying to find a solution for. I have added a bounty which I will award to the best solution in the form of working code. What I am trying to do here is utilize wordpress as the default CMS for a website for all standard content. The solution I am looking for involves a specific "custom post type" I want to have (called: locations). For this custom post type I am specifically looking to have the posts and content automatically populated based upon the city list data and content per city from this wikipedia page: http://en.wikipedia.org/wiki/List_of_cities_in_Los_Angeles_County,_California Now, I realize that one could essentially extract all of the information for each of the cities and use some type of import method to get each Wikipedia city into wordpress (each as a separate post) however this is not what I am after. My requirements and this bounty relates to three specific goals/components: 1) I need all the posts (locations) and their associating content to come from Wikipedia through their API (example below). This means that whenever a post related to the custom post type "locations" is requested the Wikipedia content is delivered (this relates to the main admin area as well as the public website). Data coming from Wikipedia should be cached locally for 24 hours to ensure the data remains current with that of Wikipedia. 2) For the admin and website visitor the source of any Wikipedia content remains transparent. Important here is that the admin retains the ability of editing any of these posts. This means that When the post editor is called for such a location (post) wikipedia content is pulled in realtime and loaded into the post editor. Once the admin saves the post wordpress would no longer request or update the content of this specific post from Wikipedia but will rather deliver it locally from the WP database. 3) It is important to note that from a theme developers point of view no changes should be required at all. This means that all typical elements of requesting a post or custom field needs to remain and function correctly. Finally, it is very important that specific content "sections" of the Wikipedia page can be assigned to specific custom fields used by Wordpress when calling templates or the admin editor. **EXAMPLE Wikipedia API Request Listing all Locations:** http://en.wikipedia.org/w/api.php?action=parse&format=xml&pageid=18614608&prop=wikitext|iwlinks|headitems|links|displaytitle|text **EXAMPLE Wikipedia API Request for the content of a specific location page:** http://en.wikipedia.org/w/api.php?action=parse&format=xml&page=Los_Angeles&prop=wikitext


Opengraph getting thumbnail image and description

Here is the code that I am using to call OpenGraph               > $response = $facebook->api(   'me/objects/article',   'POST',   array(     >     'app_id' => 304895636200481,     >     'type' => "article",     >     'url' => "http://samples.ogp.me/434264856596891",     >     'title' => "Sample Article",     >     'image' => "htps://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png",     >     'description' => ""   ) );      How do I get the `'image' =>` to call the post thumbnail ? How do I get `'description' =>` to get the excerpt?


Previous and next post links formatting

Here's an interesting question. I am trying to format previous and next links using the following format                  <?php previous_post_link('«'); ?>        <?php next_post_link('»'); ?>       I did this on purpose to not display the post title and make users need to click the arrows in to move on the previous and next post. However, this does not create a link around the arrows and I was wondering if there's a way to accomplish this. Thanks Johann


How to show a widget for logged-in users only?

have a widget that I want to hide from visitors to the site. I know I need to use this code;               if ( is_user_logged_in() ) {         echo '';     } else {         echo '';     }      How do I use this in a widget? What function?               <?php          /**      * Register the widget      */     function wpspprofwid_load_widgets() {         register_widget( 'WPS_PRO_Profile_Widget' );     }     add_action( 'widgets_init', 'wpspprofwid_load_widgets' );          /**      * Profile Widget class.      */     class WPS_PRO_Profile_Widget extends WP_Widget {              /**          * Widget setup.          */         public function __construct() {             $widget_ops = array( 'description' => __('Add a custom Profile to your sidebar.') );             parent::__construct( 'nav_menu1', __('WP Symposium PRO Profile'), $widget_ops );         }                        // ********************** How to display Widget on Screen *******************************         public function widget($args, $instance) {                       // Set Title             $title = apply_filters( 'widget_title', $instance['title'] );


Why does the 'Month and Name' Permalink Format not Work on my new Wordpress Site (running on IIS7)?

I have just created a new Wordpress site (version 3.0.1) on a Windows 2003 server, but the 'Month and Time' permalink format does not work. It gives a 404 error when I use it. All of the other standard permalink formats work okay. Please can you tell me what would be causing this issue?


changing the signup button url in WPMU/Buddypress

the default sign up button now points to: http://www.hoopinstructors.com/register/ I need to change the url so that it points to the real sign up page. I looked at register.php, but I don't know php well enough to figure out how to do it. I searched for the url with firebug, but am still unclear on where exactly I can find - and change - the url that the button points to. thanks, Terri


Page/Post path in Search Results

I have lots of pages with similar titles which may be confusing when users search for something. To help them tell apart the pages, I'd like to add the page/post location (path) **under each page/post title** on the Search Results page. Is it possible? Sample SEARCH RESULTS output: **Post Title 1** Home -> News -> Events -> Post Title 1 [content] [read more] **Page Title A** Home -> About -> Page Title A [content] [read more]


Adding Custom Fields to WordPress Comment Forms?

What is the best way to add custom fields to a WordPress comment form? (for example subject, image, etc...) And how do I use the data entered afterwards...


Hard code the nextpage tag into my theme?

I have a custom post type for a Slideshow which uses Custom Post Meta to insert the different slides. How can I code the `<!--nextpage-->` tag in between the sides in my slideshow.php so that they slides will paginate? Right now when I try to do it the code doesn't show because it by it's nature it commented out.


widget exclude post by custom field

I have a widget that gets posts from different post_type's. I want to exclude some posts that have a custom field value e.g. I save a form where a checkbox adds a value of 0 or 1 depending if ticked. If the value is 0 the post should be visable and if the value is 1 then it should not be visable. Here is what I have to extract the posts:               $wpcust = new WP_Query(      array(      'post_type' => array(         'posts_type_1',         'posts_type_2'         ),        'showposts' => '4' )      );      This is a basic WP_Query that selects posts based on two post_types.   What I want to add is:               'meta_key' => 'key',     'meta_value' => 'value'      Where value is 0 or 1. If I do this it only shows posts based on the meta_value. I need it the other way around where this excludes those posts. Any help? Thnx M.


What are the ways to use WordPress as a user generated content site

What are the methods to create a user-generated-content website? I know each has his own favorite way to do that, please elaborate on your own method, how to implement it and the pros/cons. (This is mainly a wiki question, I just figured I know about 7 methods for that) To be more specific: Which ways do you use to give visitors the ability to add contnet to your website (posts, images, videos, etc...)


Adding Categories to a WordPress Custom Post Type?

Is it possible to add categories to a Custom Post Type in WordPress?


Some plugins adding full server path after url (with custom wp-content folder)

Installing Wordpress SEO (an a few others but not all plugins) gives the following console error:               GET http://craigmdennis.com/content/plugins/nfs/c08/h04/mnt/152547/domains/craigmdennis.com/html/content/plugins/wordpress-seo/js/wp-seo-admin-global.js?ver=1.2.5 404 (Not Found)      For some reason it is listing the complete server path after my url. It seems as though `/nfs/c08/h04/mnt/152547/domains/craigmdennis.com/html/content/plugins/` or `http://craigmdennis.com/content/plugins/` should not be present in the url. Here is the directory structure (please note the custom content directory):               wp/     content/     content/themes/     content/plugins/     .htaccess     index.php     wp-config.php      I am not running MU. I also have a subdomain for media (shouldn't be effecting the issue but I'm listing it for completedness) Here are the relevant parts of my wp-config.php file:               define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp');          define('WP_HOME',    'http://' . $_SERVER['HTTP_HOST']);          define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/content');          define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content');      Does anyone know what's going on here? Thanks. [EDIT] I think it's related to `__FILE__` and not DOCUMENT_ROOT as the plugins all use `__FILE__` to get the directory name. This provides `/nfs/c08/h04/mnt/` instead of `/home/`. When I echo the location of the plugins_url() I get `/home/152547/domains/dev.craigmdennis.com/html/content/plugins` which is correct but when I pass in **FILE** as a parameter I get the aforementioned `/nfs/c08/h04/mnt/152547/domains/dev.craigmdennis.com/html/content/plugins/{plugin- folder}`. Could this be something to do with PHP resolving aliases for `__FILE__` This would explain why it works on my local server (with no aliases) and doesn't on Media Temple (which may alias `/nfs/c08/h04/mnt/` for `/home/` Is this a Wordpress issue or an issue on my server?


Remove Sidebar for Pages on Canvas Wootheme

In the Canvas WooTheme you can add custom CSS code. I need some code to hide the sidebar on all pages (or specific pages if possible). But I need to keep it on all posts. I don't just want it 'blanked out'. I need it to be completely so that the page width isn't limited by the blank space where the sidebar used to be. Any ideas?? Thanks, Ben


Post featured image column on admin post list page

I have a client site which accepts images from users as posts. For moderation, we are opening each draft post which obviously takes a lot of time if a hefty amount of images are moderated. So, Is there a way to show featured images of the post on the admin post list page as a column?


Create a Custom Path to Archive

To get at archive pages (by default) the path is /%category%/ Which is fine. But how would i change it to have a static string prefix before the category variable (e.g. /archive/%category%). Same thing for custom-post-type archives


Adding new menu items with wp_nav_menu_items

I am trying to add menu items dynamically using the wp_nav_menu_items filter. What I am doing is working fine on two of my menus but I cannot make it work for the third. Code to register the menus:               register_nav_menus( array(             'primary' => __( 'Primary Menu', 'mytheme' ),             'top' => __( 'Top Menu', 'mytheme' ),             'top2' => __( 'Top Menu 2', 'mytheme' )         ) );      Code to display the primary menu (this is the one I cannot get things to work)               $args = array(         'menu' => 'primary',         'theme_location'  => 'primary'     );     wp_nav_menu($args);      Code to display the top menu (this one works and new items are added)               $args = array(         'menu' => 'top',         'theme_location'  => 'top'     );     wp_nav_menu($args);      Code to add new items:               add_filter( 'wp_nav_menu_items', 'fx_user_menu', 10, 2 );     function fx_user_menu( $items, $args ) {         if ( $args->theme_location == 'top')  {             $items .= '
Top
';         }         if ($args->theme_location == 'top2') {             $items .= '
Top2
';         }           if ($args->theme_location == 'primary') {             $items .= '
Primary
';         }            return $items;     }      Any idea on why I cant add new items to the primary menu? I have done a `var_dump($args)` which returns nothing for the primary. Top and Top2 return `$args` as expected.


Path to Pages Resolves to Archive instead of Actual Content

When I upgraded to 3.4.1, the root level pages (ones that I had before, and any page I have afterwards) do not resolve to the actual page. No matter the name (so i don't think there is a slug issue), they all show only the archives. This surprisingly does not impact the child pages of these root pages. Just the top level. I have tried disabling the plugins, no help. The only thing I have found to remotely "fix" the problem is switching the permalink structure from /%category%/%postname%/ to default. Even if I explicitly type the url http://joshua.hailpern.com/?p=xxx, it shows the archive page, not the page content (but only for root pages) Please help.


How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?

I've been playing around with code snippets which add meta data to admin searches. The best snippet I've found was written by Stefano on this question. However, it appears to have 1, annoying bug when searching non-meta terms. Here are some grabs from my local dev install. I've printed the 2 MySQL queries onto the screen. ### View of the single CPT post I'm using to test ![View of the single CPT post I'm using to test](http://i.stack.imgur.com/KxvSg.png) ### This is the code working as expected and allowing me to search meta data from admin ![This is the code working as expected and allowing me to search meta data from admin](http://i.stack.imgur.com/0BzwN.png) ### Unfortunately the code creates duplicates on non-meta matches, in this case on post title ![Unfortunately the code creates duplicates on non-meta matches, in this case on post title](http://i.stack.imgur.com/f2aC4.png) ### A grab showing the post status, post type and post ancestors of dupes ![A grab showing the post status, post type and post ancestors of dupes ](http://i.stack.imgur.com/j0p3O.png) Here is the code I'm running, it's basically the same as Stefano's, but with my crude attempts to make the query work.               /*      * Search custom fields from admin keyword searches      */          function rel_search_join( $join ) {         global $pagenow, $wpdb;         if ( is_admin() && $pagenow == 'edit.php' && $_GET['post_type'] == 'listings' && $_GET['s'] != '') {                 $join .= 'LEFT JOIN ' . $wpdb->postmeta . ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';         }         echo '
JOIN: ';         print_r ( $join );         echo '
';         return $join;     }     add_filter('posts_join', 'rel_search_join' );          function rel_search_where( $where ) {         global $pagenow, $wpdb;         if ( is_admin() && $pagenow == 'edit.php' && $_GET['post_type']=='listings' && $_GET['s'] != '' ) {             $where = preg_replace( "/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/", "(".$wpdb->posts.".post_title LIKE $1) OR (".$wpdb->postmeta.".meta_value LIKE $1)", $where );             $where = str_replace( "OR wp_posts.post_status = 'pending'", "", $where );             $where = str_replace( "OR wp_posts.post_status = 'private'", "", $where );             $where = str_replace( "OR wp_posts.post_status = 'draft'", "", $where );             $where = str_replace( "OR wp_posts.post_status = 'future'", "", $where );         }         echo '
WHERE: ';         print_r ( $where );         echo '
';         return $where;     }     add_filter( 'posts_where', 'rel_search_where' );


Wpautop stops working after get_the_excerpt

function pre_process_shortcode($content){                 global $shortcode_tags, $shortcodes;                      // Backup current registered shortcodes and clear them all out                 $orig_shortcode_tags = $shortcode_tags;                  add_shortcode('bloglist','bloglist_func');                       // Do the shortcode (only the one above is registered)                 $content = do_shortcode($content);                      // Put the original shortcodes back                 $shortcode_tags = $orig_shortcode_tags;                      return $content;             }             add_filter('the_content', 'pre_process_shortcode', 7);                  // Allow Shortcodes in Widgets             add_filter('widget_text', 'pre_process_shortcode', 7);              function bloglist_func ($atts,$content=null){                extract(shortcode_atts(array(                 'number'        =>  2,             ), $atts));             ob_start();                  $args = array(                 'post_type'     =>  'post',                 'showposts'     =>  $number,                 'status'        =>  'publish',                 'orderby'       =>  'date',                 'order'         =>  'DESC',             );                  $latest = new WP_Query($args);                  if ($latest->have_posts()):?>
';             <?php                 while($latest->have_posts()): $latest->the_post();?>          <div <?php post_class('post');?> id="post-<?php the_ID();?>">         <div class="date" title="<?php the_time('g:i a'); ?>">                           <?php the_time('F'); ?>             <?php the_time('d'); ?>             <?php the_time('Y'); ?>

<a href="<?php the_permalink();?>"><?php the_title();?>
             <?php if($post_type=='post'):?>
                 <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="<?php printf(__('Posted by %s','wi') , get_the_author() ); ?>" rel="author" class="author"><?php the_author(); ?>                 /                 <?php comments_popup_link( __('Leave a comment','wi'), __('1 comment','wi'), __('% comment','wi'), 'comment-link', __('Comments are closed','wi') ); ?>
             <?php else: // post type == 'portfolio'?>
                 <?php echo get_the_term_list( get_the_ID(), 'category', '', '/', '' );?>
             <?php endif; // endif post_type ?>

<?php echo substr(get_the_excerpt(),0,120);?> …

<a href="<?php the_permalink();?>" class="readmore"><?php _e('Read more →','wi');?>

                  <?php                 endwhile;             ?>
             <?php             endif;  // have posts             wp_reset_query();             $return = ob_get_clean();                return $return;         }      Above is my shortcode. The problem is: when i add the line `get_the_excerpt` inside the code block, `wpautop` stops working after that. After removing `get_the_excerpt`, everything is back to normal. Anyone knows how to solve this problem?


How to not show post_thumbnail from specific category for not logged users

Can you guys help me with some examples so i can sort out the thumb posts from a specific category (EXAMPLE) to not be shown for not logged users, instead to be shown an image which tells them that they have to be logged in order to see that post. Logged users can see all thumb posts. I tried to have this question short as possible, if need anything else i will do it. Thanks


How to remove help tabs?

Is there any way to remove the help tabs? I'm looking to remove these tabs not to hide them with CSS. On the `wp-admin/includes/screen.php` there are a couple of lines that mention this but no idea how to create something to remove the help tab. Is there any way to create something similar to: `add_filter('screen_options_show_screen', '__return_false');` but to remove the Help tab ? From the `screen.php` file:                647      /**      648       * Removes a help tab from the contextual help for the screen.      649       *      650       * @since 3.3.0      651       *      652       * @param string $id The help tab ID.      653       */      654    public function remove_help_tab( $id ) {      655          unset( $this->_help_tabs[ $id ] );      656      }      657        658      /**      659       * Removes all help tabs from the contextual help for the screen.      660       *      661       * @since 3.3.0      662       */      663    public function remove_help_tabs() {      664          $this->_help_tabs = array();      665      }


The plugin assign to the wrong place (layout problem)

<?php     /*     Plugin Name: Push notification     Plugin URI: http://wordpress.org/plugins/temp/     Description: No description     Author: Temp     Version: 1.0     Author URI: http://ma.tt/     */          // This just echoes the chosen line, we'll position it later     function hello_dolly() {     echo "<form id='pushForm'>     Push notification to mobile users?</br>     <select>     <option value='0' default>No</option>     <option value='1'>Yes</option>     </select>     </form>";     }          // Now we set that function up to execute when the admin_notices action is called     add_action( 'wp_insert_post', 'hello_dolly' );          // We need some CSS to position the paragraph     function dolly_css() {         echo "         <style type='text/css'>         #pushForm {             float: right;             padding : 50px;              margin: 0;             font-size: 11px;             background: #ffffff;             border: 1px solid #e5e5e5;         }         </style>         ";     }          add_action( 'wp_insert_post', 'dolly_css' );          add_action( 'publish_post', 'get_title' );          function get_title()     {         echo $_POST['post_title'];     }          ?>      This is the whole plugin code, it is shown when the user publish the post, I would like to show it at the right corner just like one of the portol block (it is ok if just fix it at right side , just make it as simple as possible). Or it would be better if it is inside the publish block , all I need to show is a select box with message "Do you need to push notification?" Thanks for helping ![enter image description here](http://i.stack.imgur.com/wit4y.png)


How to remove the header from all pages except home?

I have a Template Monster WP theme that I need to remove the headers from all pages except home. I have read several posts on this, but my code is a bit different. Can someone please help me? The header.php file is below. Many thanks!

               <?php if(of_get_option('logo_type') == 'text_logo'){?>                 <?php if( is_front_page() || is_home() || is_404() ) { ?>
<a href="<?php bloginfo('url'); ?>/" title="<?php                     bloginfo('description'); ?>"><?php bloginfo('name'); ?>
                 <?php } else { ?>


Wordpress admin loads erratically "connection reset by peer"

I've been managing an Wordpress install for several months now without issues. This morning a user notified me that they could not log in to the admin page via /wp-admin. I was not able to login from my primary computer, but found that I could login from my mobile device and laptop intermittently (sometimes it works, sometimes it does not). On the devices that do not load the admin page, I get the following message `Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.` A `curl -i -l` of the page gets: `(56) Recv failure: Connection reset by peer` On some of the devices that _are_ able to access the admin area only the CSS loads; I get a "request failed" for the admin js files. Other devices (my laptop) are able to navigate the admin interface as usual. I only have 7 plugins enabled on the site, and i've tried disabling all of them to no avail. It's a production site, so i'd prefer not taking it down completely to troubleshoot. Any help would be much appreciated. Thanks! Edit: I've finally heard back from my host. It appears that it may be a problem on their end. I will update with details.


How to: Add a publish immediately button when editing custom WordPress posts? I have found to update a custom post type I need to re-edit the scheduled time to save it. Is it possible to simple update the content for custom post types by pressing something like "Current Date" then it will add the current date, there you can publish it?


wp_update_user doesn't update and update_user_meta does

I'm building user profile page where users could update their profile on the front-end. User profile is extended with a few custom fields, like 'Twitter', 'Facebook' and 'City'. The following code successfully updates all user details except the `dCity`:               $user_fields = array(      'ID'           => $current_user->ID,      'nickname'     => esc_attr($_POST['nickname']),      'first_name'   => esc_attr($_POST['first_name']),      'last_name'    => esc_attr($_POST['last_name']),      'display_name' => esc_attr($_POST['display_name']),      'user_email'   => esc_attr($_POST['email']),      'user_url'     => esc_attr($_POST['url']),      'twitter'      => esc_attr($_POST['twitter']),      'facebook'     => esc_attr($_POST['facebook']),      'description'  => esc_attr($_POST['description']),      'dCity'        => esc_attr($_POST['dCity'])     );          wp_update_user($user_fields) ;      I've tried to use `update_user_meta` to update `dCity` and it worked:               $user_fields = array(      'ID'           => $current_user->ID,      'nickname'     => esc_attr($_POST['nickname']),      'first_name'   => esc_attr($_POST['first_name']),      'last_name'    => esc_attr($_POST['last_name']),      'display_name' => esc_attr($_POST['display_name']),      'user_email'   => esc_attr($_POST['email']),      'user_url'     => esc_attr($_POST['url']),      'twitter'      => esc_attr($_POST['twitter']),      'facebook'     => esc_attr($_POST['facebook']),      'description'  => esc_attr($_POST['description'])     );          wp_update_user($user_fields);     update_user_meta( $current_user->ID, 'dCity', $_POST['dCity'] );      So problem solved, but I'm wondering why `wp_update_user` doesn't update all records? Am I doing something wrong? In advance, thank you.


Fetch all Posts where logged in user has commented

I'm not good at sql queries so the question is: How do I list all the Posts where logged in user has left the comment? I guess it's kinda obvious that redundancy is unwanted in case user posted multiple comments to the same Post. Thanks!


Make changes to translation?

I'm using finnish translation of wordpress. I found the fi.po file which contains all the translations, but for some reason, editing the contents wont edit the contents of the page. Can I make changes to the translation?


posts_nav_link pulling in multiple post types

I have an `archive-regularproducts.php` set up that looks like so:   PHP:                   <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>         //content goes here         <?php endwhile; endif; ?>              <?php wp_reset_query(); ?>              <?php query_posts( 'post_type=wpsc-product'); ?>             <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>             //content goes here             <?php endwhile; endif; ?>              <?php wp_reset_query(); ?>              <nav id="page_nav">             <?php posts_nav_link( ' ', ' ', ' '); ?>         </nav>      As you can see I'm also querying the `wpsc-product` post type on this archive page too, the posts display fine, but as I'm using infinite scroll, when it gets to the bottom and pulls in the next page of posts, it's pulling in duplicate `wpsc-product` posts, thus I was wondering if there was a way to either have the `posts_nav_link` function for only the `regularproducts` post type, or a generally better way of achieving what I'm trying to achieve. Any suggestions would be greatly appreciated!


query_posts orderby multiple ways

I have a problem with query_posts orderby multiple ways. I have in Wordpress one category where I need display first posts with have a rank and after display all posts by title. Below are working codes, that work well, but do not know how to connect these codes. This code show me only posts with ranks, order by high ranks first                 query_posts(array('cat' => $category->term_id, 'posts_per_page' => -1, 'orderby' => 'meta_value', 'meta_key' => '_bunyad_review_overall', 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),));        This code show me all posts orderby title                 query_posts(array('cat' => $category->term_id, 'posts_per_page' => -1, 'orderby' => title, 'order' => ASC, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),));        I need connect these codes and in second code exclude all posts with ranks, because first code will show these posts.   1. Show posts with ranks, orderby high rank first   2. Show all posts, orderby title, exlucde posts with ranks All this display in one page!


Custom permalink structure for custom post type results in 404

I found some code online for creating a custom permalink for a custom post type:               add_filter('post_type_link', 'wpse33551_post_type_link', 1, 3);              function wpse33551_post_type_link( $link, $post = 0 ){             $timestamp = $post->post_date;             $timestamp = preg_replace("/[^A-Za-z0-9]/", "", $timestamp);             if ( $post->post_type == 'recipe' ){                 return home_url( 'recipe/' . $timestamp );             } else {                 return $link;             }         }              add_action( 'init', 'wpse33551_rewrites_init' );              function wpse33551_rewrites_init(){             add_rewrite_rule(                 'recipe/([0-9]+)?$',                 'index.php?post_type=recipe&p=$matches[1]',                 'top' );         }      In the wordpress admin the correct url is displayed, but upon clicking the preview post button it returns a 404. I have tried flushing rewrite rules but to no avail. Any ideas?


Rewrite rules applied differently after upgrade

After WP upgrade from 3.2.1 to 3.4.1 I faced the problem that rules are not applied same way. I have the following rule:               (questions-answers)/([mind|nutrition|fitness|beauty]*)[/page/]*(\d*)$      In WP 3.2.1 URL `/questions-answers/mid/page/2` matches rule mentioned above, but in 3.4.1 this URL matches different rule: `(.?.+?)/page/?([0-9]{1,})/?$`. Any ideas what is wrong and how can I solve the problem?


Display list of uploaded images, filtered by user under a specific user group

I am planning to create a "Photography" page in my wordpress site. In that page, there will be a list of the photographers (maybe create a user group called 'photographers') and display the images they have uploaded, next or under their avatar. The list of the images uploaded has to be updated automatically when they upload a new one. Since i am new to wordpress, i am looking for any ideas that would point me to the right direction implementing the function described above. Thanks in advance.


Add a static page that links to homepage

My home page is a dynamic page and on my navbar I have different static pages I want to add one to link to the homepage as if I clicked the logo.


How do I remove link in posts titles

thank you for an amazing plugin! I´m having a problem that I hope you can help me with: I´m using List Category Posts on a private user-page with tabbed content. As I would like users to stay on their own page I was wondering if you could tell me how to remove the link from the posts title?


Encoding Issue while using French in WordPress

I just migrated some content from another CMS [SPIP] into WordPress and I am seeing weird characters like ' UnitÃ© dans la diversitÃ© ', this is supposed to come in french but its not . Please let me know what can be done to convert this content into Unicode. Praveen


Process bulk actions with POST method - WP_List_Table

I want to avoid to execute the bulk action again if someone reloads the page accidentally. If the bulk actions are processed with method POST a warning will be launched at least. Could be this possible?


Add custom taxonomies as class names to an archive page of custom post types

I thought this would be easy enough, although it's proving quite difficult. My end goal is to integrate jQuery isotope into my wordpress portfolio. I've gotten the isotope to work outside of wordpress, but I am having a very difficult time assigning my custom taxonomies as class names. So I don't need help with isotope, just assigning taxonomies as classes. I have a custom post type `portfolio`. The portfolio has 2 custom taxonomies that I want to use to filter my results on an archive page. One taxonomy is "media" the other is "campaigns" So if I assign a media taxonomy of "print" and a campaign taxonomy of "local" to a post from portfolio, I'd like the output on the archive page to be something like this:
...
      However I currently have this
...
      i followed instructions from the codex on get_the_terms. I added this code to my functions.php file:               <?php // get taxonomies terms links     function custom_taxonomies_terms_links() {         global $post, $post_id;         // get post by post id         $post = &get_post($post->ID);     // get post type by post         $post_type = $post->post_type;     // get post type taxonomies         $taxonomies = get_object_taxonomies($post_type);         foreach ($taxonomies as $taxonomy) {             // get the terms related to post             $terms = get_the_terms( $post->ID, $taxonomy );             if ( !empty( $terms ) ) {                 $out = array();                 foreach ( $terms as $term )                     $out[] = 'slug, $taxonomy) .'">'.$term->name.'';             $return = join( ', ', $out );         }     }     return $return;     } ?>      Then I dropped in the echo call into the class call in my loop on the archive- portfolio.php page like this:                   <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                  <div id="post-<?php the_ID(); ?>" class="<?php echo custom_taxonomies_terms_links(); ?>">      Any help would be greatly appreciated. This is driving me nuts that I can't figure this out.


Tag selection while adding new post

In Wordpress CMS, In the "add new post" page , I just wanna let users select suggesting tags in the "tag selection box" and cannot add new tags. How can I do that?


Implementing an "Email this" button?

We've inherited a customer with a good looking Wordpress site but the previous agency didn't fully implement the "Email This" feature. I mean, their theme has a link for "Email this" on every page but there's nothing underneath it. We've been instructed to make it work. So, the ideal would be for a solution which retains the existing button (which has been styled quite nicely), but just supplies the plumbing work underneath. AFter a quick search for a plug in which will implement this, I found:   * email2friend   * WP-Email But it's not clear whether these will add their "own" button to the article (which will presumably not look as nice as the existing themed button) Can we plumb it into our existing button? Also, in each case, can we tweak the mini form it throws up to make it match our theme? Finally, if there's a plug in that's better than either of these two, please advise. ## **Update** : Went with **WP-Email** in the end which was fully featured and easy to configure and as **mireille raad** said, it was easy enough to tweak the CSS and images to make the button fit our site 100%. The form that came with it immediately picked up the colour scheme and fonts used in our theme, without us having to do anything at all.


Show last time WordPress site was updated / modified

I am trying to display in the header of my WordPress site that last time the site was updated. The last time being defined as the last time either a post or a page was created / modified / deleted Anyone have any ideas? The only examples I can find are all related to a single page.


Filter custom posts with / without comments

I need to display (for pages that use a particular page template) a list of custom post type objects filtered into 2 sets - those with comments, and those without comments. Each of these sets should display the last 10 of its type (ie the latest 10 posts with comments, and the lastest 10 posts without comments) What's the best way of achieving this? So far, the easiest thing I've come up with is to just do a custom select with $wpdb. Hooking the query and adding a posts_join / posts_where filter doesn't seem like the best answer, as it's too global.


Subdomain redirect problem

Wordpress is installed my root directory(/root/). I have a subdomain(dammani.techbrij.com) and I want to access some files of main domain from sub domain. I have done following thing:               include_once('/root/wp-config.php');     include_once('/root/wp-load.php');     include_once('/root/wp-includes/wp-db.php');      Now, "http://techbrij.com/dammani" is working fine, but "http://dammani.techbrij.com" not working. It redirects to main domain. If i give any wrong path in include_once, I'm getting error without redirect. Let me know how to fix this issue. Edit: I'm using same database for my app. So i want to use same wpdb functionality for subdomain.


How to import data from Mingle Forum plugin to bbPress?

How to import data from Mingle Forum plugin (free) to bbPress? I wasn't able to find any custom importer, so I was thinking someone might have run into this issue before.


Facebook Share button wont recognize embedded video

I have a facebook share button on my website and it works great on everything else except for embedded videos from youtube. When I click on the share button it only loads the title and whatever the excerpt is with out the thumbnail of the video. Please can someone help on this problem? My entire site depends on it.


Display Post Author Link above the loop

I am trying to display current post author link above the loop (before loop starts) with this tag `the_author_posts_link()` but it's not displaying the author post link. Anyone please help me. Edited question: So I want author post links like this September 17th, 2008 by (here will be author name with post link) Like September 17th, 2008 by Jatin Soni This is the author meta I belive


Insert two row in wordpress database

Hello I am working on a template where I have to grab some value and insert them in my own created table in wordpress database. Now as I dont know how to insert record in wordpress database , so i am trying it on my local server for practice. my temlate file is:               <?php     /**        Template Name: Injection.      */     get_header();     ?>     <form method="post" action="">     Album: <input type="text" name="album" />     Artist: <input type="text" name="artist" />     <input type="submit" name="submit"/>     </form>     <?php     if(isset($_POST['submit']))     {     require_once('../../../wp-load.php');      global $wpdb           $album=$_POST['album'];      $artist=$_POST['artist'];           $wpdb->insert( 'music', array( 'album' => $album, 'artist' => $artist ), array( '%s', '%s' ) )     }     ?>      and here I have a strange problem If I dont use $wbdb class here then my temlate file data show on front end but when I used $wpdb for insertion then it show nothing on front end. So do you have any suggestion for what should I do for Insert data in mysql. Thanks


Change Taxonomy Permalinks

I have custom posts and I created one page that shows all my custom posts. Example: `www.example.com/archive-page` I wonder if I can change permalinks of categories and tags related to this custom post. Now i have:   * `www.example.com/my-custom-post-type-cats/my-category-1`   * `www.example.com/my-custom-post-type-tags/my-tag-1` And I want something like this:   * `www.example.com/archive-page?category=1`   * `www.example.com/archive-page?tag=1` If this is possible, can I get new URLs by `get_category_link()` for example? If not, can i just override default taxonomy URLs to point they to my **archive-page**?


Start image download by mouse click and insert counter

i use this code:               <a href="<?php if (has_post_thumbnail( $post->ID ) ): ?>     <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>     <?php echo $image[0]; ?>" target="_blank">Download Wallpaper     <?php endif; ?>      This code showing active direct link to wordpress featured image attached ( single posts), any user can left mouse click on the link for see the full image open in new blank page. My question is, how users by click on link, can start direct browser download of images? And any way for add a downloader counter?


Query pages based on tags

On a site that I'm working on I've added the ability to tag pages. These tags should then be used in a query to retrieve all associated pages of a tag. In my functions file -               // Add tag support to Pages     function tags_support_all() {         register_taxonomy_for_object_type('post_tag', 'page');     }     function tags_support_query($wp_query) {         if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');     }     add_action('init', 'tags_support_all');     add_action('pre_get_posts', 'tags_support_query');      Query -               $tag = get_query_var('tag');     $articles = new WP_Query( array(         'showposts' => -1,         'tag' => $tag,         'meta_key' => 'date',         'orderby' => 'meta_value_num',         'order' => 'DESC'         )     );      For some reason it doesn't match my pages agains the tags. I can see that the tags are being added under my tags collection in the admin panel, but supposedly there's a setting missing that makes WP only look for matching posts. To answer birgie's question, I get this result when using printf -               SELECT   wp_posts.* FROM wp_posts  INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1  AND ( wp_term_relationships.term_taxonomy_id IN (5) ) AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish') AND (wp_postmeta.meta_key = 'date' ) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 DESC


How to cancle update messages from a changed plugin

I did many changes on an plugin which was allowed to be manipulated. Now I want to be sure, that an update will not overwrite all my changes. What can I do to prohibit it from updating (or showing the update message, so that no other admin updates it unintended)? the rest of the system shell still be able to be updated


Achieving pagination with `query_posts`

I'm using `query_posts` to build a list of posts from a single category, and I'm trying to add pagination to this setup. Here's my code:

<?php the_title(); ?>
             <?php         $paged = get_query_var( 'paged' );         $args = array( 'posts_per_page' => 5, 'category' => 6, 'order' => 'DESC', 'paged' => 1 );         $myposts = query_posts( $args );         foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
                 <?php the_title(); ?>                 <?php the_content(); ?>
         <?php endforeach;          wp_reset_postdata();?>
     <?php echo next_posts_link()?>      `<?php echo next_posts_link()?>` generates a "Next Page >>" link, which links to the current URL with `&paged=2` appended, but does nothing when clicked (no page loads occur whatsoever). How can I get working pagination?


Install old version of plugin from admin panel?

Is there a way to install an old version of a plugin that is hosted on the WordPress.org plugin repository from the admin panel? I know that you can easily go to the WordPress.org plugin repository, grab any version of any plugin you want, FTP the files onto your website, and then activate from the Plugins admin page. However, I was wondering if there is a way to install a plugin using the Plugins -> Add New page and choose a version other than the latest. I am helping someone out with testing, and I have Administrator access to their admin panel, but not FTP access.


Some of my php is rendered only when logged as admin

I am using the al-in-one-calendar plugin, and have my own theme for the calendar which worked fine before updating the plugin. In the month view of the theme I am displaying the calendar view and above it the navigation links (The brown area with the white arrows). ![When logged as admin](http://i.stack.imgur.com/4Jnv4.png) **The way it should look (And indeed looks like when I am logged in as admin)** **NOW** The wired thing is that the navigation does load when I am connected as admin, but just disappear when disconnecting. (I have no condition that does that) ![When logged out](http://i.stack.imgur.com/hloHL.png) **The What I looks when I am logged out** it is looks like the php is not rendered at all, I can not see any trace of the code in the source. How could that be ? Thanks


Modify Gallery Output to render differently on a PAGE and a POST

I'm still learning Wordpress and slowly getting better, but my skill set is not up to par for the changes I am asking for. I need to customize the gallery output for two sections on my site: 1) Portfolio Pages and 2) Blog Posts On the PORTFOLIO PAGES, I want WP to render the gallery as images tags with attributes as shown below.                                    Here's the code I found online that I modified. I'm not fully comprehending the $output section and not confident in modifying some of it's code. I don't need the "class='gallery-item" code but not sure what else I "don't" need. Do I need the "itemtag", "icontag", "captiontag", etc? I'm not using them but not sure if I can just delete. If I do, will they default back to the core defaults?               // ----------------------------------------------------------------     // GALLERY OUTPUT FOR PORTFOLIO PAGES          add_shortcode( 'gallery', 'modified_gallery_shortcode' );     function modified_gallery_shortcode($attr) {          if(is_page_template('page-portfolio.php')){ // EDIT this slug         $attr['size']="full";         $attr['link']="none";         $attr['itemtag']="li";         $attr['icontag']="span";         $attr['captiontag']="p";              $output = gallery_shortcode($attr);              $output =strip_tags($output,'');         $output =str_replace(array(" class='gallery-item'"),array(""),$output);          }else{         $output = gallery_shortcode($attr);     }     return $output;      }          add_filter( 'use_default_gallery_style', '__return_false' );      On the BLOG POSTS, I want WP to render the gallery using an unordered list with the attributed as shown below.

      I tried modifying the "Gallery Output for Portfolio Pages to accommodate the formatting requirements for this post type, but not having any luck!               // ----------------------------------------------------------------     // GALLERY OUTPUT FOR BLOG POSTS          add_shortcode( 'gallery2', 'modified_gallery_shortcode2' );     function modified_gallery_shortcode2($attr) {          if(is_page_template('page-portfolio.php')){ // EDIT this slug         $attr['size']="full";         $attr['link']="file";         $attr['itemtag']="li";         $attr['icontag']="span";         $attr['captiontag']="p";              $output = gallery_shortcode($attr);              $output =strip_tags($output,'NOT SURE HOW TO FORMAT');         $output =str_replace(array(" class='gallery-item'"),array(""),$output);          }else{         $output = gallery_shortcode($attr);     }     return $output;      }          add_filter( 'use_default_gallery_style', '__return_false' );      ANY HELP IS VERY MUCH APPRECIATED! Thank you!


Issue on Checkbox with Custom Option Page

I am trying to use a checkbox on Custom Option page by using Setting API. Every thing works fine at back-end and I can update the checkbox states by registering the settings.But when I would like to see the result on the page I am getting same result **" The checkbox has not been checked."** even so the checkboxed has been checked and updated on the options.php and my custom option page! Here is what I have for updating and saving the checkbox state:               public  function contactprice_setting(){         $options = get_option('price_display_options');         $html = '<input type="checkbox" id="checkbox_contactprice" name="price_display_options[checkbox_contactprice]" value="1"' . checked( 1, $options['checkbox_contactprice'], false ) . '/>';           $html .= 'Uncheck The Text Box';         echo $html;         }      As I said this part works fine but when I try to output the result in index.php as:               <?php if( $input_examples['checkbox_contactprice'] == '1' ) { ?>
The checkbox checkbox has been checked.
       <?php } else { ?>
The checkbox has not been checked.
       <?php } // end if ?>      As I mentioned I am getting the **"The checkbox has not been checked."** in both checked or on checked situation. Can you please let me know why I am getting this?


How to set custom cookies before output

What's a surefire way to check/set cookies before the php headers are sent? Is there an action or filter that would be the best place to hook a `setcookie()` function?


Link the retrieved custom field values to its respective posts

Using the code below, I have been able to make a list of custom field values (on a seperate page template) from across all the posts for a specific custom meta key "realname". The code gives me a nice alphabetically ordered list of all the custom values.               <?php     function get_meta_values( $key = '', $type = 'post', $status = 'publish' ) {         global $wpdb;         if( empty( $key ) )             return;         $r = $wpdb->get_col( $wpdb->prepare( "             SELECT pm.meta_value FROM {$wpdb->postmeta} pm             LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id             WHERE pm.meta_key = '%s'              AND p.post_status = '%s'              AND p.post_type = '%s'             ORDER BY pm.meta_value ASC             ", $key, $status, $type ) );              return $r;     }     ?>     <?php $my_list_items = get_meta_values( 'realname' ); ?>
PEOPLE ALREADY REGISTERED - ALPHABETICAL ORDER :

     <?php foreach( $my_list_items as $my_list_item ) { ?>
<?php echo $my_list_item; ?>
     <?php } ?>
      Now, Please suggest me how I get the retrieved list items (custom values) to link to their respective posts. I am a noob, please pardon my ignorance. I tried the following but it doesnot work. `<li><a href="<?php the_permalink() ?>"><?php echo $my_list_item; ?></a></li>`


Running javascript in a child theme. Works in jsfiddle

Here is the JSFiddle http://jsfiddle.net/thornwalker/3LQjS/ I'm trying to get it to run on my wordpress blog and having no luck. My skill is novice at best, but up until now I've been able to muddle through. This is the code I have in my functions.php (in my main theme, if I copy the functions.php to my child theme it won't run.)               function videoswitch() {     wp_enqueue_script('videoswitch', get_template_directory_uri() . '/js/videoswitch.js',     array('jquery')     );     }     add_action('wp_enqueue_scripts', 'videoswitch');      Finally, here's the videoswitch.js               jQuery(document).ready(function($){          var directionsVar = '<video autoplay="" loop=""><source src="directionsVid.mp4" type="video/mp4"></video>';          var storyVar = '<video autoplay="" loop=""><source src="storyVid.mp4" type="video/mp4"></video>';          $("#directions").hover(function () {     $("#video-container").empty();     $("#video-container").append(directionsVar);     });          $("#story").click(function () {     $("#video-container").empty();     $("#video-container").append(storyVar);     });     });      Any help would be greatly appreciated.


htaccess rewrite ignored

I am having some mega frustrations with rewriting things on a local Wordpress install (installed via Bitnami). How does rewriting work in WP? It seems to have some PHP/database system plus a basic .htaccess file at the root of Wordpress? Anyway I had this problem running on a basic WampServer setup http://stackoverflow.com/questions/22362774/basic-htaccess-rewrite-rule-not- working/22363852#22363852, which was solved. But now when I try it on this WP server I just get a page that says > **Not Found** It looks like nothing was found at this location. Maybe try a > search?" It looks like something in Wordpress is preempting my rewrite rules, but I have no idea what. Where is this Not Found page coming from? With WampServer I get a plain page with a message that says something like "file could not be found at /path/it/attempted". I also tried a plugin simply called Rewrite, which didn't seem to do anything either.


Can I get parent taxonomy name from term in advanced search plugin?

I am currently trying to advance a plugin that basically creates a form where you add your own required types of data that you would want to be searched. In my form I have a taxonomy and I want to find a taxonomy term and if its a parent add class 'parent' to the terms input field. Currently the plugin resides here on gituhub: https://github.com/growthspark/wp-advanced-search I am asking on here because I think its a great plugin to use but I also think its worth a bit of time spent on trying to add a simple class name to an input for easier organisation of elements being outputted onto the page. Any help or guidance would be a bonus. Cheers


Pretty URLs for File Uploads?

Can files such as PDFs be uploaded to custom URLs? I would like to upload a PDF to `www.example.com/whitepapers/pdf.pdf` instead of `www.example.com/wp- uploads/...`. I found a plugin called WP Easy Uploader which seems OK, but I wanted to check if there are any other solutions. One solution I was contemplating is to have the PDF treated as a page so I can assign a parent page to the PDF. This will handle any redirects in case the URL of the parent page is changed. **UPDATE** - Not Considering WP Easy Uploader any more since I don't want to have any FTP access from within a Wordpress installation for security reasons.


List of files/folders writable by the web server?

New to WP. I soon realized there are some files that need to be writable by the web server, otherwise various operations fail. Moreover, the lists seem to be different for different tasks. Not sure I'm in love with the concept, but okay, I'll work with it. The trouble is, I can't figure out a simple way to determine which files / folders could be written to by the web server during the course of various actions. The documentation I've found seems either geared towards less technically-abled users ("just enable everything!") or focused on very narrow aspects. Does anybody have the minimal lists of writable files for various operations, such as: uploading content, installing a plugin or a theme, upgrading WP (this one is easy: everything needs to be writable), etc. Thanks!


Trying to create a custom post type, post type box doesn't show up?

I have a custom post type set up with the following in my functions.php. The problem is that the post thumbnail box doesn't show up in the dashboard in the "Talent" section even after I specified `'supports' => array('title','editor','thumbnail'),`. Is there something I'm missing? `add_theme_support( 'post-thumbnails', array( 'post' ) );`               // Register Talents     add_action('init', 'register_talents');          function register_talents() {              $labels = array(             'name' => _x('Talents', 'post type general name'),             'singular_name' => _x('Talent', 'post type singular name'),             'add_new' => _x('Add New', 'talent item'),             'add_new_item' => __('Add New Talent'),             'edit_item' => __('Edit Talent'),             'new_item' => __('New Talent'),             'view_item' => __('View Talent'),             'search_items' => __('Search Talents'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'menu_icon' => get_stylesheet_directory_uri() . '/images/menu-talents.png',             'supports' => array('title','editor','thumbnail'),             'has_archive' => true           );              register_post_type( 'talents' , $args );     }


Changing post status in one click

I want to add custom button "Send for correction" somewhere near the "Publish" button. This custom button must change a post status from "Pending" to my own created status named "On correction". For a now it is possible to change status with 5 clicks (Edit status -> Dropdown click -> Select On-correction -> Ok -> Save as on correction). **UPDATE:**               add_action('post_submitbox_misc_actions', 'send_for_correction_button');     function send_for_correction_button()     {         //global $post;         echo '<div id="send-for-correction" class="misc-pub-section"         style="border-top-style:solid; border-top-width:1px; border-top-color:#EEEEEE; border-bottom-width:0px;">         <input id="save-post2" class="button button-highlighted"         type="submit" value="Send for correction" name="save">             </div>';     }     add_action('save_post', 'save_status');     function save_status($post_id)     {         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return $post_id;              if ($_POST['save'] == 'Send for correction')         {             update_post_meta($post_id, "post_status", 'on-correction');         }     }


Custom Post Type fields not showing in dashboard

I have a custom post type for 'Teams' set up using the code below. However, the fields for 'Latest Discussion' and 'Next Fixture' isn't showing up in the dashboard. I went over the code numerous times and can't find anything wrong with it. I was hoping someone here could help me figure it out.               // Register Teams     add_action('init', 'register_teams');          function register_teams() {              $labels = array(             'name' => _x('Teams', 'post type general name'),             'singular_name' => _x('Team', 'post type singular name'),             'add_new' => _x('Add New', 'team item'),             'add_new_item' => __('Add New Team'),             'edit_item' => __('Edit Team'),             'new_item' => __('New Team'),             'view_item' => __('View Team'),             'search_items' => __('Search Teams'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'menu_icon' => get_stylesheet_directory_uri() . '/images/menu-teams.png',             'supports' => array( 'title', 'editor', 'thumbnail' ),             'has_archive' => true           );              register_post_type( 'teams' , $args );     }          // Add Fields     add_action("admin_init", "add_teams_fields");          function add_teams_fields(){         add_meta_box("latest_discussion", "Latest Discussion", "latest_discussion", "latest discussions", "side", "low");         add_meta_box("next_fixture", "Next Fixture", "next_fixture", "next fixture", "side", "low");     }          function latest_discussion(){         global $post;         $custom = get_post_custom($post->ID);         $latest_discussion = $custom["latest_discussion"][0];         ?>         Latest Discussion URL:

         <input size="40" name="latest_discussion" value="<?php echo $latest_discussion; ?>" />         <?php     }          function next_fixture(){         global $post;         $custom = get_post_custom($post->ID);         $next_fixture = $custom["next_fixture"][0];         ?>         Next Fixture:

         <input size="40" name="next_fixture" value="<?php echo $next_fixture; ?>" />         <?php     }          // Save Fields     add_action('save_post', 'save_teams_details');          function save_teams_details(){         global $post;         update_post_meta($post->ID, "latest_discussion", $_POST["latest_discussion"]);         update_post_meta($post->ID, "next_fixture", $_POST["next_fixture"]);     }