Wordpress Pagination is not shown

i am using onioneye, Ying yang theme and for pagination, i am using wordpress visual pagination plugin but where i am pasting the pagination code, it shows nothing :( template is:                   <?php         /*         Template Name: Home         */         ?>     <?php get_header(); ?>              <?php             //function wp_paginate($args = false) {         //global $wp_paginate;         //$wp_paginate->type = 'posts';         //return $wp_paginate->paginate($args);         //}             //echo "hello";             $count = 0;             $id_suffix = 1;             $items_per_row = 4;             $quality = 90;                                   $my_query = new WP_Query( array( 'posts_per_page' => '-1', 'post_type' => 'portfolio' ) );             $grid_class = 'grid_3';             $desired_width = 220;             $desired_height = 190;             $terms = get_terms( 'portfolio_categories' );              $count_terms = count( $terms );                           //echo "
";                     //print_r($my_query);                     //echo "
";         ?>

                                <div id="portfolio-header" class="grid_12 alpha omega group <?php if( ! $intro_text     ) echo 'no-intro'; ?>">
<?php _e( 'Portfolio', 'onioneye' ); ?>

                     <a href="#" class="all" title="<?php _e( 'View all items',  'onioneye' ); ?>">                              <?php _e( 'All', 'onioneye'  ); ?>                                                                                <?php echo wp_count_posts( 'portfolio' )->publish; ?>
                                       <?php if ( $count_terms > 0 ) { ?>                          <?php foreach ( $terms as $term ) { ?>
                             <a class="<?php echo $term->slug; ?>" href="#" title="<?php printf ( __( 'View all items filed under %s', 'onioneye' ), $term->name ); ?>">                                      <?php echo $term->name; ?>                                                                       <?php echo $term->count; ?>
                          <?php } ?>                      <?php } ?>

              <?php while ( $my_query -> have_posts()) : $my_query -> the_post(); //query the "portfolio" custom post type for portfolio items ?>                  <?php $preview_img_url = eq_get_the_preview_img_url(); ?>             <?php $count++; ?>                               <li data-id="id-<?php echo $id_suffix; ?>" <?php $terms = get_the_terms( $post -> ID, 'portfolio_categories' ); if ( !empty( $terms ) ) { echo 'data-group="'; foreach( $terms as $term ) { echo $term -> slug . ' '; } echo '"'; } ?> class="portfolio-item <?php echo $grid_class; ?> <?php if( $count === 1 ) { echo 'alpha'; } elseif( $count === $items_per_row ) { echo 'omega'; } ?>">
                             <?php echo $nonce = wp_create_nonce("portfolio_item_nonce"); ?>                                               <a class="project-link" href="<?php the_permalink(); ?>" data-post_id="<?php echo $post->ID; ?>" data-nonce="<?php echo $nonce; ?>">                              <?php if ( $preview_img_url ) { ?>                              <?php                             $image_details = wp_get_attachment_image_src( eq_get_attachment_id_from_src( $preview_img_url ), 'full');                             $image_full_width = $image_details[1];                             $image_full_height = $image_details[2];                                  // If the original width of the thumbnail doesn't match the width of the slider, resize it; otherwise, display it in original size                             if( $image_full_width > $desired_width || $image_full_height > $desired_height ) {                          ?>                                 <img width="<?php echo $desired_width; ?>" height="<?php echo $desired_height; ?>" src="<?php echo get_template_directory_uri() . '/timthumb.php?src=' . $image_details[0]; ?>&h=<?php echo $desired_height; ?>&w=<?php echo $desired_width; ?>&q=<?php echo $quality; ?>" alt="<?php the_title(); ?>" />                              <?php                              } else {                          ?>                                                           <img width="<?php echo $desired_width; ?>" height="<?php echo $desired_height; ?>" src="<?php echo $preview_img_url; ?>" alt="<?php the_title(); ?>" />                                                        <?php                              }                          ?>                                  View Details

<?php the_title(); ?>
                                  <img class="view-button" src="<?php echo get_template_directory_uri(); ?>/images/layout/view-details.png" />

                                           <?php } ?>
                                 <?php if( $count === $items_per_row ) { // if the current row is filled out with columns, reset the count variable ?>                      <?php  $count = 0; ?>                   <?php } ?>             <?php  $id_suffix++; ?>              <?php endwhile;                  ?>
             <?php  $id_suffix;                wp_paginate();                  ?>                       <?php if( of_get_option( 'client_logos' ) ) { // display the client logos if defined in the theme options panel ?>

<?php _e( 'Clients', 'onioneye' ); ?>
                      <img class="client-logos" src="<?php echo of_get_option( 'client_logos' ); ?>" alt="client logos" />
                <?php } ?>          <?php get_footer(); ?>      and my function is included here                   <?php         /*          Plugin Name: WP-Paginate                   Plugin URI: http://www.ericmmartin.com/projects/wp-paginate/         Description: A simple and flexible pagination plugin for WordPress posts and comments.         Author: Eric Martin         Version: 1.2.4         Author URI: http://www.ericmmartin.com         Revision: $Id: wp-paginate.php 467949 2011-11-26 20:03:29Z emartin24 $         */              /*  Copyright 2011 Eric Martin (eric@ericmmartin.com)              This program is free software; you can redistribute it and/or modify         it under the terms of the GNU General Public License as published by         the Free Software Foundation; either version 2 of the License, or         (at your option) any later version.              This program is distributed in the hope that it will be useful,         but WITHOUT ANY WARRANTY; without even the implied warranty of         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the         GNU General Public License for more details.              You should have received a copy of the GNU General Public License         along with this program; if not, write to the Free Software         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA              */              /**          * Set the wp-content and plugin urls/paths          */         if (!defined('WP_CONTENT_URL'))             define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');         if (!defined('WP_CONTENT_DIR'))             define('WP_CONTENT_DIR', ABSPATH . 'wp-content');         if (!defined('WP_PLUGIN_URL') )             define('WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins');         if (!defined('WP_PLUGIN_DIR') )             define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');              if (!class_exists('WPPaginate')) {              class WPPaginate {             /**              * @var string The plugin version              */             var $version = '1.2.4';                  /**              * @var string The options string name for this plugin              */             var $optionsName = 'wp_paginate_options';                  /**              * @var string $localizationDomain Domain used for localization              */             var $localizationDomain = 'wp-paginate';                  /**              * @var string $pluginurl The url to this plugin              */             var $pluginurl = '';             /**              * @var string $pluginpath The path to this plugin              */             var $pluginpath = '';                  /**              * @var array $options Stores the options for this plugin              */             var $options = array();                  var $type = 'posts';                  /**              * PHP 4 Compatible Constructor              */             function WPPaginate() {$this->__construct();}                  /**              * PHP 5 Constructor              */             function __construct() {                 $name = dirname(plugin_basename(__FILE__));                      //Language Setup                 load_plugin_textdomain($this->localizationDomain, false, "$name/I18n/");                      //"Constants" setup                 $this->pluginurl = plugins_url($name) . "/";                 $this->pluginpath = WP_PLUGIN_DIR . "/$name/";                      //Initialize the options                 $this->get_options();                      //Actions                 add_action('admin_menu', array(&$this, 'admin_menu_link'));                      if ($this->options['css'])                     add_action('wp_print_styles', array(&$this, 'wp_paginate_css'));             }                  /**              * Pagination based on options/args              */             function paginate($args = false) {                      if ($this->type === 'comments' && !get_option('page_comments'))                     return;                      $r = wp_parse_args($args, $this->options);                 extract($r, EXTR_SKIP);                      if (!isset($page) && !isset($pages)) {                     global $wp_query;                                     $paged = get_query_var('paged') ? get_query_var('paged') : 1;                                          //$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             //                        $wp_query = new WP_Query();                                          //$wp_query = new WP_Query( 'post_type=portfolio&showposts=12' );                                     $wp_query->query('post_type=portfolio&posts_per_page=16&paged=' . $paged);                                     //echo "
";                                     //print_r($wp_query);                                     //echo "
";                                     echo $wp_query->found_posts."
";                     if ($this->type === 'posts') {                         $page = get_query_var('paged');                         echo $posts_per_page =    intval(get_query_var('posts_per_page'))."
";                         echo $pages = intval(ceil($wp_query->found_posts / $posts_per_page))."
";                     }                     else {                         $page = get_query_var('cpage');                         $comments_per_page = get_option('comments_per_page');                         $pages = get_comment_pages_count();                     }                      $page = !empty($page) ? intval($page) : 1;                 }                       $prevlink = ($this->type === 'posts')                     ? esc_url(get_pagenum_link($page - 1))                     : get_comments_pagenum_link($page - 1);                 $nextlink = ($this->type === 'posts')                     ? esc_url(get_pagenum_link($page + 1))                     : get_comments_pagenum_link($page + 1);                      $output = stripslashes($before);                 if ($pages > 1) {                                 echo "hello
";                                 echo wp-paginate-comments;                     $output .= sprintf('
', ($this->type === 'posts') ? '' : ' wp-paginate-comments');                     $output .= sprintf('
%s
', stripslashes($title));                     $ellipsis = "
...
";                          if ($page > 1 && !empty($previouspage)) {                                         echo "lpc";                         $output .= sprintf('
%s
', $prevlink, stripslashes($previouspage));                     }                          $min_links = $range * 2 + 1;                     $block_min = min($page - $range, $pages - $min_links);                     $block_high = max($page + $range, $min_links);                     $left_gap = (($block_min - $anchor - $gap) > 0) ? true : false;                     $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;                          if ($left_gap && !$right_gap) {                         $output .= sprintf('%s%s%s',                             $this->paginate_loop(1, $anchor),                             $ellipsis,                             $this->paginate_loop($block_min, $pages, $page)                         );                     }                     else if ($left_gap && $right_gap) {                         $output .= sprintf('%s%s%s%s%s',                             $this->paginate_loop(1, $anchor),                             $ellipsis,                             $this->paginate_loop($block_min, $block_high, $page),                             $ellipsis,                             $this->paginate_loop(($pages - $anchor + 1), $pages)                         );                     }                     else if ($right_gap && !$left_gap) {                         $output .= sprintf('%s%s%s',                             $this->paginate_loop(1, $block_high, $page),                             $ellipsis,                             $this->paginate_loop(($pages - $anchor + 1), $pages)                         );                     }                     else {                         $output .= $this->paginate_loop(1, $pages, $page);                     }                          if ($page < $pages && !empty($nextpage)) {                         $output .= sprintf('
%s
', $nextlink, stripslashes($nextpage));                     }                     $output .= "
";                 }                 $output .= stripslashes($after);                      if ($pages > 1 || $empty) {                     echo $output;                 }                  }                  /**              * Helper function for pagination which builds the page links.              */             function paginate_loop($start, $max, $page = 0) {                 $output = "";                 for ($i = $start; $i <= $max; $i++) {                     $p = ($this->type === 'posts') ? esc_url(get_pagenum_link($i)) : get_comments_pagenum_link($i);                     $output .= ($page == intval($i))                         ? "
$i
"                         : "
$i
";                 }                 return $output;             }                  function wp_paginate_css() {                 $name = "wp-paginate.css";                 if (false !== @file_exists(TEMPLATEPATH . "/$name")) {                     $css = get_template_directory_uri() . "/$name";                 }                 else {                     $css = $this->pluginurl . $name;                 }                 wp_enqueue_style('wp-paginate', $css, false, $this->version, 'screen');                      if (function_exists('is_rtl') && is_rtl()) {                     $name = "wp-paginate-rtl.css";                     if (false !== @file_exists(TEMPLATEPATH . "/$name")) {                         $css = get_template_directory_uri() . "/$name";                     }                     else {                         $css = $this->pluginurl . $name;                     }                     wp_enqueue_style('wp-paginate-rtl', $css, false, $this->version, 'screen');                 }             }                  /**              * Retrieves the plugin options from the database.              * @return array              */             function get_options() {                 if (!$options = get_option($this->optionsName)) {                     $options = array(                         'title' => 'Pages:',                         'nextpage' => '»',                         'previouspage' => '«',                         'css' => true,                         'before' => '
',                         'after' => '
',                         'empty' => true,                         'range' => 3,                         'anchor' => 1,                         'gap' => 3                     );                     update_option($this->optionsName, $options);                 }                 $this->options = $options;             }             /**              * Saves the admin options to the database.              */             function save_admin_options(){                 return update_option($this->optionsName, $this->options);             }                  /**              * @desc Adds the options subpanel              */             function admin_menu_link() {                 add_options_page('WP-Paginate', 'WP-Paginate', 'manage_options', basename(__FILE__), array(&$this, 'admin_options_page'));                 add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'filter_plugin_actions'), 10, 2 );             }                  /**              * @desc Adds the Settings link to the plugin activate/deactivate page              */             function filter_plugin_actions($links, $file) {                 $settings_link = '' . __('Settings', $this->localizationDomain) . '';                 array_unshift($links, $settings_link); // before other links                      return $links;             }                  /**              * Adds settings/options page              */             function admin_options_page() {                 if (isset($_POST['wp_paginate_save'])) {                     if (wp_verify_nonce($_POST['_wpnonce'], 'wp-paginate-update-options')) {                         $this->options['title'] = $_POST['title'];                         $this->options['previouspage'] = $_POST['previouspage'];                         $this->options['nextpage'] = $_POST['nextpage'];                         $this->options['before'] = $_POST['before'];                         $this->options['after'] = $_POST['after'];                         $this->options['empty'] = (isset($_POST['empty']) && $_POST['empty'] === 'on') ? true : false;                         $this->options['css'] = (isset($_POST['css']) && $_POST['css'] === 'on') ? true : false;                         $this->options['range'] = intval($_POST['range']);                         $this->options['anchor'] = intval($_POST['anchor']);                         $this->options['gap'] = intval($_POST['gap']);                              $this->save_admin_options();                              echo '

' . __('Success! Your changes were successfully saved!', $this->localizationDomain) . '

';                     }                     else {                         echo '

' . __('Whoops! There was a problem with the data you posted. Please try again.', $this->localizationDomain) . '

';                     }                 }     ?>

WP-Paginate
     <form method="post" id="wp_paginate_options">     <?php wp_nonce_field('wp-paginate-update-options'); ?>

                 <?php _e('Pagination Label:', $this->localizationDomain); ?>	                 <input name="title" type="text" id="title" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['title'])); ?>"/>                 <?php _e('The text/HTML to display before the list of pages.', $this->localizationDomain); ?>

                 <?php _e('Previous Page:', $this->localizationDomain); ?>	                 <input name="previouspage" type="text" id="previouspage" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['previouspage'])); ?>"/>                 <?php _e('The text/HTML to display for the previous page link.', $this->localizationDomain); ?>

                 <?php _e('Next Page:', $this->localizationDomain); ?>	                 <input name="nextpage" type="text" id="nextpage" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['nextpage'])); ?>"/>                 <?php _e('The text/HTML to display for the next page link.', $this->localizationDomain); ?>

<?php _e('Advanced Settings', $this->localizationDomain); ?>

                 <?php _e('Before Markup:', $this->localizationDomain); ?>	                 <input name="before" type="text" id="before" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['before'])); ?>"/>                 <?php _e('The HTML markup to display before the pagination code.', $this->localizationDomain); ?>

                 <?php _e('After Markup:', $this->localizationDomain); ?>	                 <input name="after" type="text" id="after" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['after'])); ?>"/>                 <?php _e('The HTML markup to display after the pagination code.', $this->localizationDomain); ?>

                 <?php _e('Markup Display:', $this->localizationDomain); ?>	                                      <input type="checkbox" id="empty" name="empty" <?php echo ($this->options['empty'] === true) ? "checked='checked'" : ""; ?>/> <?php _e('Show Before Markup and After Markup, even if the page list is empty?', $this->localizationDomain); ?>

                 <?php _e('WP-Paginate CSS File:', $this->localizationDomain); ?>	                                      <input type="checkbox" id="css" name="css" <?php echo ($this->options['css'] === true) ? "checked='checked'" : ""; ?>/> <?php printf(__('Include the default stylesheet wp-paginate.css? WP-Paginate will first look for wp-paginate.css in your theme directory (themes/%s).', $this->localizationDomain), get_template()); ?>

                 <?php _e('Page Range:', $this->localizationDomain); ?>	                                      <select name="range" id="range">                     <?php for ($i=1; $i<=10; $i++) : ?>                         <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['range']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>                     <?php endfor; ?>                     </select>                     <?php _e('The number of page links to show before and after the current page. Recommended value: 3', $this->localizationDomain); ?>

                 <?php _e('Page Anchors:', $this->localizationDomain); ?>	                                      <select name="anchor" id="anchor">                     <?php for ($i=0; $i<=10; $i++) : ?>                         <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['anchor']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>                     <?php endfor; ?>                     </select>                     <?php _e('The number of links to always show at beginning and end of pagination. Recommended value: 1', $this->localizationDomain); ?>

                 <?php _e('Page Gap:', $this->localizationDomain); ?>	                                      <select name="gap" id="gap">                     <?php for ($i=1; $i<=10; $i++) : ?>                         <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['gap']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>                     <?php endfor; ?>                     </select>                     <?php _e('The minimum number of pages in a gap before an ellipsis (...) is added. Recommended value: 3', $this->localizationDomain); ?>

             <input type="submit" value="Save Changes" name="wp_paginate_save" class="button-primary" />
     </form>
<?php _e('Need Support?', $this->localizationDomain); ?>

<?php printf(__('For questions, issues or feature requests, please post them in the %s and make sure to tag the post with wp-paginate.', $this->localizationDomain), 'WordPress Forum'); ?>

<?php _e('Like To Contribute?', $this->localizationDomain); ?>

<?php _e('If you would like to contribute, the following is a list of ways you can help:', $this->localizationDomain); ?>

» <?php _e('Translate WP-Paginate into your language', $this->localizationDomain); ?>

» <?php _e('Blog about or link to WP-Paginate so others can find out about it', $this->localizationDomain); ?>

» <?php _e('Report issues, provide feedback, request features, etc.', $this->localizationDomain); ?>

» <?php _e('Rate WP-Paginate on the WordPress Plugins Page', $this->localizationDomain); ?>

» <?php _e('Make a donation', $this->localizationDomain); ?>

<?php _e('Other Links', $this->localizationDomain); ?>

» @ericmmartin on Twitter

» EricMMartin.com

» SimpleModal Contact Form (SMCF) - WordPress Plugin

» SimpleModal Login - WordPress Plugin

          <?php             }         }     }          //instantiate the class     if (class_exists('WPPaginate')) {         $wp_paginate = new WPPaginate();     }          /**      * Pagination function to use for posts      */     function wp_paginate($args = false) {         //echo "hello";         global $wp_paginate;         $wp_paginate->type = 'posts';         return $wp_paginate->paginate($args);     }          /**      * Pagination function to use for post comments      */     function wp_paginate_comments($args = false) {         global $wp_paginate;         $wp_paginate->type = 'comments';         return $wp_paginate->paginate($args);     }          /*      * The format of this plugin is based on the following plugin template:      * http://pressography.com/plugins/wordpress-plugin-template/      */     ?>


Valid Connection Information is Getting Denied

I'm getting prompted to enter my FTP information (in this case, SFTP) for installing plugins/themes in Wordpress. Problem is, I keep getting denied with valid SFTP credentials. I have root access to my server as well. RedHat 6.3, MySQL 5.1, PHP 5.3.3 For troubleshooting sake, all of Wordpress's directories are currently `chmod 777` Every time I enter the login credentials that I'm SFTP'ing into the server with, I'm met with the error -               ERROR: There was an error connecting to the server, Please verify the settings are correct.      I've tried regular FTP, SFTP, creating new FTP users, using localhost, using the static address, about everything I could think of. I've even gone as far as editing `wp-config.php` to include FTP info like so               /** FTP SETTINGS FOR AUTO-UPDATE */     define('FTP_HOST', 'Tried both static IP and localhost');     define('FTP_USER', 'user');     define('FTP_PASS', 'pass');      I can upload plugins and files manually through Filezilla or another client (using the SFTP credentials it is currently denying), but I'd like the ability to do one-click upgrades and installs. I wouldn't think there is a firewall issue because Wordpress is installed on a localhost MySQL. Pretty sure I didn't say that right.... but you get the idea. I'm not leaving the box I'm on.


Hook for fail and successful login actions

I need to log **fail** and **successful login** actions. What hook is better to use for this?


Custom post types not using archive structure

I've been banging my head against my iMac trying to figure out what's wrong. I've also trolled these archives and have tried the following things to fix:   * flush permalinks   * remove possibly conflicting categories/slugs   * `flush_rewrite_rules( false );`   * `'has_archive' => true`, `'has_archive' => false` (as well as many similar `$args` variations   * `archive-{CPT}.php`, `archive-{CPTSlug}.php`   * `category-{CPT}.php`, `category-{CPTSlug}.php`   * `content-{CPT}.php`, `content-{CPTSlug}.php`   * `{CPT}-archive.php`, `{CPTSlug}-archive.php`   * change the slugs of the CPT and taxonomies and flushed permalinks ALL attempts return a 404 page when visiting `www.site.com/CPTSlug` or `www.site.com/CPT`. The individual posts of the CPT however, display correctly at the URL `www.site.com/CPTSlug/post_title`. When I had these set as categories instead of custom post types it worked perfectly. If anyone out there can spot the problem I would be most grateful.               function register_artists_post_type() {         register_post_type('artists',array(             'labels' => array(                     'name' => __( 'Artists' ),                     'singular_name' => __( 'Artist' ),                     'add_new' => __( 'Add Artist','Artist' ),                     'add_new_item' => __( 'Add New Artist' ),                     'edit_item' => __( 'Edit Artist' ),                     'new_item' => __( 'New Artist' ),                     'view_item' => __( 'View Artist' ),                     'search_items' => __( 'Search Artists' ),                     'not_found' => __( 'No Artists Found' ),                     'not_found_in_trash' => __( 'No Artists In Trash' ),                     'parent_item_colon' => ''                 ),             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'has_archive' => true,             'supports' => array( 'title','editor','excerpt','custom-fields','thumbnail' ),             'rewrite' => array('slug' => 'artists'),             'taxonomies' => array('large_feature','small_feature'),             'capability_type' => 'post',             'hierarchical' => false,         ));     }     add_action('init','register_artists_post_type');      There were previously categories called "Artists" (slug = `artists`) as well as child categories with slugs of `large_feature` and `small_feature`. Those have all been deleted from the database and have been replaced with the custom post type below and the slugs you see in the registration. The theme files are as follows (though I don't think this is the problem since it's a 404 page displayed, but in the interest of giving as much relevant information as possible...) `archive.php` `archive_{cpt}.php` `category.php` `single.php` `single_{cpt}.php` The single posts are correctly posting using `single_{cpt}.php`. Archives however, are not.


Permalinks Won't Work

Permanents won't work for some reason. I click on the radio button for option 3, and click save, but it reverts back to option 1. What's going on? (It shouldn't be a FTP problem - it has localhost access to the database, and I can download plugins within Wordpress fine.)


Export a wordpress blog to a wiki

I have a wordpress blog and the posts would better suit a wiki format becuase I want to make them open to editing. Is there a way to conveniently export my posts so they can be imported by MediaWiki or another common Wiki application?


How to display different widgets on specific pages, hide from other pages

I want to display a dynamic sidebar on all pages, and a different sidebar on the homepage. There are also particular pages where I don't want to display either of them. This code is not hiding the unwanted sidebar off of the Homepage; both sidebars show. How can I hide 'multipackage' from the homepage and only display 'singlepackage'? (I guess I thought that the elseif would take care of that. I have also tried just 'else' but I get a syntax error).               <?php         if(!function_exists('dynamic_sidebar')              || !dynamic_sidebar('multipackage'));              elseif (is_page_template('page-homepage.php')) {             dynamic_sidebar('singlepackage');                  // also need to hide both sidebars from Page IDs 4 and 5                  }              ?>      FWIW I have read up on the codex http://codex.wordpress.org/Function_Reference/dynamic_sidebar , this site, and other resources such as http://dreamwhisperdesigns.com/genesis-tutorials/load- sidebar-specific-pages/ (I am not an experienced php developer and syntax is where I often fail, if that's not already obvious!) I would really like to avoid using a plugin for this. Thanks everyone in advance.


Word Count Function Preventing Permalink Editing

This code counts the number of words in an excerpt and adds it to the excerpt meta box in the post edit screen: http://snippi.com/s/sn3hk5p However, something about this code is preventing the editing of permalinks in the post edit screen and I am unable to identify the problem. Any ideas?


Attach images to posts using custom fields (just paths to images already upld)

I'm setting up a real estate website, which i make listings using a custom post type 'listings' in which I have multiples metaboxes for beds, baths, and all other informations. I use a plugin to import these posts because listings are generated from a 3d party software, (XML file with Xpaths), as far everything when ok importing listings. The BUT is that the theme inserts images 'attached to the post' '_wp_attach_file ... file'. The XML makes easy to get the paths to images, but I can't figured out how to make them 'be attached' to the post to load up. Is it possible to attach them using custom fields? (i need to do this for almost 500 posts through WP ALL IMPORT - XML XPath importer plugin - which i can insert custom_fields and metaboxes lines) If someone knows how to do the trick, please share your secret Many thanks


How Can the Users Make a "Playlist" of Posts?

I have an audio website and I want to allow users to make custom playlists from posts. I am using posts as Albums which contains the Tracks. I thought of creating a custom post type and using it to hold a user select playlist based on the default posts. Is this a good idea or is there a better way to allow users to create custom playlist. Notes:   * I had a look at this tutorial. It is what I'm looking for but for individual tracks in the post.   * The audio is stored in arrays in custom fields, i.e `custom_audio{ audio=>"name", url=>"www.text.com"}`


Make WordPress site secure through HTTPS and SSL

I want to make my worpress site secure through HTTPS. In fact I did install the SSL certificate, but my site is still not secured (it doesn't show the green button, but a yellow one. Problem at the moment seems to be 1 HTTP link in the header of the pages (besides the statcounter plugin, which I will deactivate once all the other problems are solved to make my site secure. This problem is the second line in the source code in the header;               <html xmlns="https://www.w3.org/1999/xhtml" lang="en-US" prefix="og: http://ogp.me/ns#">      Does anybody know how I can edit this line, and change the HTTP link into a HTTPS, or delete the line?


How to create wordpress page that shows posts with specific tags?

Like the title says, what code would I use on a wordpress page so that it will only show posts that have a specific tag?


Exclude all sticky posts front page twenty twelve

I am attempting to exclude all sticky posts from my front page in twenty twelve theme. I have attempted the following. I am making all changes to the child theme.   1. To remove the following code from content.php              <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>     <div class="featured-post">         <?php _e( 'Featured post', 'twentytwelve' ); ?>     </div>     <?php endif; ?>        2. Add following code to index.php before the loop(this removed sticky posts but broke pagination)              <?php query_posts( array( 'post__not_in' => get_option( 'sticky_posts' ) ) ); ?>      This is the loop in index.php (pretty much standard index.php for twenty twelve.                       <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', get_post_format() ); ?>                            <?php endwhile; ?>                       <?php twentytwelve_content_nav( 'nav-below' ); ?>      Could someone please advise me on what I should exactly put into this loop to not show any sticky posts on index.php? Thank you for your time.


Two "the_excerpt" questions

In case there's more than one function the exact one is: php the_excerpt(); I want to decrease the character length to X amount and I want to remove the [...] and replace it with an image that users can click to take them to the article. How do I accomplish this (preferably without plugins)?


favicon and multi site

what about if you are on a multi site install, where would you put the favicon to have it automaticallly recognized by the browser (and no blot the code with link tag)cause there is no real root per se? Thank you in advance for your help on this


Use a different domain for SSL

long time lurker - first time poster. A client of mine has a website developed in CakePHP, and a wordpress blog installed in the /blog/ directory. Let's say the url of the main domain is `http://www.realdomain.com`, with the blog being `http://www.realdomain.com/blog/`. They don't have their own SSL certificate so they use my companies. Let's say the secure URL is `https://realdomain.maindomain.net/blog/` I have the following code in my wp-config.php file:               define('WP_SITEURL', 'https://realdomain.maindomain.net/blog');     define('WP_CONTENT_URL', 'http://www.realdomain.com/blog/wp-content');     define('FORCE_SSL_LOGIN', true);     define('FORCE_SSL_ADMIN', true);      When I go to the /wp-login.php, it redirects me to the secure URL which is perfect. However, when I log in to the secure site, WordPress tries to loads JavaScripts and styles from               `http**s**://realdomain.com`      Which causes problems because the main site doesn't have a SSL certificate and as a result doesn't load anything from `https://realdomain.com` Is there anything else I'm missing? Is the solution a .htaccess rule? A rule which routed all "`https://realdomain.com`" to `"https://realdomain.maindomain.com`"? I'll pay anyone $20 who can help me fix it. I've Google'd until my hearts content and I don't know what else I can do. Thanks so much!


Plugin for an author bio popup box?

Looking at the below article, I took a liking to the way the author included his bio (as a clickable little bio box that pops up). http://saveyourself.ca/articles/why-does-pain-hurt-so-much.php Does anybody know where I could find a plugin to do such a thing? All the plugins I've found are for sticking bios at the end of posts, in widgets, hovering over the name, etc...


How to prevent custom walker from creating sub navigation for pages that are not relatives of the current page?

I have a custom walker that extends the Walker class. My code uses the Walker_Page class as it's base as it does pretty much everything else I want but I need to modify it a bit so that it behaves a little differently. Essentially, I want to prevent the walker from creating new levels of navigation for menu items that are not related to the current page -- that is I only want it to walk deeper levels when the current page is either the current page, or an ancestor of it. The key to this seems to be the `$current_page` (current_object_id) argument that is passed to the `start_el` method. If this were also passed to the `start_lvl` method, I think this would be easy to code, but `start_el` seems to be the only method that gets it. Any help/direction would be much appreciated. I would paste my code here, but it's basically the same as Walker_Page


Show terms in archive page

I am trying to show terms of specific post type on archive page. I don't understand how to "echo" term name. Here is my code:               <?php $terms = get_terms("event_cat"); ?>     <?php while (have_posts()) : the_post(); ?>           print term->name here     <?php endwhile; ?>


Rand post related question

I've used that code in my function file to randomise posts in a category and keep the order in the pagination...               session_start();          add_filter('posts_orderby', 'edit_posts_orderby');          function edit_posts_orderby($orderby_statement) {              $seed = $_SESSION['seed'];         if (empty($seed)) {           $seed = rand();           $_SESSION['seed'] = $seed;         }              $orderby_statement = 'RAND('.$seed.')';         return $orderby_statement;     }      The problem is that every time the user comes back to the website, he sees the same order. Is there a way to add a time component to the session? like 30 mins or so to reset itself?


How do I create a meta box for dates?

I am creating a custom events page and I want to know how to create a custom meta box to save event dates. I don't want it to be a regular meta box because I will be using this to make a custom search bar so I am guessing I have to save it to MySQL no? I am lost, as to how I have to go about this. Any ideas? Thanks in advance.


404 for index.php

I've recently switched from linux to windows hosting on IIS7. I have permalinks working fine, but for some reason when I try to view the site index (index.php) I get an internal wordpress 404. I can only assume this has something to do with the migration but am baffled as to the cause. My web.config contains this:               <?xml version="1.0" encoding="UTF-8"?>     <configuration>         <system.webServer>             <httpErrors errorMode="Detailed" />             <rewrite>                 <rules>                     <rule name="Main Rule" stopProcessing="true">                         <match url=".*" />                         <conditions logicalGrouping="MatchAll">                             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />                             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />                         </conditions>                         <action type="Rewrite" url="index.php" />                     </rule>                 </rules>             </rewrite>         </system.webServer>     </configuration>      The site in question is http://www.lime49.com/ . Is there something in Wordpress which could cause this?


On IIS 8.0 wp-admin returns 404, wordpress/wp-admin does not

**Settings:**   we have a WordPress website running on IIS 8.0 in a shared hosting environment. Permalinks are set on `Post name`. `Web.config` has been edited on purpose (please find that below). Site root contains `wp-config.php`, `index.php`, `Web.config` files, the rest has been moved in `wordpress` subdirectory. **Problem:**   We just found out recently that `www.domain.com/wp-admin` does not work. It redirects to `www.domain.com/wp-admin/` and returns a 404.0 IIS error page.   1. Public site pages are all accessible.   2. `www.domain.com/wordpress/wp-admin` redirects to `www.domain.com/wordpress/wp-admin/` and shows login page fine   3. `www.domain.com/login` redirects to `www.domain.com/wordpress/wp-login.php` and shows login page fine   4. This hosted environment is for staging. On our development machine site runs on Apache and all is fine, also `localhost/siteroot/wp-admin`. So we guess it should be a matter of `Web.config` Here is current `Web.config` for completeness. We got it from some source on the web, don't remember where. We tried both with and without `defaultDocument` node, with no effect. We also search here on StackExchange for similar issue, with no luck.               <?xml version="1.0" encoding="UTF-8"?>     <configuration>         <system.webServer>             <!--             <defaultDocument>                 <files>                     <remove value="index.php" />                     <add value="index.php" />                 </files>             </defaultDocument>             -->             <rewrite>                 <rules>                     <rule name="WordPress Rule 1" stopProcessing="true">                         <match url="^index\.php$" ignoreCase="false" />                         <action type="None" />                     </rule>                     <rule name="WordPress Rule 2" stopProcessing="true">                         <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />                         <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />                     </rule>                     <rule name="WordPress Rule 3" stopProcessing="true">                         <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />                         <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />                     </rule>                     <rule name="WordPress Rule 4" stopProcessing="true">                         <match url="^" ignoreCase="false" />                         <conditions logicalGrouping="MatchAny">                             <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />                             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />                         </conditions>                         <action type="None" />                     </rule>                     <rule name="WordPress Rule 5" stopProcessing="true">                         <match url="(^[_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />                         <action type="Rewrite" url="{R:2}" />                     </rule>                     <rule name="WordPress Rule 6" stopProcessing="true">                         <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />                         <action type="Rewrite" url="{R:2}" />                     </rule>                     <rule name="WordPress Rule 7" stopProcessing="true">                         <match url="." ignoreCase="false" />                         <action type="Rewrite" url="index.php" />                     </rule>                 </rules>             </rewrite>         </system.webServer>     </configuration>


Have multiple local wordpress installs share a wp-content folder and database

On my local machine, I have multiple wordpress versions installed so I can test the themes and plugins I develop. I was wondering if I could somehow create a central wp-content folder and database, which are linked to each version of wordpress, so I don't have to continually copy my projects between the them? Thank you!


Best way to specify "article type" in URL

I'm helping a small blog out that posts a few different "types" of articles. These article types are shared across categories. We want to put the article type in the URL. So the structure would look like this: www.example.com/category/sub-category/article-type/article-name I'm unsure of the best way to attribute these article types. Should they be sub-categories (so each category would have a subcategory of "how-to", "interview", "News", etc... Should I use tags? Can I specify a specific tag to be in a URL (rather than all tags?) Should I use a custom attribute? Any guidance is good guidance, i'm at starting point zero...


custom permalink's rewrite rule for page id

I am using WP 3.2.1. I try to do permalink like: /en/1/some-string. Structure is: %lang%/%pageID%/%some random string% So I add a rewrite rule:               function  nw_lang_addRewrite($aRules) {         $_aRules["(en|lt|ru)/(\d+)(/.*)?$"] = 'index.php?p=$matches[2]&lang=$matches[1]';              $aRules = $_aRules + $aRules;         return $aRules;     }      add a lang tag:               function nw_lang_addQuery($vars) {         $aVars[] = "lang";         return $aVars;     }      Buf if user go to http://www.somesite.com/en/17/2-Pork.html he dont see page with ID = 17. $wp_query is:               WP_Query Object (         [query_vars] => Array             (                 [lang] => en                 [error] =>                  [m] => 0                 [p] => 0                      .....                      [static] =>                  [pagename] =>                  [page_id] => 0                 [paged] => 0                 ....              [is_single] =>          [is_preview] =>          [is_page] =>          [is_paged] =>               ...              [queried_object] =>          [queried_object_id] => 0     )


Automated posting to wordpress from commandline or XMLRPC API on Dreamhost

I operate several wordpress sites on Dreamhost. I have some automated scripts that I want to be able to automatically post to the wordpress blogs. I can do this via a command-line tool or via the XML-RPC. Unfortunately:   1. I can't find a command line tool that will reliably post. (I have shell access on the computer on which the wordpress site is running.)   2. I can't get the XML-RPC API to work. I get an error that I need to use the RPC via POST. I'm told that this is a result of dreamhost running an out-of-date PHP version, but I've tried to use the mods to wordpress and it hasn't been successful. So is there an easy way (or even a hard way) to post to a wordpress blog? Thanks.


Custom Permalinks for Posts only

I'm using a page as my blog archive, ie http://mysite.com/blog I'd like to list the posts under that url: http://mysite.com/blog/untitled/hello-world/ I've added Category base "blog" and now my categories appear correctly (http://mysite.com/blog/untitled/), but posts do not. The thing is that I have other custom post types and I don't want the /blog/ part to appear there too. Any suggestions will be highly appreciated.


Add filter problems

I am confused about filters, why does this work:               function get_the_author_description2() {         return 'test';     }     add_filter('get_the_author_description', 'get_the_author_description2');      but this one does not:               function get_the_author_firstname2() {         return 'test';     }     add_filter('get_the_author_firstname', 'get_the_author_firstname2');      Confusing! [I know these are depreciated functions, but the plugin I am trying to override is using them.] Thanks


Where (what direcory) are the default Wordpress Widget Codes stored?

Of course we all know there are a few widgets ready by default to drag into a sidebar, but where are these stored? I'd like the copy the code of the Categories and modify it slightly to show my Theme's "Portfolio Categories" ....which are Gallery Item Categories. I see these by default: Calendar Categories Custom Menu Links Meta Log in/out Pages Recent Comments Recent Posts RSS Search Tag Cloud Text


Secure Pages Best Practice

I am in process of writing a plugin that has front-end shortcodes that display a user's information/data. If the user is not logged in, I need to redirect to a front-end login page/form. What would be the best practice here? My plugin creates the pages that I use as well as add the shortcodes to those pages. So, if there is a way to "protect" those pages I would love to know.


What is the advantage of using home.php over index.php for the front page

I am building a theme and wondering whether or not to include a home.php file or not. The theme (which will not be available to the public) will be mainly used with a static home page and separate blog posts page. My understanding is that including a front-page.php file means that the static home page would be served by that file; and that if I was to include a home.php file then the blog posts would be served by that. My question is this: If I was happy to use index.php as my blog posts layout instead of home.php then is there any advantage in having a home.php file ? Or to ask it another way: Is the only purpose of home.php that of allowing separate styling/layout of the blog posts page as compared to that of the index.php template (ie the fallback template). I should add that I have included in the theme most of the other templates ( single, archive, page etc) so I really only expect index.php to be used as a fallback and it will only operate in that regard If I've missed something so hopefully not that often.


stripping default wordpress code out of a page

I am trying to make a page in wordpress with my own unique html code, so my own head, html, body tags etc... I cant get it to work but then wordpress chucks in its own head , html tags etc so it adds spaces on the page, is there a way to strip the wordpress code out of one page, and use the code you want? Possible some how?


WP Query conflict on tag.php and category.php template

My WP_query in the header menu fails to pull any posts on tag and category pages only. Error occurs even with the Loop removed from those template pages. The menu in the header lists the parents. Then for each parent, it then queries for their child posts and image. Interestingly, (ALL) the posts appear when 'post_parent' condition is removed from $group_nav. I'm relatively new to php so any help is much appreciated. This issue has been giving me grief for the last 3 days! drop-down menu canbe viewed here: http://d1079691-5522.myweb.westnethosting.com.au/wsp- ie.com.au/?industry=construction and mis-behaving here: http://d1079691-5522.myweb.westnethosting.com.au/wsp- ie.com.au/?tag=synthetic-leather Coding in header.php               <?php $temp_query = clone $wp_query; ?>          <?php $group_nav_ids = array(916,917,918,919,920,921); //custom post type parent ids     foreach ($group_nav_ids as $group_nav_id): ?>                        *do stuff                 <?php $group_nav = new WP_Query(array( //get children posts     'post_type'         => 'pgroup',     'post_parent'       => $group_nav_id,                                    'order'             => 'ASC',     'orderby'           => 'menu_order',     'posts_per_page'    => -1     ));          if ($group_nav->have_posts()) : ?>            <?php while ($group_nav->have_posts()) : $group_nav->the_post(); ?>          *do stuff          <?php endwhile; ?>     <?php endif; ?>     <?php endforeach; ?>          <?php wp_reset_query(); wp_reset_postdata(); rewind_posts(); ?>          <?php $wp_query = clone $temp_query; ?>


How do I get the $handle for all enqueued scripts?

Is there some way to get the $handle for each script that has been enqueued? Is there some array that holds all the handles so that I can loop through it and do something using each $handle?


Is there a plugin or simple way to add a multiple images metabox to a post?

I am looking for a way to create a custom field/metabox that allow to attach **multiple** and **infinite** images to a post. This would allow to create a custom post type for a portfolio and allow to attach images **without pasting them inside the post textarea**. Most plugins I've seen allow for only 1 image. I've got the inspiration from the awesome ProcessWire CMS, that allows for this functionality right out of the box. It would be awesome to have this in Wordpress too! Is there a plugin I'm missing? Could this be done?


What filters are applied to the_content function?

How does WordPress convert raw data from the database to a readable format in the_content function? I've noticed that it applies the_content filter, but what does the_content filter do?


Filter For Featured Image

Is there a filter for when a Featured Image is set/unset or changed. I need to delete transient data when the above occurs.


Optimizing Jetpack for Wordpress

Yslow reports following issues with Jetpack: 1) Compress http://stats.wordpress.com/e-201219.js using gzip 2) Configure etags for http://stats.wordpress.com/g.gif?... Modified the format so that it is easier to understand. How can I take action against these items. I am already using latest version of W3 Total cache plugin. Pls advise.


How to create a second index.php?

I need a duplicate of `index.php`, but slightly modified. I added a "vote it up" plugin. So, I want the user to select how to display posts - by new or by popular. I know what to add to second `index.php`, but how to create a second `index.php`, thats the problem.


Update entry in WP database through backend form

I'm trying to find a way to UPDATE a entry in my WP DB via a form. My idea is to grab the current entry values, link to another page with another form and display them there inside containers. That would prevent the user from needing to select the entry and copy paste each time he needs to change it. Now he just changes what he wants, press submit en wallah. Make sense? Problem is I have no idea how to go about this in WP! I was thinking of using action="some_php_file_here.php" or using functions. But does WP have a specific way of linking between pages in the backend? How do I call up those pages. They don't really exist as menu items, so where are they? Also, for updating a entry. If anyone has a better suggestion please let me know. Thanks for your time.


Order query using custom meta data

I have created a custom post type called `Events` with the name of `events`               function add_events_post_type() {         register_post_type("events", array(             "label"             => __("Events"),             "singular_label"    => __("events"),             "public"        => true,             "capability_type"       => "post",             "hierarchical"      => false,             "rewrite"       => array("slug" => "event"),             "query_var"     => false,             "show_ui"       => true,             "supports"      => array("title", "editor", "author")         ));     }     add_action('init', 'add_events_post_type');      I use the following to create my custom meta box               define('MY_WORDPRESS_FOLDER',$_SERVER['DOCUMENT_ROOT']);     define('MY_THEME_FOLDER',str_replace("\\",'/',dirname(__FILE__)));     define('MY_THEME_PATH','/' . substr(MY_THEME_FOLDER,stripos(MY_THEME_FOLDER,'wp-content')));          add_action('admin_init','my_meta_init');          function my_meta_init()     {         // review the function reference for parameter details         // http://codex.wordpress.org/Function_Reference/wp_enqueue_script         // http://codex.wordpress.org/Function_Reference/wp_enqueue_style              //wp_enqueue_script('my_meta_js', MY_THEME_PATH . '/custom/meta.js', array('jquery'));         wp_enqueue_style('my_meta_css', MY_THEME_PATH . '/custom/meta.css');              // review the function reference for parameter details         // http://codex.wordpress.org/Function_Reference/add_meta_box              // add a meta box for each of the wordpress page types: posts and pages         foreach (array('events') as $type)         {             add_meta_box('my_all_meta', 'Event Info', 'my_meta_setup', $type, 'normal', 'high');         }              // add a callback function to save any data a user enters in         add_action('save_post','my_meta_save');     }          function my_meta_setup()     {         global $post;              // using an underscore, prevents the meta variable         // from showing up in the custom fields section         $meta = get_post_meta($post->ID,'_my_meta',TRUE);              // instead of writing HTML here, lets do an include         include(MY_THEME_FOLDER . '/custom/events.php');              // create a custom nonce for submit verification later         echo '<input type="hidden" name="my_meta_noncename" value="' . wp_create_nonce(__FILE__) . '" />';     }          function my_meta_save($post_id)     {         // authentication checks              // make sure data came from our meta box         if (!wp_verify_nonce($_POST['my_meta_noncename'],__FILE__)) return $post_id;              // check user permissions         if ($_POST['post_type'] == 'page')         {             if (!current_user_can('edit_page', $post_id)) return $post_id;         }         else         {             if (!current_user_can('edit_post', $post_id)) return $post_id;         }              // authentication passed, save data              // var types         // single: _my_meta[var]         // array: _my_meta[var][]         // grouped array: _my_meta[var_group][0][var_1], _my_meta[var_group][0][var_2]              $current_data = get_post_meta($post_id, '_my_meta', TRUE);                $new_data = $_POST['_my_meta'];              my_meta_clean($new_data);              if ($current_data)         {             if (is_null($new_data)) delete_post_meta($post_id,'_my_meta');             else update_post_meta($post_id,'_my_meta',$new_data);         }         elseif (!is_null($new_data))         {             add_post_meta($post_id,'_my_meta',$new_data,TRUE);         }              return $post_id;     }          function my_meta_clean(&$arr)     {         if (is_array($arr))         {             foreach ($arr as $i => $v)             {                 if (is_array($arr[$i]))                 {                     my_meta_clean($arr[$i]);                          if (!count($arr[$i]))                     {                         unset($arr[$i]);                     }                 }                 else                 {                     if (trim($arr[$i]) == '')                     {                         unset($arr[$i]);                     }                 }             }                  if (!count($arr))             {                 $arr = NULL;             }         }     }      and my custom box looks like below

Fill out this information so that events will post show.
     Event Start Date
<input type="text" name="_my_meta[eventstartdate]" class="date-pick" value="<?php if(!empty($meta['eventstartdate'])) echo $meta['eventstartdate']; ?>"/>
     Event End Date
<input type="text" name="_my_meta[eventenddate]" class="date-pick" value="<?php if(!empty($meta['eventenddate'])) echo $meta['eventenddate']; ?>"/>
     Publish Date
<input type="text" name="_my_meta[publish]" class="date-pick" value="<?php if(!empty($meta['publish'])) echo $meta['publish']; ?>"/>
     Hide Date
<input type="text" name="_my_meta[hide]" class="date-pick" value="<?php if(!empty($meta['hide'])) echo $meta['hide']; ?>"/>
     Sticky
<input type="checkbox" name="_my_meta[sticky]" value="sticky" <?php if($meta['sticky'] == 'sticky') { echo 'checked="checked"'; } ?>/>

      I am querying the posts in the custom post type on the homepage of the site using this query.               <?php         $args = array( 'post_type' => 'events', 'posts_per_page' => 3 );         $loop = new WP_Query( $args );         while ( $loop->have_posts() ) : $loop->the_post();             $data = get_post_custom(get_the_ID());             $data2 = $data['_my_meta'];             $data3 = unserialize($data2[0]);             if($data3['sticky'] == 'sticky')             {                 echo ''.get_the_title().'
';             } else {                 echo ''.get_the_title().'
';             }         endwhile;     ?>      I would like to order the query using the Event Start Date from the custom meta box. I have tried this with no luck. Can someone help me with this?


Snippet for own (gr)avatars

Following snippet used(and works great) but generates a redirect chain :(.               If (function_excists('basicgravatar')            function basicgravatar ($avatar_defaults) {        $myavatar = get_stylesheet_directory_uri() . '/images/gravatar.png'; //Child theme        //$myavatar = get_bloginfo('template_directory') . '/images/gravatar.png';  //Main theme        $avatar_defaults[$myavatar] = "New default avatar";        return $avatar_defaults; }          add_filter( 'avatar_defaults', 'basicgravatar' );      Using GTmetrix which shows following: > Remove the following redirect chain if possible: > http://0.gravatar.com/avatar/?d=http://oursite.com/media/wp- > content/themes/our-child-theme/images/gravatar.png&s=40 _and 2 more lines > with almost identical msg._ Also this is shown as result after using code above: > The following resources have identical contents, but are served from > different URLs. Serve these resources from a consistent URL to save 2 > request(s) and 20.2KiB. The more comments the more redirects.   (The quotes above show results after only two(2) comments and 1 author box, imagine 50 or more comments...)..how to solve this, without editing any core file. Thanks in advance for time and effort.


How to order posts by meta_value and title

How do you order products in WooCommerce so that products are random, but at the same time featured products show first? Here is my code:               $args = array(         'post_type' => 'product',         'showposts' => $show_posts,         'meta_key' => '_featured',         'orderby' => 'meta_value',         'order' => 'desc',         'post_status' => 'publish',         'paged' => $paged     );               $all_products = new WP_Query( $args );      I have tried adding `rand` after `meta_value`, but it just randomizes products (in other words the featured ones don't display first). Thanks in advance


How to display the content for given page ID withot the

 wrapper?

How to display the content for given page ID withot the `<p></p>` wrapper? The method I'm currently using is:               <?php      $id=21;      $post = get_page($id);      $content = apply_filters('the_content', $post->post_content);      echo $content;       ?>      For example `page ID = 21` has the following content: `Some content` What the wordpress echo is `<p>Some content</p>` Any suggestion much appreciated.


Editing wp-config.php

I need to add the line `define('WP_POST_REVISIONS', false);` to my config.php , so that post revisions are disabled. I don't have access to wp-config.php, I have permission to edit my theme and plugins. Is their any way i could add this code to my theme's function.php, or is their any hook to achieve it. also, Is their anyway to override the function which has been defined in wp- config.php for eg:               define( 'BP_DEFAULT_COMPONENT', 'profile' );      can i override the above line of code without accessing wp-config.php.


Podcast Guest List

So what I want to do is too have a function similar to a category or tag, but a little more robust. It's **for a podcast** to _list of guests for each episode_. Ideally this would do a few things: ### Guest Data For _each_ guest (added to an episode), display their:   * name,    * photo,    * twitter id,    * url.  ### Guest Page Clicking on their photo or name would the visitor to a page _like the authors page_ , where more info on that guest could be stored:   * a short bio,    * all the episodes that guest has appeared on,   * etc... ### Meta Box on pod cast edit screen: The management of this would ideally be managed like categories are now, through checkboxes and names listed on the write page to select from. Further management, (adding bio, photos, ect) would be done in another panel like posts are. My first thought was custom post types or custom taxonomies, but I'm not sure which method is more feasible. Any ideas? Thanks.


Get link to a specific template file

I was planning on creating a custom "Archives" template to create a detailed Archives page for my blog, including lists of posts by category, tag, date and author. Rather than use a static link though, is there a way within WordPress to get a link to a specific template file? I want the link to work regardless of the page's URL—is this possible?


How to force one column layout on custom post type edit page?

I've created a plugin using custom post types and I need to force the default two column post page to a single column. At the same time, the **Publish** metabox must move to the bottom. I need to do this via the functions some how. I have some solutions from WPSE, but the only solution I've found actually hides the "Publish" metabox. I can't seem to figure out why. Any ideas of how to do this?


How could a .htaccess with authentication suddenly appear or change?

When trying to mark a comment as spam, I was presented with a basic-htaccess login. I couldn't login and then I remembered I do not have a basic login: the only thing my `.htaccess` in the `wp-admin` folder does is white-list the allowed IP's. When checking out the files I found that   * I now have a couple of new lines on top of my `wp-admin/.htaccess` setting a basic authetication (with, for some reason, the user/password files located at /dev/null)   * I also have extra lines in my root access file (`/.htaccess`) containing another basic authentication line, pointing to a password file in the root. Both these files are created/modified on the 5th, but not by me.   * The passwordfile contains one entry for a user called 'admin' (a user I do not use), with a password hash. To be safe until I have time to remedy this, I changed that password-hash so if something was using that as an access-method, they can't anymore (It does seem like a bit of a strange thing to do when you are already able to write to my `.htaccess`. My thoughts currently are that it is probably not a hack, as it seems very little is changed while what is changed is quite hard to do: that would be strange. What I can think of that maybe this is   * an update either gone bad (temporary limiting access to the wp-admin to only the admin user and not finishing / reverting that)    * or an update that is too paranoid about security and 'decided' to add a basic login (but I've not found anyone outraging about that, so doubtfull). Does anyone know if there is a process in the automatic update that does things like this, and maybe scenarios that can happen (and maybe even I can check) that would keep these files in place? I do not specifically need tips to remove the files or remedy the situation, I mostly really want to find out how this would happen. Specifically if this is something the automatic updater could do.


Walker_Nav_menu access parent menu name

I extended **Walker_Nav_Menu** with the code below and I would like to replace [TITLE HERE] with the name of the parent menu... In my menu I only display one depth of the navigation at a time. So I would like to display the name of the submenu's parent. How could I achieve that ?                function start_lvl( &$output, $depth = 0, $args = array() ) {         $indent = str_repeat("\t", $depth);             $output .= "
";             $output .= "
**[TITLE HERE]**
";             $output .= "Close";             $output .= "\n$indent
\n";         }      Thanks in advance. J.


Get ID of featured image using "get_post_thumbnail_id(the_ID())" - without printing to screen?

I'm using the code:               get_post_thumbnail_id(the_ID())      to get the ID of a post thumbnail image, but whenever I call this it outputs the ID to screen. I just want to get the value to use in another function, without it echoing anywhere. How do I do this?


Injecting a custom sql query into a page/theme

I have written a custom sql query for our WordPress website (fairly elaborate and not achievable with the standard wordpress code) and I've got it to run via `$pageposts = $wpdb->get_results($query, OBJECT);`, it yields the results I expect. Now I would like to integrate this query via a hook (ideally), so that I don't have to update the theme page so that we can still update the theme. I know that the hook `pre_get_posts()` allows you to adjust the main query, but from what I've found it seems to **only** allow you **adjust**. E.g. `$query->set( 'year', $today['year'] );`. I however, want to replace the query completely. Is this doable using a hook so that I can utilize the main theme code using a hook from my child theme code? Or will I need to clone the full page from the main theme to the child theme and use the code like this:               <?php      $pageposts = $wpdb->get_results($q, OBJECT);     if ($pageposts):         global $post;         foreach ($pageposts as $post):             setup_postdata($post);     ?>


How to display posts by vote count and if no value continue with latest posts with no votes?

Maybe someone can help me with this. I want to display posts by votes. Users can only vote up. So what I want is - the most voted posts by vote count on top and then latest posts with no votes. The problem with this code below is that the post is displayed only if it has at least one vote (+1). I have tested it and it sort only voted posts the way I want, but how to continue loop if no vote value?               $args = array(          'post_type' => 'topic-post',          'posts_per_page' => -1,          'order' => 'DESC',          'meta_key' => '_topic_post_votes',          'orderby' => 'meta_value_num',          'meta_query' => array(          array(          'key' => '_topic',          'value' => array( $topic_id ),          'compare' => 'IN',          )          ),          'post_status' => $status          );


Load JS/CSS of shortcode in post

I try the The Jedi Master way http://scribu.net/wordpress/optimal-script-loading.html               class My_Shortcode {         static $add_script;              static function init() {             add_shortcode('myshortcode', array(__CLASS__, 'handle_shortcode'));                  add_action('init', array(__CLASS__, 'register_script'));             add_action('wp_footer', array(__CLASS__, 'print_script'));         }              static function handle_shortcode($atts) {             self::$add_script = true;                  // actual shortcode handling here         }              static function register_script() {             wp_register_script('my-script', plugins_url('my-script.js', __FILE__), array('jquery'), '1.0', true);         }              static function print_script() {             if ( ! self::$add_script )                 return;                  wp_print_scripts('my-script');         }     }          My_Shortcode::init();      when [myshortcode] in widget, the js file is loaded. But when [myshortcode] in a post , the js file is not loaded. Could you tell me the problem ?


Options Framework options not being output

I am using the Options Framework. In my theme's options.php, I have the following code:               function optionsframework_options() {              $options = array();              $options[] = array(             'name' => __('Footer Navigation', 'options_framework_theme'),             'type' => 'heading');              $options[] = array(             'name' => __('Button 1 URL', 'options_framework_theme'),             'desc' => __('Enter the URL clicking on the button takes you to.', 'options_framework_theme'),             'id' => 'footer-nav1_URL',             'std' => '',             'type' => 'text');              $options[] = array(             'name' => __('Button 1 Text', 'options_framework_theme'),             'desc' => __('Enter the text you see underneath the button.', 'options_framework_theme'),             'id' => 'footer-nav1_text',             'std' => '',             'type' => 'text');      In my theme's footer.php, I have the following code:               <?php if (of_get_option('footer-nav1_URL', '') !== '') { ?>         <a href="<?php echo of_get_option('footer-nav1_URL', '');?>">                                       <?php echo of_get_option('footer-nav1_text', '');?>              <?php }?>      Those options are not being output in the footer. The footer is working normally otherwise. Other options called in front-page.php are working okay. Why won't these options work?


Display edit link if post author is current user

I am creating an author.php page and listing all the posts from an author. Although admins can see the posts' edit links i want to echo the link if logged in user is the current user for example if testuser is logged in and current page is /author/testuser he can see edit post links but if testuser is logged in and current page is /author/theee he cant see the links currently i have               $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));     $th = $curauth->nickname;      $cu = $current_user->user_login;     if ( $th = $curauth ) {       edit_post_link('edit', '', '');      } else {          }      but still only admins can see the links.


different categories (using the same category labels) for different post types

I'm trying to build a multimedia aggregation website with 6 different custom post types and I would like each post type to have 12 categories, the same 12 category labels that the other 5 have, only I would like each to have its own archive, not to share category archives with the others. Here is a link to the website in its current form: http://www.collectivelyconscious.net/test2 (check navigation to see categories) A simplified structure of the website is as follows:               1. root/         A. news/           i. politics/           ii. economics/           iii. health/            ...etc.            B. videos/           i. politics/           ii. economics/           iii. health/            ...etc.            C. documentaries/           i. politics/           ii. economics/           iii. health/          ...etc.      So what I want is for people to be able to click on a category tag, say "Political", for news and have the archive show only the recent news posts that have been sorted into the category "Political" with the URL preferably in the following format: `root/news/political/` Or if that is not possible then for them at least to be found at: `root/category/political-news/` I have been messing around with the plugin Custom Post Type UI and if I add either the normal tags or normal categories they use the same categories/tags of course and feed into a single archive. So then I tried creating custom taxonomies but (1) am forced to change the taxonomy slug for each custom post type, (2) I am unable to find the archive page for custom post type posts in custom taxonomies, and (3) it is acting really buggy for some reason. I have no idea where to go from here... Any help would be greatly appreciated!


WP Code Highlight :'=>' replaced by '&gt'

I use WP Code Highlight on my blog, but if I input the characters `=>` between `<pre>#code here...</pre>`, it changes into `>`. For instance, `'access arguments' => array('admin turen module')` will be changed to `'access arguments' =>array('admin turen module')`.


Dynamic Sidebars & Echo

I can sucesfully get my dynamic sidebar to work like so:

             <?php dynamic_sidebar( 'pop-photos-sidebar' ); ?>

      Now, I'm trying to get the sidebar to work with a different code that is inside a php code. I tried using the above `< ?php dynamic_sidebar( 'pop- photos-sidebar' ); ? >` code and it broke my site since the php dynamic_sidebar code is inside another php code. So I tried making a $ function like so:               $newssidebar = dynamic_sidebar( 'pop-news-sidebar' );                 echo '

                     '.$newssidebar.'

';      This sucesfully displayed the dynamic side bar "pop-news-sidebar" but.. it is not inside the ul class widget-area first, or inside the div class sidebar sidebar-first. How would I make my dynamic sidebar to properly be displayed in the ul class and div class listed above like it should be? Would I even use echo? I didn't think it was necessary to paste the full code, but here it is anyways:               <?php         if( fake if code ) {             if( another fake if code ) {                 $newssidebar = dynamic_sidebar( 'pop-news-sidebar' );                 echo '

                     '.$newssidebar.'

';             }else if( fake else ) {                 echo 'some other code';              }         }          ?>      Any help would tremendously be appreciated! :)


Advanced author permalinks

I'm trying to build permalink structure for author archives that would allow me to display different custom post types posts in 'subpages/subarchives' of author archive. So the idea is to change this: /%author_base%/%user_name%/ Into this: /%author_base%/%user_name%/%CPT_slug%/ I'd be greatful for suggestions.


How to check if the product is in a certain category on a single-product.php in Woocommerce?

How in the world can I check if a product is in a certain product category on the _single-product.php_?               <?php if (is_product_category('audio')) {                echo 'In audio';                    woocommerce_get_template_part( 'content', 'single-product' );                } elseif (is_product_category('elektro')) {                      echo 'In elektro';                 woocommerce_get_template_part( 'content', 'single-product' );              } else {                 echo 'some blabla'; }  ?>      **is_product_category('slug')** does not have an effect on the **single- product.php**. I want to have the upper conditionals. Any solution for this on a single-product page?


Query not returning CPT posts

Ouch, banging my head against a wall! I am trying to query my post type 'clips' in index.php but it's returning only posts from the default 'post'. I need some insight! What am I doing wrong? My post type:               $args = array(          'labels' => $labels,         'supports' => $supports,          'hierarchical' => false,         'menu_position' => 4,         'publicly_queryable' => true,         'show_ui' => true,         'public' => true,         'query_var' => true,         'capability_type' => 'clip',         //'map_meta_cap' => true,         //'capabilites' => $capabilities,     );           register_post_type( 'clip', $args );       My query (index.php):               <?php query_posts(array('posts_per_page' => 17, 'post_type' => array('clip'))); ?>          <?php if (have_posts()) : ?>
            <?php while (have_posts()) : the_post(); ?>
           <?php the_title();?>
<?php the_permalink(); ?>           <a id="post-<?php the_id(); ?>" class="videolink" title="Click to view" href="">           <?php if ( has_post_thumbnail() ) {               the_post_thumbnail();              } else {              echo "No thumbnail";              } ?>
             <?php endwhile; ?>
                   <?php else: ?>
Sorry, but this content is not available.
              <?php endif; ?>      Note there are no other loops in the template file.


Create second custom 404 page for selected post type

I created a new custom post type called `event`, which works fine. I also created a custom `404` page template, which is shown if a event/page/post is not found. But now the hard part, i want to create a custom 404 page for event post type. So this 404 page is only shown if a event is not found. But the default 404 page should still work with posts or pages. Thanks


How to find the post_id of a post on a wordpress blog that uses pretty URLs?

The only trick here: It is not my blog, I know how to do it using php in my blog. I want to find the id of a post on another wordpress blog through the internet. Does this information 'leak' somewhere, is it possible to be found by a third party?


Comments: Approve when admin Replies, from the Front end

Thank you for reading, In the admin panel, when a comment is awaiting moderation, you can "Approve and Reply" in the same action. However, in the front end, if you show the awaiting comments to the admin, and she hits Reply, the comment wont approve. Does anybody know how to get the proper link, or where modify the code, to auto-approve comments when the admin replies ? **Why:** I'm creating the site for a client, and trying to make it as easy as posible so she won't need to learn WP's admin panel.


Build a rss powered website network

I'm trying to build a website network on my site that is rss powered. It should be similar to http://network.smashingmagazine.com/ in scope except I want the new content posted automatically. It should work off a cron job perhaps every hour or so and it needs to fit the current template on my site at http://www.theliverpoolview.com/ Is there any free or open source plugin that does an easy job of this?


Correct syntax for retrieving custom field in CPT

I don't understand when to use $post->ID or $post->post->ID with CPTs. I have :               $event = get_post( $event_id );     $event_pre_register = get_post_meta($event->post->ID, "Event Pre-register deadline", true);       Or is it : get_post_meta($event->ID ... ?


Will these plugins work with wp multisite?

I just created my first network of sites with wordpress and I was installing plugins, I installed these: > Platinium SEO Pack (http://techblissonline.com/platinum-seo-pack/) > > TubePress (http://www.tubepress.net) > > Contact Form 7 (http://contactform7.com/) > > Social Bookmarks (http://wordpress.org/extend/plugins/social-bookmarks/) > > Strictly Auto Tags (http://wordpress.org/extend/plugins/strictly-autotags/) > > SEO Smart Links (http://wordpress.org/extend/plugins/seo-automatic-links/) > > SEO Friendly Image (http://wordpress.org/extend/plugins/seo-image/) > > Google XML Sitemaps (http://wordpress.org/extend/plugins/google-sitemap- > generator/) I "network activated" all the plugins and then I went to one of the sites dashboards, and I saw a msg from Google XML Sitemaps saying that the plugin doesn't work on multisite. Now my problem is that I don't know if the other plugins will work. Will I have to test each feature of all the plugins or is there an easier way to know if they work on multisite?


How to get the depth of a category's subcategories

I'm looking to get the depth a category's subcategories. Suppose I have a category 'grandparent' which has a subcategory 'parent' which in turn has a subcategory 'child'. How do I get to integer 2? I suppose I could check if 'grandparent' has subcategories and if it does, check if they have subcategories, etc, until I hit 0. But that seems like a lot of unnecessary processing. Isn't there a more elegant way?


Guest Author - How can I use custom fields to create guest author link?

We are posting articles authored by guest authors. The guest authors will not be logging in to the site, and we don't want to create users for these guest authors. We are also not interested in any of the guest blogger plugins for MANY reasons.. To display the guest authors name in the guest posts, I've added a function to my theme's functions.php file so that using a custom field, my guest authors name will appear in place of the name of WordPress user who posted the article.. This function is outlined here: http://www.wpbeginner.com/wp- tutorials/how-to-rewrite-guest-author-name-with-custom-fields-in-wordpress/ Using this, I am able to change the name of the author to display the guest author's name.. However the author link still points to the author page of the WordPress user who posted the article. So now I'd like to do something similar with the author link. What I would like to do is for the author link to go to a URL that I will enter in a custom field like I enter the guest author's name. This is the code I'm using, but it's not working. The author link still takes you to the author page for the WordPress user who posted the article.               add_filter( 'the_author_posts_link', 'guest_author_link', 10, 3);     add_filter( 'get_author_posts_url', 'guest_author_link', 10, 3);     add_filter( 'the_author_link', 'guest_author_link', 10, 3);     add_filter( 'get_author_link', 'guest_author_link', 10, 3);          function guest_author_link($link, $author_id, $author_nicename) {       global $post;       $url = get_post_meta( $post->ID, 'guest-url', true );         if( $url ) {             $link = $url;         }         return $link;     }


How to remove the automated code posted in functions.php?

There is a theme hack or a worm circulating online which adds this code to all functions.php files. It happened to me on my local server. Here's the code - http://pastebin.com/AUsHUng1 How do I find the theme hack that creates it? Or the worm? **UPDATE:** I have found that this line:               $elem == substr(__FILE__,-13)){      checks for the **functions.php** file (as it's the only one having 13 letters and using file) and by using the `fputs()` functions writes itself on all **functions.php** files. I have deleted all the instances of the code, and, hopefully, it will not replicate itself on another theme activation. I have a local server with about 60 themes. I still haven't found the original theme that carried the code. **UPDATE AND SOLUTION:** Clean all the malicious code (see my PasteBin link above) from all **functions.php** files (best to check globally using a text editor like Notepad++) and you're done. Check all downloaded themes for the code in **functions.php** file. There are more themes infected with this code online.


Removing Shortcodes from Child Theme

I'm trying to remove the shortcodes from a child theme. In my functions.php file (for the child theme), I've put:               function my_remove_shortcode(){         return '';     }     add_shortcode('entry-twitter-link', 'my_remove_shortcode');      Where entry-twitter-link is a shortcode created in the parent. However, the entry still shows up on my posts. Ideas on what's wrong?


## This issue is now finally resolved by myself. Find the solution in the end of this post. Question was in short: **How can i ask in my WP template, IF the whole array of have_posts contains any post from a certain category** I programmed my tag page so that the output is seperated into three styled boxes according to the categories. The loop is done three times and with an IF i sort out the categories. This is a _simplified!_ draft of the working structure:

     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>       <?php if (in_category('cat1')) : ?>
...     <endif>

     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>       <?php if (in_category('cat2')) : ?>
...     <endif>

     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>       <?php if (in_category('cat3')) : ?>
...     <endif>

      Here you can see the output: http://imlichte.net/tag/interdependenz/ Now my point is to avoid emtpy boxes when no posts are found in a category. The boxes (divs) should then not be rendered at all. For this i thought to put an IF condition for the div and ul, which are outside of the loop. So i want to actually ask this thing: **IF have_posts contains posts from a certain category** The div and ul that creates the box on the page will only be shown if the result is not zero, thus the result of suppressing empty boxes is reached. I hope i could explain my request well enough to be understood and hope for a solution from the experts, since i am just a hobby programmer. Thanks for help Sofian Edit: to make it very clear, here comes the whole code that generates my category structured tag list:

Artikel

                     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>       <?php if (in_category('wissen')) : ?>
              <?php if (has_post_thumbnail()): ?>             <a href="<?php the_permalink();?>"><?php the_post_thumbnail(array(150,150));?>         <?php else: ?>

         <?php endif; ?>                    <a class="postlisttitle" href="<?php the_permalink();?>"><?php the_title(); ?>
               <?php the_excerpt();?>

         <?php endif; endwhile; endif; ?>

Empfehlungen

                   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>       <?php if (in_category('empfehlungen')) : ?>
              <?php if (has_post_thumbnail()): ?>             <a href="<?php the_permalink();?>"><?php the_post_thumbnail(array(150,150));?>         <?php else: ?>

         <?php endif; ?>                    <a class="postlisttitle" href="<?php the_permalink();?>"><?php the_title(); ?>
               <?php the_excerpt();?>

         <?php endif; endwhile; endif; ?>

Seminare

                   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>       <?php if (in_category('seminare')) : ?>
              <?php if (has_post_thumbnail()): ?>             <a href="<?php the_permalink();?>"><?php the_post_thumbnail(array(150,150));?>         <?php else: ?>

         <?php endif; ?>                    <a class="postlisttitle" href="<?php the_permalink();?>"><?php the_title(); ?>
               <?php the_excerpt();?>

         <?php endif; endwhile; endif; ?>

      The solution: I run through the whole loop once just to set a variable to true if it comes across a post in that category. If there is no post, the var stays false and the Div Box around the actual loop will not be output.               <?php $categoryexisting = false;        if (have_posts()) : while (have_posts()) : the_post();       if (in_category('articles')) :         $categoryexisting = true;                    endif; endwhile; endif; ?>            <?php if ($categoryexisting): ?>

Articles

          <?php endif; ?>      ... Actual loop ...


How to dynamically change theme's slogan from admin?

how can achieve this functionality. That I can change the themes "slogan" from admin and I don't have to go edit the themes source files. I think that there is some theme options functionality. But how to use it and maybe somebody can point me to the correct path. Added screenshot to clarify what I mean under slogan: ![enter image description here](http://i.stack.imgur.com/ALjqI.png)


Understanding Post Formats/Custom Post types Etc

I don't understand what "Adding Post Type Support" is for when we have "Adding Theme Support"? For different post-formats this is the way I was shown before. This is then how I did it for the project I was working on, is this a correct/good way to do it? here is whats in my `functions.php` file:               <?php add_theme_support( 'post-formats', array('image', 'video', 'gallery')); ?>      and here is what is in my `index.php` file:               <?php get_template_part('content', get_post_format()); ?>      I also want to know if I should "custom post type" for what I describe below: Lets say I have a page called "giftshop" with posts (also trying to figure that part out now) and I want to use the `image` format for each post but then I have a page that I'm only going to show one post called "newsletter" and I also want to use the `image` format but have it styled a little different, is that possible?


TinyMCE buttons that launch Ajax-generated forms

if i follow the tutorials on how to add tinyMCE buttons for shortcodes ( for instance: http://www.garyc40.com/2010/03/how-to-make-shortcodes-user- friendly/ ) if i create a button that launches a form in a thickbox there is always this bit of code to create the launched form:               // executes this when the DOM is ready         jQuery(function(){             // creates a form to be displayed everytime the button is clicked             // you should achieve this using AJAX instead of direct html code like this             var form = jQuery('

\
\                     Columns	\                     <input type="text" id="mygallery-columns" name="columns" value="3" />
\                     specify the number of columns.	\
\
\
\                 <input type="button" id="mygallery-submit" class="button-primary" value="Insert Gallery" name="submit" />\
\
');                  var table = form.find('table');             form.appendTo('body').hide();      but i am curious about this part in particular : **// you should achieve this using AJAX instead of direct html code like this** i've seen this on other tutorials, and in other plugins.... but all i've seen continue to do it this hard-coded way. does anyone have any insight into how to do this via ajax? i'd like to popular a select drop-down with values from get_options().. which i cannot do in jquery/java and the js file can't process the php either, so i figured ajax is the solution i'm just not sure how to start


URL Rewrite + Page + Custom Post Type = Unusual Redirect

Yet another URL rewrite issue :) ## The Problem I have a URL rewrite rule that should work, but against all logic it redirects without passing the query var. ## The Juicy Details The site has a page structure set up like so: > **/our-firm/shareholders** and I have a Custom Post Type named " _shareholder_." My goal is to have the structure work like this: > **/our-firm/shareholders/awesome-shareholder-name** ...and for the Shareholders page to do a custom query for the Shareholder posts. I normally would use the rewrite slug for the Shareholder posts, but I want the content to be shown in the context of the original Page structure ( **our-firm/shareholders** ). In order to achieve that, I added this code in functions.php (and have since gone to Permalinks and saved to refresh the rules):               add_action( 'init', 'my_custom_rewrites' );     function my_custom_rewrites(){         add_rewrite_rule(             'our-firm/shareholders/([^/]+)/?',             'index.php?pagename=shareholders&shareholder_name=$matches[1]',             'top' );     }          add_filter( 'query_vars', 'my_custom_query_vars' );     function my_custom_query_vars( $query_vars ){         $query_vars[] = 'shareholder_name';         return $query_vars;     }      All that in place, if I go to **/our-firm/shareholders/awesome-shareholder- name** it redirects me to the Shareholders page without passing the query var and actually changes the URL to **/our-firm/shareholders/**. The weird part is if I change the redirect pagename to anything else, it works and effortlessly passes the query var along. To further test it, I used the handy Rewrite Analyzer plugin and got this: Rewrite Analyzer Test Screenshot ## Additional Notes   * I am running WP **3.2.1** , testing locally, and have not fiddled with .htaccess   * My Shareholders Page template isn't doing anything unusual, but let me know if you need to see it   * _Does Wordpress take into account the label of a Custom Post Type when figuring out URLs?_ The plural label of "shareholder" is, naturally, "Shareholders."   * I am adding the "shareholder" CPT via the **Custom Post Type UI** plugin. I can manually add it with code if anyone feels that would help. These are the CPT settings: > rewrite = true, slug = 'shareholder', with_front = true, query var = true, > and hierarchical = true.   * I previously had the "shareholder" post type ID as "shareholders," then quickly realized that would cause issues being the same name as the page I was attempting to redirect to. I then changed the post type to "shareholder," which unfortunately didn't resolve the issue. _Could the fact that there one was a post type of "shareholders" be affecting this?_ Maybe there's a secret magical cache somewhere that I could clear out...   * I know there are at least 5 bajillion WP URL rewrite posts across the web, but I can't seem to find one that pertains to my specific issue. Sorry if I missed one :) I'm at my wit's end – I _know_ that this should work, but it doesn't. Hopefully I missed something painfully obvious and it's an easy fix. Please let me know if I can provide any more details/code/etc. Any help would be appreciated, thanks!


Automatically adding post and pages to new blog setups

I'm using the ThreeWP Broadcast plugin to add and control post and pages from the main blog to all my sub-blogs in the network. Is there anyway i can automatically add all of my post and pages from my main blog to new blogs I set up without having to go in each individual post and page and adding it manually?