title: Include subtitle display to slideshow

text:
Thanks to Author for this plugin. But There is no option to display subtitle. There is only 2 options - Title and excerpt. Help me change excerpt to subtitle. I use this function to display subtitles in posts : `<?php if (function_exists('the_subtitle')){ the_subtitle(); }?>` This is file of fronpage config: I marked the neccesarry lines.               <?php       /*      Plugin Name: Frontpage-Slideshow      Plugin URI: http://wordpress.org/extend/plugins/frontpage-slideshow/      Description: Frontpage Slideshow provides a slide show like you can see on linux.com or modulaweb.fr      front page. Configuration Page      Version: 0.9.9.3.8      Author: Jean-François VIAL      Author URI: http://www.modulaweb.fr/      Text Domain: frontpage-slideshow      */      /*  Copyright 2009 Jean-François VIAL  (email : jeff@modulaweb.fr)          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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      */        define ('FRONTPAGE_SLIDESHOW_VERSION', '0.9.9.3.8');        $fs_already_displayed = false; // the slideshow dont have been displayed yet           // integrates the template file      $template = 'default';      $options = frontpageSlideshow_get_options();      if (isset($options['values']['fs_template'])) {     if (is_file (dirname(__FILE__).'/templates/'.$options['values']['fs_template'].'          /template.php'))         $template = $options['values']['fs_template'];      }      include (dirname(__FILE__).'/templates/'.$template.'/template.php');                   function frontpageSlideshow($content,$force_display=false,$options=array()) {     global $fs_already_displayed,$fs_last;          if ($fs_already_displayed) return false;          if (!count($options)) $options = frontpageSlideshow_get_options();     if (!$options['values']['fs_is_activated'] && !$force_display) return $content;     $fscategories = implode(',',$options['values']['fs_cats']);          if ((!is_feed() && is_front_page() && $options['values']['fs_insert']!='shortcode') || $force_display) { // the slideshow is only displayed on frontpage         $fs_already_displayed = true;         $fsposts = get_posts('category='.$fscategories.'&orderby='.$options['values']['fs_orderby'].'&numberposts='.$options['values']['fs_slides'].'&order='.$options['values']['fs_order']);         $fsentries = array();         foreach ($fsposts as $fspost) {             // format informations             $title = get_post_meta($fspost->ID,'fs-title',true);             if ($title == '') $title = $fspost->post_title;             $comment = get_post_meta($fspost->ID,'fs-comment',true);             if ($comment == '' && $options['values']['fs_default_comment_to_excerpt'])                 $comment = $fspost->post_excerpt;             $buttoncomment = get_post_meta($fspost->ID,'fs-button-comment',true);             $link='';             // if the option is on, uses the post permalink as slide link             ($options['values']['fs_default_link_to_page_link'] && get_post_meta($fspost->ID,'fs-link',true) == '') ? $link = get_permalink($fspost->ID) : $link = get_post_meta($fspost->ID,'fs-link',true);             $image = get_post_meta($fspost->ID,'fs-picture',true);             if ($image == '') { // if no image : use the first image on the post                 if (function_exists('has_post_thumbnail')) {                     if (has_post_thumbnail($fspost->ID)) {                         $image = wp_get_attachment_image_src(get_post_thumbnail_id($fspost->ID),'large');                         $image = $image[0];                     }                 }                 if ($image=='') {                     if (preg_match('/]*src="([^"]*)"/i',$fspost->post_content,$matches)) {                         $image = $matches[1];                     } else {                         (is_ssl()) ? $url = str_replace('http://','https://',get_bloginfo('url')) : $url = str_replace('https://','http://',get_bloginfo('url'));                         $image = $url.'/wp-content/plugins/frontpage-slideshow/images/one_transparent_pixel.gif';                     }                 }             }                  // handles https for the link             (!is_ssl()) ? $link = str_replace('https://','http://',$link) : $link = str_replace('http://','https://',$link);             // handles https for image             (!is_ssl()) ? $image = str_replace('https://','http://',$image) : $image = str_replace('http://','https://',$image);                  // add a temporal variable to the image url to avoid cache                       // put infos into an array             $fsentries[] = array('title' => $title.' ', 'image' => $image, 'comment' => $comment.' ', 'button-comment' => $buttoncomment.' ', 'link' => $link, 'post_id' => $fspost->ID);         }         // construct the slider         $fscontent = '';         $fslast = count($fsentries) -1;         if (count($fsentries))             $fscontent = frontpageSlideshow_TPL($fsentries);         $header = frontpageSlideshow_header(true,$options);         return "\n\n{$fscontent}\n{$header}\n\n{$content}";          } else {         return $content;     }       }           function frontpageSlideshow_init() {     // loads the needed frameworks to load as a safe way     wp_register_script('jquery-ui-effects',WP_PLUGIN_URL .'/frontpage-slideshow/js/jquery-ui-effects.js', array('jquery-ui-core'));     wp_enqueue_script('jquery-ui-effects');       }       function frontpageSlideshow_admin_enqueue_scripts() {     // loads the needed frameworks to load as a safe way into admin page     wp_enqueue_script('jquery-ui-draggable');     wp_enqueue_script('jquery-ui-droppable');     wp_enqueue_script('jquery-ui-selectable');     wp_enqueue_script('jquery-ui-sortable');       }            function frontpageSlideshow_header($force_display=false,$options=array()) {         if (!count($options)) $options = frontpageSlideshow_get_options();         if (!$options['values']['fs_is_activated'] && !$force_display) return;         $fscategories = implode(',',$options['values']['fs_cats']);         $fsposts = get_posts('category='.$fscategories.'&orderby=ID&numberposts='.$options['values']['fs_slides']);         $fslast = count($fsposts) - 1;              frontpageSlideshow_JS($options,$fslast);         frontpageSlideshow_CSS($options,$fslast+1);         return '       ';             }             function frontpageSlideshow_JS_effect($effect,$inout='out') {     $options = frontpageSlideshow_get_options();     if ($effect == 'random') {         $transitions = array('fade', 'shrink', 'dropout', 'jumpup',     'explode',      'clip', 'dropleft', 'dropright', 'slideleft', 'slideright', 'fold', 'puff');         $effect = $transitions[rand(0,count($transitions)-1)];     }     $inout = ucfirst(strtolower($inout));     $callback = '';     $duration = $options['values']['fs_transition_on_duration'];     if ($inout == 'Out') {         $callback = ', fsChangeSlide2';         $duration = $options['values']['fs_transition_duration'];     }     switch ($effect) {         case 'scale':         case 'shrink':             return 'jQuery("#fs-slide").toggle("scale", {}, ' . $duration .      $callback.');';         case 'dropout':         case 'drodown':             return 'jQuery("#fs-slide").toggle("drop", {direction: "down"}, ' . $duration . $callback.');';         case 'jumpup':         case 'dropup':             return 'jQuery("#fs-slide").toggle("drop", {direction: "up"}, ' . $duration . $callback.');';         case 'explode':             return 'jQuery("#fs-slide").toggle("explode", {pieces: 32}, ' . $duration . $callback.');';         case 'clip':             return 'jQuery("#fs-slide").toggle("clip", {direction: "vertical"}, ' . $duration . $callback.');';         case 'dropleft':             return 'jQuery("#fs-slide").toggle("drop", {direction: "left"}, ' . $duration . $callback.');';         case 'dropright':             return 'jQuery("#fs-slide").toggle("drop", {direction: "right"}, ' . $duration . $callback.');';         case 'slideleft':             return 'jQuery("#fs-slide").toggle("slide", {direction: "left"}, ' . $duration . $callback.');';         case 'slideright':             return 'jQuery("#fs-slide").toggle("drop", {direction: "right"}, ' . $duration . $callback.');';         case 'fold':             return 'jQuery("#fs-slide").toggle("fold", {}, ' . $duration . $callback.');';         case 'puff':             return 'jQuery("#fs-slide").toggle("puff", {}, ' . $duration . $callback.');';         case 'fadeout':         case 'fade':         default:             return 'jQuery("#fs-slide").fade'.$inout.'(' . $duration . $callback.');';     }       }             function frontpageSlideshow_dedicated_shortcode ($attributes=array(), $content=null)       {     global $fs_already_displayed;          $options = frontpageSlideshow_get_options(); // get default or tweaked options          // dont do anything if     //  - the slideshow has already been displayed     //  - the slideshow has not been activated     //  - the shortcode option is not activated     // parse the other eventually nested shortcodes and display the enventualy specified content     if ($fs_already_displayed || !$options['values']['fs_is_activated'] || $options['values']['fs_insert']!='shortcode') return do_shortcode($content);          $options['values'] = shortcode_atts($options['values'], $attributes);     if (is_array($attributes)) {         if (array_key_exists('fs_cats',$attributes))             $options['values']['fs_cats'] = explode(',',$attributes['fs_cats']);           }     $force_display_if_shortcode = true;     $force_display_if_shortcode = true;     //frontpageSlideshow_header(true,$options);     return frontpageSlideshow('',true,$options);       }            class frontpageSlideshow_Widget extends WP_Widget {          function frontpageSlideshow_Widget() {         $widget_ops = array('classname' => 'widget_text', 'description' =>      __('Arbitrary text or HTML'));         $control_ops = array('width' => 400, 'height' => 350);         $this->WP_Widget('text', __('Text'), $widget_ops, $control_ops);     }          function widget( $args, $instance ) {         extract($args);         $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);         $text = apply_filters( 'widget_text', $instance['text'] );         echo $before_widget;         if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
<?php echo $instance['filter'] ? wpautop(do_shortcode($text)) : do_shortcode($text); ?>
         <?php         echo $after_widget;     }          function update( $new_instance, $old_instance ) {         $instance = $old_instance;         $instance['title'] = strip_tags($new_instance['title']);         if ( current_user_can('unfiltered_html') )             $instance['text'] =  $new_instance['text'];         else             $instance['text'] = wp_filter_post_kses( $new_instance['text'] );         $instance['filter'] = isset($new_instance['filter']);         return $instance;     }              function form( $instance ) {         $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text'        => '' ) );         $title = strip_tags($instance['title']);         $text = format_to_edit($instance['text']);              ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php       _e('Title:'); ?>         <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"        name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php        echo esc_attr($title); ?>" />
              <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
<input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked($instance['filter']); ?> /> <label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?>
      Some of This lines must be changed:                           $comment = get_post_meta($fspost->ID,'fs-comment',true);             if ($comment == '' && $options['values']['fs_default_comment_to_excerpt'])                 $comment = $fspost->post_excerpt;             $buttoncomment = get_post_meta($fspost->ID,'fs-button-comment',true);             $link='';


title: wp-link-pages in header and footer of the post

text: I would like to work the wp_link_pages functions a bit. In header of the post starting with second page I would like to have a link to previous page,               Continued from page 1      where 1 is the number of the previous page, if is first page will show up nothing. In the footer of the post I would like them to show up like this:               << Previous Page | 1 | 2 | 3 | 4 | Next Page >>       and the current page number should not be linked. Thanks


title: htaccess rewrite, adding segment to url

text: Im not that good with htaccess files & regexes, and i'm trying to add a segment to a certain url. I'm building a website for a festival and we have a comon structure for the artists being: line-up > room > artist I created a custom post-type & taxonomy to do this but when going to one room the url will be /room/orange with standard WP rewrites. I'm trying to edit the htaccess so that i can use line-up/room/orange for this. Is this possible? and how can i do this? This is what i tried so far:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule ^line-up/room/([a-zA-Z]+)$ /index.php?ilt_rooms=$1 [L]     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      but the parameters aren't passed to the right place because WP won't load the appropriate template and gives me a 404. Also, when I don't comment out the last rewriteRule my css won't load, I just don't get this.


title: Run function on plugin upgrade

text: Hi a new version of a plugin I have in the repository changes the way the data is stored in the database, how can I perform a check on upgrade that automatically moves the data to the new location, so the users don't lose any of their settings and are not aware of what is happening beneath the hood?


title: Cron Job not working in plugin

text: I have written a plugin that will convert posts to excel format and then email the .xls to an email id. I can make it work with when function is declared in functions.php but does not work with function defined in plugin file.               if ( ! wp_next_scheduled( 'xls_func_hook1' ) ) {       wp_schedule_event( time(), 'hourly', 'xls_func_hook1' );     }          add_action( 'xls_func_hook1', 'sendxls1' ); //senxls1 is a function in functions.php     if ( ! wp_next_scheduled( 'xls_func_hook2' ) ) {            wp_schedule_event( time(), 'hourly', 'xls_func_hook2' );     }     add_action( 'xls_func_hook2', 'export2excel' );      The full code is at Here


title: URL and Site title outputting on Login page

text: After the body tag, Wordpress is outputting the site url & site name in the Login page (wp-login.php). I think do_action( 'login_head' ); is responsible somehow but not sure how to modify this without touching the core file. **Update** While browsing through the functions.php file, i discovered the code below and there where filters echoing the problematic text. Commented the echos out and woohoo. Done               if ( !function_exists( 'jh_wp_login_url' ) ) {     function jh_wp_login_url() {         //echo home_url();     }      } add_filter('login_headerurl', 'jh_wp_login_url');               if ( !function_exists( 'jh_wp_login_title' ) ) {     function jh_wp_login_title() {         //echo get_option('blogname');     }      } add_filter('login_headertitle', 'jh_wp_login_title');


title: PHP Memory Limit vs. WP Memory Limit

text: I'm using TPC! Memory Usage Settings to monitor my installation's memory usage. The plugin displays 'WP Memory Limit' which I know is set by the `wp- config.php`. It also displays 'PHP Memory Limit' which I'm guessing is set by the server host in the `php.ini` This may be a dumb question, but is the 'PHP Memory Limit' the amount of memory I could possibly dedicate to 'WP Memory Limit' For instance, if I have a 'PHP memory limit' of `1000MB`, can I (should I) set my wp memory limit to `1000MB` Any insight or helpful articles would be greatly appreciated. Sidenote: The site is for a big website with lots of different operations, so many (necessary) plugins are installed and many users (up to 10) can be on making edits at any time.


title: How to let people submit without logging in?

text: I'd like to let my user's post without logging in here's the script with the part that requires them to be logged in, any ideas? on by passing it to just show the post content instead?               if(is_user_logged_in()){     $post_format = '';     if(isset ($_GET['post']) && is_numeric($_GET['post'])){         $post_id = $_GET['post'];              $the_source = '';         $source_meta = meta::get_meta( $post_id , 'source' );         if(is_array($source_meta) && sizeof($source_meta) && isset($source_meta['post_source']) && trim($source_meta['post_source']) != ''){             $the_source = $source_meta['post_source'];              }


title: Order by title - but now built in wordpress func, sort the_title

text: I've got a pretty simple WP installation, where I use qtranslate plugin to keep site in two languages. The problem is, I need to sort posts by title, and as probably you know (as you use qtranslate), that causes the problem - it sorts posts by mysql entries (which are two because of languages), and that gives me unwanted order (from the first language). What I want to do, is get the first letter of evert post and sort it by this, in php, do you think it is good solution? If so, how to do this best way?               <?php query_posts( array ( 'category_name' => 'publishers', 'orderby' => 'title', 'order' => 'ASC' ) ); ?>


title: After enable multisite enviroment in wordpress site creation wizard not working

text: After enable multisite environment in wordpress site creation wizard not working. If I am installing Site Creation Wizard (Wordpress Plugin) **without enable multisite** there seems option "Create new site" in dashboard. But If I install that plugin after I enabled multisite, the "Create New Site" option does not seems to be on the dashboard any longer. What can be the reason?


title: Does meta_value (array) work with 'orderby'?

text: My goal here is to query posts by a meta_key, with the values falling in between 1-100. When pulled, it is suppose to be ordered by ascending starting from 1 to 100.               $post = array(         'posts_per_page' => 10,         'post_type' => 'post',         'tax_query' => array(             'taxonomy' => 'category',             'field' => 'slug',             'terms' => 'category-1'         ),         'meta_query' => array(             'meta_key' => 'custom-key',              'meta_value' => array(1,100),             'meta_compare' => 'BETWEEN'         ),         'order' => 'ASC',         'orderby' => 'meta_value_num',     );      When looking at the page, it works of getting posts w/ meta-values '1-100', but it is not ordering correctly. It looks random (i.e. 1, 21, 5, 20, 6, 7, 8 , 3, 9, 19) saying in this order even when the page is constantly refreshed. Any help will be appreciated. Thanks!


title: Why cant I change the text on this theme?

text: I am a noob at website creation, and I have only recently begun to use wordpress. I looked at a bunch of demos online and they have helped, but I a seemingly simple problem. My problem is that I am using the (free) theme from here and I cannot for the life of me figure out how to change the text inside that blue image. I want to remove "A bold big slider" and the sentence underneath it. But how do I do that?? Its becoming frustrating. Thanks for any help.


title: How to install Wordpress theme and configure it?

text: how to add and configure wordpress theme?can any one help me out with it please? I installed wamp server,and now I don't know what to do?


title: Why is a post different than a page with regard to custom fields?

text: I'm sure the flavor of this question has been beat to death, but why is it that I can add custom fields to pages and other custom page types, but when it comes to posts, the only info I find online is that I have to use a plugin? What's so different about a post from a page that I can't add custom fields to the template directly? I want to create a custom post format so that I can have external authors login and create their own posts and still maintain the overall format of the blog.


title: Easy WordPress theme creation tutorial?

text: I've been looking for a truly simple wordpress theme creation tutorial and haven't been able to find one. I'm specifically looking for something with sample code, a basic introduction to the syntax, and a list of all the wordpress-specific functions and variables and what they are.


title: How do I link directly to uploaded files?

text: I have uploaded some files (images) which I'd like to link in my own site as well as other places, but usually I try to host a different resolution of the same image to show up on other sites. My problem with wordpress right now is that if I upload the file to Wordpress' upload directory through FTP, I don't see the file show up in my media (in WP-admin). I can get a link from my ftp client (cyberDuck) but it doesn't actually link me to a working link, also the link is something like this:               http://ftp.mydomain.com/really-link-file-name-with-20%-and-at-the-end-its.jpg      So I assume it works like that b/c it contains jpg at the end but it doesn't work and takes me to a 404 page. Any ideas of how I can go about uploading through an FTP client and get those files to show up on wordpress and also link correctly?


title: Facebook Comments not working in Wordpress

text: I'm using Facebook Comments plugin, I contacted the developer of the plugin and he is saying it's a Facebook app issue. I made sure my application ids matched, but I'm still having the issue. See it here: http://kimpercivalblog.com at the bottom of the posts. Thanks in advance!!


title: import a latest vimeo user video into a page

text: A user has many video on vimeo website. I want to display the latest video in a page from that videos. How will I do this? I used the vimeo channel gallery plugin and set the maxitems to 1 and it displays the latest video but the problem is that it also displaying the thumbnail of the video under the video player on the page. Any one who have some idea how will I do this?


title: Wordpress subdomain mapping/"archiving"

text: > **Possible Duplicate:**   >  subdomain archiving Pretty much a complete noob when it comes to this topic, so forgive any ignorance. I'm looking for a way in which my client can easily "archive" a WordPress conference site, by year, to subdomains. In other words: The site will be set up at http://www.domain.com for the client's 2011 conference. In 2012, the client will use the same templates to set up their 2012 site, but before they do that, they'll want to archive the 2011 site to 2011.domain.com. As an example, check out the evoconference site. They have their 2010 site linked to from their current 2011 site, and clicking on it brings you to a 2010.evoconference.com. Is there a way I can set this up via WordPress multisite? I know I can set up 2011.domain.com, but how can I make it easy for my client to transfer http://www.domain.com to 2011.domain.com, once they are ready to implement the 2012 site?


title: Getting archive pages in WP's AJAX internal link finder?

text: I often need to link to custom taxonomy term archive pages and would love to be able to do so through the AJAX internal link navigator added to the visual editor in 3.1. Is there any way to get this functionality, with either with a plugin or non-colossal changes to the core?


title: Getting WPTouch and W3 Total Cache to Work Together

text: I cannot get WPTouch to work with W3 Total Cache. WPTouch admits that there is a known issue with the two, and they send you to a tutorial. The tutorial is out of date, however, and does not work for me. Does anyone have WPTouch working with W3 Total Cache? If so, can you give some directions/instructions?


title: Excerpt Problems

text:
On a theme I'm working on I want a div which expands to 100% height of the outer div (which I will put around the thumbnail). The purpose of this is to move text further to the right to be aligned as a block paragraph and not wrap around the thumbnail. I would use padding but I want the excerpt's text to be aligned to the left when there isn't an image. I have tried this a couple times to no avail. Suggestions? Take a look: http://themeforward.com/demo2/page/2/ If I use an else statement ( http://codex.wordpress.org/Function_Reference/has_post_thumbnail ) I would need to add the entire excerpt in it and that seems sloppy. My code:               <?php get_header(); ?>

               <?php while (have_posts()) : the_post(); ?>

         <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                  <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         By <?php the_author_posts_link( ); ?> | <?php the_time('F j, Y'); ?> | <?php comments_number( 'No comments', 'One comment', '% comments' ); ?>         <?php the_excerpt(); ?>

          <?php endwhile; ?>

<?php next_posts_link('« Older') ?>

<?php previous_posts_link ('Newer »') ?>

     <?php get_sidebar(); ?>

     <?php get_footer(); ?>


title: Custom Post Type permalink shows wrong page: homepage/index.php

text: Hello I am working on a project where I need to have custom post types. Creating the post types and making them show up in my admin menu was a walk in the park using the following:               add_action( 'init', 'create_post_type' );          function create_post_type() {         register_post_type( 'Portfolio',             array(                 'supports' => array('title', 'editor', 'thumbnail','excerpt'),                  'labels' => array(                     'name' => __( 'Portfolio' ),                     'singular_name' => __( 'Portfolio' ),                                 ),             'taxonomies' => array('category', 'post_tag'),              'public' => true,             'has_archive' => true,             )         );      I have created a number of custom posts and all of them get their own perma link.               http://www.mydomain.com/subdomain/?p=123      Resulting in               http://www.mydomain.com/subdomain/?custom-post-type=post-title      However whenever I view **this permalink** it **loads my index.php** file instead of the custom post belonging to this link. The **same happens** when I try to load `http://www.mydomain.com/subdomain/custom-post-type` to access the **archive** page: it **loads my index.php** file. I already tried the following:   * Visiting the permalink setting within wordpress   * Deleting all pages with slug in common width my custom pages   * Deleting all categories with name in common with my custom pages leads:   * I have **no custom taxonomy** as far as i know. So I did not register any. I only have a custom meta box with radio buttons being saved to the post meta   * I called: `require_once(ABSPATH .'wp-includes/pluggable.php');` to solve an issue with the post meta conclusion: I did all this without success. Have been looking for a solution for more than a day now. So i guess it's time to call in the reinforcements. Does anyone have a clue how to solve this and save my day? Thanks in advance!


title: If Post Type equals, then display X content

text: I just need to say in single.php if post type = x then display y. Else, don't display it.


title: Giving the_excerpt in the place of the_content?

text: Short and sweet -- I wanted to deliver up the excerpt of a post in the place of `the_content` on certain pages. Naturally, if no excerpt is present one would be generated from the content. I understand I can just go in and edit the theme files, but I'd like a less-invasive method. Seeing how something like the following works:               add_action( 'the_content', 'myFunc' );     function myFunc ( $content ) {       the_title();     }      I thought I would try this               add_action( 'the_content', 'myFunc' );     function myFunc ( $content ) {       the_excerpt();     }      This. Fails. Gloriously. It results in a fatal error, actually: > FATAL ERROR: MAXIMUM FUNCTION NESTING LEVEL OF '100' REACHED, ABORTING! IN > C:\WAMP\WWW\WORDPRESS\WP-INCLUDES\POST.PHP ON LINE 555 This is followed by a massive call stack, which appears to have been set into a mad frenzy of recursive calls. **Turning the Tables** So this got me curious, and I tried the opposite. Deliver `the_content` in the place of `the_excerpt`:               add_action( 'the_excerpt', 'myFunc' );     function myFunc ( $content ) {       the_content();     }      This, to my surprise, worked just fine. So what I'm gathering is that `the_excerpt` calls `the_content`, but `the_content` doesn't call `the_excerpt` \- this would certainly explain the fact that it works one way, but the other seems to be set off in a massive fit of recursion. Not being very familiar with the inner-workings of these two function, I was curious what the community here could provide in way of insight. What's the problem with hooking into `the_content` and calling `the_excerpt`? How can I achieve this effect if not by calling `the_content` directly? I understand that I could provide my own custom excerpt logic, but this would de-normalize the excerpt logic in my site, meaning I'd have some excerpts being created via custom code in the functions.php, and others created via the internal methods of WordPress - ideally, I would avoid this and use only the internal methods if possible.


title: How to alter the text of the post "Excerpt" box label in WordPress post editor?

text: My theme gives the site owner the option of using each post's "Excerpt" field to fill in the "meta description" tag for each page. It would be helpful if I can filter the text label and description text that appears on the default Excerpt input control when viewed inside the post editor. Does a filter or hook exist for this? Alternately, I suppose I could use jQuery to do something via the DOM.


title: Create post from form with image

text:
I found this wonderdul script that @Bainternet here at Wordpress Answers created, that makes it possible to attach images into posts from a html form.. I tried to combine in into my "html form to post" script.. I does create a post as draft in the backend.. but the image does not show up, and it doesn't show in "media" .. This is @Bainternet script/answer, Submit post and upload image from front-end This is mine,               <?php                if(isset($_POST['new_post']) == '1') {     $post_title = $_POST['post_title'];     $post_category = 'fashion';     $post_content = $_POST['post_content'];          $new_post = array(           'ID' => '',           'post_author' => $user->ID,            'post_category' => array($post_category),           'post_content' => $post_content,           'post_title' => $post_title,           'post_status' => 'draft'         );          $post_id = wp_insert_post($new_post);                       if (!function_exists('wp_generate_attachment_metadata')){                 require_once(ABSPATH . "wp-admin" . '/includes/image.php');                 require_once(ABSPATH . "wp-admin" . '/includes/file.php');                 require_once(ABSPATH . "wp-admin" . '/includes/media.php');             }              if ($_FILES) {                 foreach ($_FILES as $file => $array) {                     if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {                         return "upload error : " . $_FILES[$file]['error'];                     }                     $attach_id = media_handle_upload( $file, $post_id );                 }                }             if ($attach_id > 0){                 //and if you want to set that image as Post  then use:                 update_post_meta($post_id,'_thumbnail_id',$attach_id);             }               // This will redirect you to the newly created post     $post = get_post($post_id);     wp_redirect( 'http://domain.com' );     }           ?>                <form method="post" action="">      <input type="text" name="post_title" size="45" id="input-title" value="heading"/>
     <input type="text" name="post_url" size="45" id="input-url" value="Url"/>
     <input type="file" name="thumbnail" id="thumbnail">
     <textarea rows="5" name="post_content" cols="66" id="text-desc"></textarea>
     <input type="hidden" name="new_post" value="1"/>
     <input class="subput round" type="submit" name="submit" value="Post"/>
     </form>


title: Menu limit, cannot add new menu items

text: I'm running WP 3.4.2 on a VPS. When I first moved to this VPS server and imported all my WP data from the old, the menus worked fine. However, for some reason, I cannot edit/add to the menus, and some items have been deleted. No matter how many times I try to re-add those items, they won't appear. WP does not report any errors. When I add them again, and click the "Save Menu" button, after a long pause (30-45 sec) WP simply says, "The Main Menu menu has been updated." But the new items are missing, both from the site menus and from the WP menus setup. Originally when I first moved to this VPS there were 9 menu top-level items, about about 90 submenu items -- about 100 menu items total. Everything displayed correctly. Now I am limited to 88 menu items. I can only add a menu item by deleting another. I'm not sure when this problem started, because we don't edit the menu often. It was noticed for the first time yesterday that some menu items had disappeared, which may coincide with someone adding or editing a menu item. But we've been running on this new VPS for about a month. I found in another forum discussion a reference to suhosin which can cause menu limit problems in WP 3.x, but that is not part of our PHP installation. I've tried Safari and Firefox (OS X). Same results with both.


title: Filter by custom Field for Custom post type Admin Listing

text: I have a custom post type "Article" which has a custom field "issue" that is the id number of a "issue" post type that i am selecting using a simple select box. I want to add a drop down of issues to filter the article listing found here:               edit.php?post_type=article      Is this possible? Is this sort of thing documented anywhere? I have not been able to find documentation or examples. what hooks are there to filter lists & add selects to the filter controls?


title: Saving jQuery UI Sortable on Wordpress

text:
I am building a sortable list and need it to save the order to my wordpress database. I looked at this answer and it's helped but I am still getting an error. (It's a blank alert box) I think that I am missing something with the following but don't know where to put it:               $args= array(     'meta_key' => 'c3m_shown_on',     'meta_value'=> 'home'     'orderby' => 'menu_order',     'order' => 'ASC'      );           $box_query = new WP_Query($args);      Thanks for the help! I am using Wordpress Multisite - Version 3.8.1. Below is all of my code: The HTML:

Tab One

Tab Two

Feeds

Lorem ipsum dolor sit amet, consectetuer adipiscing elit

News

Lorem ipsum dolor sit amet, consectetuer adipiscing elit

Shopping

Lorem ipsum dolor sit amet, consectetuer adipiscing elit

Shopping

Lorem ipsum dolor sit amet, consectetuer adipiscing elit

      The jQuery (Sortable works perfectly):                   $( ".column" ).sortable({            connectWith: ".column",            handle: ".portlet-header",            cancel: ".portlet-toggle",            placeholder: "portlet-placeholder ui-corner-all",         });         $( ".portlet" )            .addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )            .find( ".portlet-header" )            .addClass( "ui-widget-header ui-corner-all" )            .prepend( " ");         $( ".portlet-header" ).click(function() {         var icon = $( this );             icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" );             icon.closest( ".portlet" ).find( ".portlet-content" ).toggle();          });               var $tabs = $( "#tabs" ).tabs();      And the part that doesn't work:                   $('#loading-animation').hide();                   var itemList = $(".column");          itemList.sortable({             update: function(event, ui) {              $('#loading-animation').show(); // Show the animate loading gif while waiting                  opts = {                 url:  'http://mywebsite.com/wp-admin/admin-ajax.php', // ajaxurl is defined by WordPress and points to /wp-admin/admin-ajax.php                 type: 'POST',                 async: true,                 cache: false,                 dataType: 'json',                 data:{                     action: 'item_sort', // Tell WordPress how to handle this ajax request                     order: itemList.sortable('toArray').toString() // Passes ID's of list items in  1,3,2 format                 },                 success: function(response) {                     $('#loading-animation').hide(); // Hide the loading animation                     alert('It Worked!!');                     return;                  },                 error: function(xhr,textStatus,e) {  // This can be expanded to provide more information                     alert(e);                      alert('There was an error saving the updates');                     $('#loading-animation').hide(); // Hide the loading animation                     return;                  }             };             $.ajax(opts);         }     });       And the functions part:                   function my_save_item_order() {         global $wpdb;                $order = explode(',', $_POST['order']);           $counter = 0;              foreach ($order as $item_id) {              $wpdb->update($wpdb->posts, array( 'menu_order' => $counter ), array( 'ID' => $item_id) );              $counter++;                }              die(1);             }         add_action('wp_ajax_item_sort', 'my_save_item_order');         add_action('wp_ajax_nopriv_item_sort', 'my_save_item_order');      Thanks for helping ... and thanks for the initial code Somatic


title: Jetpack button location buffering

text: Is there a simple way to add a buffer or spacing to the location of the Jetpack social icons to move it further to the right of its default location when placed at the top of a page? I want to add a buffer of about 8 spaces to make it line up with the image on my opening page so it looks cleaner.


title: wp_signon returns user but the user is not logged in because wp installed on subdomain. How to make it work?

text: I am using the WordPress API to get the user login. My code:               <?php     define('WP_USE_THEMES', false);     require('wp-blog-header.php');          $creds = array();     $creds['user_login'] = 'user';     $creds['user_password'] = 'password';     $creds['remember'] = true;     $user = wp_signon( $creds, false);     if ( is_wp_error($user) )        echo $user->get_error_message();          $cookie = wp_set_auth_cookie($user->ID); ?>      these codes are working on my main domain `www.mydomain.com` but i installed wordpress on `blog.mydomain.com` I think there is a cookie problem. I tested the codes above on subdomain and i got _user logged in_. So how can i solve the problem? P.s : there isnt problem with including "wp-blog-header.php"


title: Specifying Class style for Menu

text:
Im integrating Superfish into WP. I have called the CSS and the JS. However when I place a class style in the `wp_menu` as below, the menu is disappearing (see here for rendered output). Could anyone assist (this has been followed from a not so helpful tutorial) Current code being generated is:

Home

    test 1

test 2

test 3

Test Page

      Inside my header is the below:-               <?php     wp_nav_menu( array(     'theme_location' => 'primary',     'container_class' => 'menudiv',     'menu_class' => 'sf-menu'     ) );     ?>


title: Archive with specific keyword by category sorted by date

text: I need help to create a template for an archive with specific a keyword by category sorted by date. This is the code for my archive page so far: http://pastebin.com/WEjNGhJ1 My client wants every navigation menu item to go to an archive page for that particular keyword. Example: "Beauty" navigation location will display the beauty category's posts, sorted by date, using the archive page format. My navigation menu is in the sidebar which you can see here on my site: http://dev.freelanceu.net/mjl/livelong


title: Custom taxonomy and post type rewrite rules

text: I'm working on portfolio site, where I need to create a "portfolio" post type and divide posts in it by categories with urls like "/portfolio/category/", so the "category" is the category term. /portfolio/ - custom post type "portfolio" /portfolio/category/ - custom taxonomy "portfolio_category", related to "portfolio" type. /portfolio/post/ - post of the "portfolio" custom post type. What is the best way to make this url structure?


title: This jQuery snippet doesn't seem to work with Wordpress

text: I'm not really that much of a jQuery aficionado so I'm not really sure why this little jQuery modal lightbox snippet isn't working. Am I missing any kind of WP specific code? I'm enqueueing the script in the header if that helps               $(window).load(function(){         var lightBox = $('#lightbox'),         lightBoxContent = $('#lb-content');         var positionLightbox = function() {             var veiwWidth = $(window).width(),             lbContentMargin = (veiwWidth / 2) - 148,             lbContent = $('#lb-content');             lbContent.css({                 'left' : lbContentMargin,                 'top' : $(window).scrollTop() + 50 + 'px'             });         };              $('.modal-trigger').click(function() {             lightBox.fadeIn(function() {             lightBoxContent.show();         });         positionLightbox();         });         $('#lb-close').click(function() {             lightBox.hide();             lightBoxContent.hide();         });     });


title: Site not loading after trying to give wordpress its own directory

text: I have followed these instructions http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory 100s of times and never had a problem. Now I am trying to remove the /wordpress from the URL again while keeping the actual site in the wordpress directory, using these same i instructions but it just is not working. Instead, it has removed all pages and posts from the /wordpress url (saying oops, page not found)and the domain without /wordpress is still not working. here the links: theomrevolution.co.za/wordpress theomrevolution.co.za -I have changed the site URL in settings, copied the htacces and index.php to the root directory, changed the last line in index.php to include the wordpress directory, logged back in and refreshed the permalinks. Do I have to do a search and replace all theomrecolution.co.za/wordpress for theomrevolution.co.za in the database? I did not have to do that for any of my other wordpress sites when i removed /wordpress... ANy help and advice appreciated!!!


title: Plugin conflicting with navigation JS

text: I've just begun learning JS so I'm having difficulty solving this issue. The navigation on a page using the "Wordpress Auto Gallery With Expanding Preview" plugin has stopped working. It's definitely that plugin. When I look at the Console in Dev Tools, I see this error: > _**Uncaught TypeError: Object [object Object] has no method 'hoverIntent'_** I hard-coded the JS files for the `<nav>` in the header to get it to work. Here's the link. How to solve this?


title: WordPress two sidebar layout or theme

text: I am new in WordPress. I was working with Drupal for some days, before. Now, I am interested on WordPress. So, I am trying to learn it. My problem is, in WordPress I did not find any two sidebar theme or layout. I saw, WordPress always has one sidebar ( **left or right** ), which lies inside `<aside>` tag. But, in Drupal there are 2 sidebars ( **sidebar-left** , **sidebar-right** ). But, A user or developer always has an option to choose from those, one or two sidebar he need. Is it possible to get any theme, which can help me to make a two sidebar theme? Any blank theme also will be OK. I got one blank theme called Blank Slate, which is just awesome. But problem is, it has only one side bar. In short, for my project, I need a 2 sidebar blank theme. Is it possible to get? Thanks, in advance.


title: Change taxonomy of posts

text: I am using Lamoon theme for my website. It has several custom taxonomies. I have a lot of posts in taxonomy "rooms" but I'm going to change theme to 'Avada'. So I'm worried about my "rooms" how this taxonomy will behave in the new theme?


title: How to Split loop in multiple column in archive page

text:
hi i got this code from a post, i want to split loop into 4 column this is a archive page i want to limit 1 post in first column 1 post in second column 4 posts in third column 5 post in fourth column see i want to make like this http://demos.gabfirethemes.com/wp- newspaper/category/finance/ here are 3 column in archive page please guide me - - here are the code
     <?php while(have_posts()) : ?>     <?php     $postcount++;     if( ($postcount % 2) == 0 ) : // skip 'even' posts     $wp_query->next_post();     else :     ?>     <?php the_post(); ?>          <a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
             <?php endif; ?>     <?php endwhile; ?>
          <?php $postcount = 0; rewind_posts(); ?>
     <?php while(have_posts()) : ?>     <?php     $postcount++;     if( ($postcount % 2) != 0 ) : // skip 'odd' posts     $wp_query->next_post();     else :     ?>     <?php the_post(); ?>           <a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
             <?php endif; ?>     <?php endwhile; ?>
          <?php $postcount = 0; rewind_posts(); ?>
     <?php while(have_posts()) : ?>     <?php     $postcount++;     if( ($postcount % 2) != 0 ) : // skip 'odd' posts     $wp_query->next_post();     else :     ?>     <?php the_post(); ?>          <a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
             <?php endif; ?>     <?php endwhile; ?>
          <?php $postcount = 0; rewind_posts(); ?>
     <?php while(have_posts()) : ?>     <?php     $postcount++;     if( ($postcount % 2) != 0 ) : // skip 'odd' posts     $wp_query->next_post();     else :     ?>     <?php the_post(); ?>           <a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
             <?php endif; ?>     <?php endwhile; ?>


title: Get page ID of page that is set as the posts page

text: In WordPress settings you can set a page as the `Posts Page`. This can be found:               WP-Admin->Settings->Reading Settings->Front page displays      ![Front page displays settings](http://i.stack.imgur.com/NVWG3.png) How do I retrieve the page ID that is set in this setting?


title: List Wordpress Post and Related Attachments outside of a post page

text:
I've been having difficulties with some new functionality I've been trying to create. Basically I have a custom page setup that displays a list of all posts with a specific tag. What it needs to do is also display each attachment associated with that post, beside the post name. I can get this working on the actual post page, but since this is a custom page it doesn't want to display the attachment url. Here is what I have so far:               $args = array          (             'post_type' => 'attachment',             'post_mime_type' => 'audio',             'numberposts' => -1,         );              query_posts('portfolio-tags=apple&post_type=portfolio&posts_per_page=-1&orderby=title&order=asc'); // query to show all posts independant from what is in the center;         if (have_posts()) :             echo '
';             while (have_posts()) : the_post(); ?>
                     <?php echo the_title();?>                     <a href="<?php echo get_attachment_url($attachment->ID);?>" target="_blank">Demo
             <?php  endwhile;             echo '
';         endif;         wp_reset_query();      Any help would be greatly appreciated. I've been stuck on this for a while now and hope I'm just overlooking a very simple solution.


title: When calling wp_title(), do you have to create some kind of "title.php" file?

text: ... or does `wp_title()` already handle the various contexts in your blog? This could clarify for me how I can achieve a reusable `index.php` file without having all the conditional statements inside it to handle the different title formats in the given context (page, single, posts, search, archive, date, etc...) Also, Could a specific post or page have a special custom formatting without breaking the rest of the use-cases? ( _If this needs to be in a separate question, please let me know - it's closely tied to this question so I figured I'd merge it in here for now_ ).


title: Cant' Grab WordPress Built-in Posts Through Loop

text:
Using WordPress 3.7.1 I am trying to display all Regular Post on my created page lest say TestPage. Here are the steps I took to do this: **1-** Generate a Custom Page Template called:Test Page and loaded by following code   **2-** Generate a Page Called TestPage based on Test Page Template after updating the page I am not getting any of Post on the page while I have already generated some!               <?php     /*     Template Name: Test Page     */     ?>     <?php get_header(); ?>          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_title() ;?>
           <?php the_content(); ?>     <?php endwhile; else: ?>
Sorry, this page does not exist
     <?php endif; ?>          <?php get_footer(); ?>      he abouve code actually is loading the page whit title and content of the TestPage and not by Posts!Can you please let me know why this is happening?


title: search using multiple taxonomies and keyword

text:
I have made six custom taxonomies. I want to perform search using keyword and custom taxonomy in wordpress For eg: I want to have a dropdown with only four custom taxonomies(not all 6) and then filter the search based on the keyword and the custom taxonoy selected by me. In searchform.php, I pasted the code               <form method="get"  class="search-form" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">         <fieldset>             Search:             <select id="search" class="select" title="Whole Site" name="cat">                     <option value="news">News Articles</option>                     <option value="publications">Publications</option>                     <option value="professionals">Professionals</option>                     <option value="company">Company</option>             </select>
                 <input type="text" placeholder="Enter keyword..." class="text" name="s" id="s">                   <button type="submit" name="submit" class="submit">Search</button>
         </fieldset>     </form>      then in search.php , I retrieved the select value as `$category_index=$_REQUEST['cat']; $ss=$_REQUEST['s'];` Further, I do not know how to filter.


title: How to add a list of all galleries to my sidebar?

text: I'm using Wordpress 3.3.1 and trying to figure out how I can modify my sidebar to include a list of all the galleries. I see wp_get_posts and the like...but nothing for galleries?


title: Redirect one of two domains on one Wordpress installation

text: I have to domains: mydomain.dk and mydomain.de. Both are showing the same page in danish. I have a plugin that takes care of the languages, but I need to connect the .de domain to the german 'language layer'. How can I redirect mydomain.de to mydomain.dk/?lang=de. The mydomain.dk must stay as it is. Thanks in advance!


title: Adding general page content to page templates

text: If I'm creating a page template, let's say for example one for a testimonials custom post type I've created, I think I have it figured out that if I do the following in page-testimonials.php:                   <?php get_template_part('loop', 'page'); ?>         <?php get_template_part('loop', 'testimonials'); ?>      Then that will output the content of the page itself and then go into the testimonials loop to grab a list of the most recent testimonials, etc. I'm having trouble doing the same for a page that is called from WP Settings as the "Posts Page". Let's say at the top of the "Blog" page (a WordPress page), I want some intro text to the blog that says, "Welcome to the blog. Please check out new posts below." Instead of hardcoding that into the template, how would that be achieved? Am I even thinking of how actual page content is displayed depending on if a custom page template is chosen? Thanks!


title: How can we see which posts don't have a featured image or it doesn't exist anymore?

text: Which plugin or code I need to make it show me a list with the posts that don't have featured image or is broken(the featured image doesn't exist anymore)?


title: How to display my uploaded video playlist

text:
I'm trying to display my uploaded video playlist using WP 3.9. I have created a template where I have the logic to display an image gallery and the video playlist, this is what I currently have:               <?php if(have_posts()) : while(have_posts()) : the_post(); ?>                         <?php $hasGallery = has_post_gallery(); ?>                              <?php if($hasGallery || get_post_header()) : ?>                         <article class="post<?php if($hasGallery) echo ' post-gallery'; ?>">                                                              <?php                                                                        echo do_gallery_shortcode($post->post_content);                                 ?>                                                                <?php elseif(!$hasGallery) : ?>
                                 <?php                                    $attr = array(                                         'src'      => esc_url(get_field( 'playlist' )),                                         'loop'     => '',                                         'autoplay' => '',                                         'preload' => 'none'                                 );                                   wp_video_shortcode( $attr ) ?>                                    <?php endif; ?>                              As you can see I'm using "custom fields" plugin, and obviouly is not working. The shortcode that I currently seeing is as follows:               [playlist type="video" ids="221227"]      So, my question is how can I display my video playlist from my template.


title: WP_Query order custom post type with certain meta key value by post modified date

text: I have this query to show custom post type "property", and it works really well but the "orderby" statement, that is completely ignored...               $args = array(         'post_type' => CUSTOM_POST_TYPE1,         'post_status' => 'publish',         'meta_key' => 'estado',         'meta_value' => 'Activa',         'orderby'=> 'modified',         'order' => 'DESC',         'paged' => $paged,         'posts_per_page' => $posts_per_page,         'tax_query' => array(             array(                 'taxonomy' => 'pcategory',                 'field'    => 'slug',                 'terms'    => $current_term->slug             )         )     );         $my_query = new WP_Query($args);      This is the SQL resulting from `WP_Query() "$my_query->request"`               SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID        FROM wp_posts         INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)        INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)      WHERE 1=1       AND ( wp_term_relationships.term_taxonomy_id IN (28) )      AND wp_posts.post_type = 'propiedades'      AND (wp_posts.post_status = 'publish')      AND ( (wp_postmeta.meta_key = 'estado' AND CAST(wp_postmeta.meta_value AS CHAR) = 'Activa') )      GROUP BY wp_posts.ID      ORDER BY (select wp_postmeta.meta_value from wp_postmeta where wp_postmeta.post_id=wp_posts.ID and wp_postmeta.meta_key = 'featured_c')     ASC,post_date DESC LIMIT 0, 6      Is it possible to sort by "post_modified" custom post field?


title: Do the permalink settings apply to pages as well as posts?

text: I want to have all my blog posts have the structure http://mysite/blog/blogarticle1 but I want the pages to have the structure http://mysite/page1 (no "blog" in there). I see how to include "blog" in the permalink settings but I'm not sure if those settings apply to the pages as well (which I don't want). Please advise. Thanks!! :-)


title: Using WP_Query - how to display something IF there are no results

text: I've used WP_Query to query and display events. In some cases, though, there are no events to be displayed and I'd like to display a friendly message when that happens instead of displaying nothing - but I'm not sure how to do this. If it was a mysql query I know I could use if(mysql_num_rows($result)==0) but I don't think that works with WP_Query. Is there something else that will work? Thanks very much for any help you can give me.   Sarah


title: How to sort posts in a custom post type by title in ascending order by default?

text: So I am using a custom post type to create a listing of businesses. Each post made, contains information about each business. The title of each post is the name of the business. When I go to the menu created by the custom post type, I receive a standard listing of posts. (or in this particular case, a listing of business names). The posts show in a random order (or possibly being sorted by date on default?) How can I allow for my posts to be listed in alphabetical ascending order by default?


title: Comment Blacklist

text: I have a list of words that I placed in my blacklist_key option values `update_option( 'blacklist_keys', $words);`. But I still can make a comment with such words. Any ideas? I can't answer my question yet, so here it is. There is no clean way to do this. You have to use a multiline string such that:               $words = 'word1               word2               word3';


I am using the news Ticker plugin http://wordpress.org/extend/plugins/news- ticker It shows an error jQuery('#news-ticker').cycle is not a function. In IE It throws an error Dom Element Does not Exist!. How to resolve this error. Thanks.


title: How can I hard code my sidebar?

text: I am building a child theme based on Thematic. Rather than use widgets, I would like to hard code my sidebar but I can't figure out how to do this. Any help appreciated! Thanks


title: add short code not working

text: I am new to wordpress, I am creating a plugin and for the short code, I am using the short code api. But when I insert this shortcode in my page, it displayes as it is, it does not display the required output. Can asny body tell me what i am doing wrong? Am I calling or creating the function on right place or not? Below is my code               function show_review() {     echo "this is a review form";     }     add_shortcode('urp_review', 'show_review');      I have created the file named as urp_functions.php in my plugin directory and created the above function. Any help will be appreciated


title: Is it possible to use WordPress functions in a page template?

text: When a user enters a page I want to check if he is logged in. How can it be done in the page's template? Or is it possible only in functions.php or a plugin?


title: plugin to organize data

text: I am currently converting this page into a wordpress site. Now as you can see on the page I linked to, I need some sort of way to organize the data on the site. I have already looked for a plugin for the job but I can´t find the right thing. can someone suggest a plugin that could do the job? things that the plugin should do:   * let the admin add more data into pre defined fields through backend   * add the new data into the appropriate position on the site (sort alphabetic by name)   * alpha index at the top to quickly jump to desired letter in alphabet


title: Force PDF download from custom menu?

text: I added a link to a PDF in my custom navigation menu. Is there a way to force it to download instead of open?


title: What's the difference between "get_posts" and "wp_get_recent_posts" when used with "setup_postdata"?

text: This might be a completely "I'm still new to WP" type question, but I ran into some interesting output when using `get_posts()` and `wp_get_recent_posts()` in a custom function I wrote with `setup_postdata()`. Here's what I had in my _functions.php_ file:               <?php     function getRecentPosts($total_posts = 2)     {         $total_posts = intval($total_posts);         global $post;              $args = array(             'posts_per_page' => $total_posts,             'post_type'      => 'post',             'post_status'    => 'publish'         );         $posts = get_posts($args);              foreach ($posts as $post)         {             setup_postdata($post);             echo '<div>';                 the_title();             echo '</div>';         }         wp_reset_postdata();     }      Simple, right? And that function works great, throwing out title's inside `div` tags perfectly. But when I replace lines 7-12 with the following:                   ...         $args = array(             'posts_per_page' => $total_posts,             //'post_type'    => 'post',             'post_status'    => 'publish'         );         $posts = wp_get_recent_posts($args);         ...      ...then the function doesn't seem to "iterate" through the posts correctly, throwing out the first post it finds' title over and over, much like if you don't use `global $post` at the beginning of the function. Why is this? Is there something different that `wp_get_recent_posts()` does that I do not yet understand.


title: How to let a single post have its own domain name

text: I am not sure which solution here would work best as a solution but what I am looking for is just a simple way to enter an optional domain through a metabox on the page edit screen and then just select a template from the default page templates wordpress uses. I am assuming there must be a simple way to accomplish this by manually adding an A name record for the new domain and pointing it to the same IP the main website is using and then through some code allow requests to this new domain to load a specific post ID while utilizing the specific page template you selected. I would like for the page to be accessible for both domains and just the new domain would utilize the defined template. How can this be done? _updated_ I guess the other way would be to first setup a single page so it can have its own subdomain by using some built in wordpress code used for multisite? In other words, if a custom subdomain could be assigned to a specific post id then a cname record to this subdomain could be set for the new domain... Not sure the best way to accomplish this.


title: Default menu editor with automatic page list

text: How can I add a page to the menu and define for the menu item that all subpages should be included by means of a simple checkbox?


title: is it good to use Wordpress in the same url extension in terms of seo?

text: i have got a website and i want to add a Wordpress blog to it for additional (fresh) content and of course, better SEO. i'm new to Wordpress but i found out that the pages created by it are stored in the database so it's almost impossible to link to any of those pages, so it's confusing for me because i don't know that when Google crawls my domain will it also crawl database- stored wordpress pages and if it does, is this any good for SEO ranking of my whole site? i just wanna know using the wordpress blog like "www.website.com/en/blog" will have the same SEO impact as making a blog using Dreamweaver, which has separate HTML pages that can be linked to. (apart from marking-up content) Thanks


title: How can I make all subcategories use the template of its category parent?

text: (Satisfying minimum text requirement)


title: PHP dynamical conditional post display

text:
I'm trying to get the WordPress loop to display only the post has an ID that reflects whatever `$category_name` is equal to, as shown in the line of code below. It ends up showing everything and not the specified post.               <?php     $link=$_GET['link'];          if ($link == '1') {         $category_name= 'accomodatins';     }     if ($link == '2'){         $category_name= 'accomodatins1';     }     if ($link == '3'){         $category_name= 'accomodatins2';     }     if ($link == '4'){         $category_name= 'accomodatins3';     }     ?>      Below is the compete code               ?>

Accommodations

Accountants
 <?php
     <?php          global $link;          $link = $category_name;          // assign the variable as current category          $category_name = $link;          // concatenate the query          $args = 'category_name=' . $category_name;          // run the query          query_posts( $args );          if ( have_posts() ) :          while ( have_posts() ) : the_post();               // do something here              the_content( __('Read the rest of this page »', 'template'));              endwhile;      endif;          wp_reset_postdata();     ?>
               <?php     $link=$_GET['link'];     if ($link == '1'){         $category_name= 'accomodatins';     }     if ($link == '2'){         cat_switcher();     }     if ($link == '3'){         cat_switcher();     }     if ($link == '4'){         cat_switcher();     }     ?>


title: how do I force a single column layout in screen layout

text: I am using multipress, but users with small screens cannot access the HTML tab as the Publish meta box has a div that slides above it, disabling the ability to click it. One idea is to force a single column layout, but there are no options for this in screen options. Is there another way to do it?


title: is it legal to charge for wordpress multisite?

text: I want to create a wordpress multisite and charge my members a monthly fee to use it. Is this okay under the license agreement?


title: Notify multiple email addresses on comments

text: Can you recommend a plugin that enables notification on multiple email addresses on posted comments? Looking for a plugin that both notifies a global list of email addresses and the author of the post.


title: Cron jobs in a class

text: Having: ## pluginname.php               // If this file is called directly, abort.     if ( ! defined( 'ABSPATH' ) ) {         die();     }          define('PLUGINNAME_PLUGIN_URL', plugin_dir_url( __FILE__ ));     define('PLUGINNAME_PLUGIN_DIR', plugin_dir_path(__FILE__));          require_once( plugin_dir_path( __FILE__ ) . 'class-pluginname.php' );          // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.     register_activation_hook( __FILE__, array( 'PluginName', 'activate' ) );     register_deactivation_hook( __FILE__, array( 'PluginName', 'deactivate' ) );          PluginName::get_instance();      ## class-pluginname.php                   /**          * Initialize the plugin          *          * @since     1.0.0          */         private function __construct()         {             #add_action('init', array($this, 'widget_add_vars'));                  #add_action('params', array($this, 'catch_widget_query'));              add_action('dailyExport', array($this, '_generateJson'));                   if (!wp_next_scheduled('dailyExport')) {                  wp_schedule_event( time(), 'daily', 'dailyExport' );              }         }              /**          * Return an instance of this class.          *          * @since     1.0.0          *          * @return    object    A single instance of this class.          */         public static function get_instance()         {             // If the single instance hasn't been set, set it now.             if ( null == self::$instance )                 self::$instance = new self;                  return self::$instance;         }              /**          * Fired when the plugin is activated.          *          * @since    1.0.0          */         public static function activate()         {             self::_generateJson();             wp_schedule_event(time(), 'daily', 'dailyExport');         }              /**          * Fired when the plugin is deactivated.          *          * @since    1.0.0          */         public static function deactivate()         {             wp_clear_scheduled_hook('dailyExport');         }              public function dailyExport()         {             return self::_generateJson();         }      I was wondering, if you think that is right to define as `static` the `activate` and `deactivate` functions, and if you think that I properly work with the cron event, to schedule daily events. I wrote my plugin, based on this template https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate


title: Set a different home link in nav menu

text: I've my website with homepage link set to http://www.mysite.com. I've also many pages with subpages, and in that subpages i've already a link in the content that returns to the top level parent page. Is it also possible to set this link in the nav menu overwriting my default home link? Thanks, Stefano


title: How to restore deleted pages/posts?

text: I recently deleted some pages in my wordpress site. Now I want to re-store them. How can I do this? Any suggestions will be appreciated. Thanks in advance


title: Sidebar limiting to 10 posts?

text:
I have the following code inside my single.php page: **UPDATED CODE**                <?php if (have_posts()) : the_post();          $post_id = get_the_ID();           if ( is_single() ) {              $cats =  get_the_category();              $cat = $cats[0];      } else {              // category archives              $cat = get_category( get_query_var( 'cat' ) );      }           $cat_id = $cat->cat_ID;      $cat_name = $cat->name;      $cat_slug = $cat->slug;     ?>     <?php query_posts('cat='.$cat_id); ?>        <?php if (have_posts()) : ?>

<?php echo get_cat_name($cat_id); $theCount = 0; ?>

                <?php while (have_posts()) : the_post(); $theCount += 1; echo 'debug>' . $theCount; ?>                  <li <?php if ($post_id == get_the_ID()) {echo 'class="active"';} ?>>                     <a href="<?php the_permalink(); ?>">                       <?php the_title(); ?>
                <?php endwhile; ?>

        <?php endif; ?>     <?php endif; ?>      Problem being is that it only seems to grab the last 10 posts in that category where i know i have 16 posts for that sidebar to display. Where in the code could i find where its limiting the return values?? **UPDATE**                <?php if (have_posts()) : the_post();                                 $post_id = get_the_ID();                      if ( is_single() ) {                         $cats =  get_the_category();                         $cat = $cats[0];                 } else {                     // category archives                         $cat = get_category( get_query_var( 'cat' ) );                 }                      $cat_id = $cat->cat_ID;                 $cat_name = $cat->name;                 $cat_slug = $cat->slug;                                   $cat_query_args = array(     // Include posts from category with ID $cat_id     'cat' => $cat_id,     // Include all posts     'posts_per_page' => -1     );           $cat_query = new WP_Query( $cat_query_args );                if ( $cat_query->have_posts() )            ?>

<?php echo get_cat_name($cat_id); $theCount = 0; ?>

              <?php         while $cat_query->have_posts() : $cat_query->the_post();                  $theCount += 1; echo 'debug>' . $theCount;              ?>             <li <?php if ($post_id == get_the_ID()) {echo 'class="active"';} ?>>                 <a href="<?php the_permalink(); ?>">                     <?php the_title(); ?>
            <?php          endwhile;      ?>

     <?php           endif;           ?>                      <?php endif; ?>                      <?php wp_reset_query(); ?>


title: ajax for filtering posts by category in wordpress loops

text:
I've been looking around for a way to filter my posts on http://www.waziproject.com/wazimagazine/ without reloading the page. So my question is if anyone can help me out to turn the following into a list of filters that don't require refresh/reload of the page... I believe the following answer is the closest I can get to a solution: Using ajax on categories and wordpress loops However, I'm not sure where to implement the code. I'm using the following in my loop.php:

Business & Work

Development & Sustainability

Education

Health & Medecine

Human Rights

Law & Order

Media & Information

Nations

Political Economy

Research & Innovation

All Posts

      Now if I want to apply the coding as mentioned here - Using ajax on categories and wordpress loops \- where should I put the different code snippets and is there a lot of tweaking to be done to it? Thank you very much in advance for your help!


title: How do I make certain areas editable?

text: I'm new to wordpress and I'm currently converting an HTML/CSS site I made to wordpress to make it easier for my client to edit it from the admin panel. I have provided 3 screenshots and I'll refer to them here. The first screenshot shows how my website looks so far. It's using a template I made called homepage.php (see screenshot 3 for code). The template includes header.php which contains the logo, navigation menu etc. It has the image banner and finally includes footer.php. I want the "Our Values" part to be editable so that my client can change the text any time they need to. Currently, they can edit the top part which says "PROtential Coaching" and that's because it's included on the page within the admin panel and not in the template. I want the bottom part including"Our Values" to be editable from that panel too, is there a way to do this or does this content have to be static and within the template? "Our Values" and "Our People" are in a dynamic secondary navigation menu which my client can add items to if they want to, however they can't change the content for the menu item. Images: http://imgur.com/yq9y8SQ,5IqOPzr,SHkzrFz Please help me out guys, I've been looking all over the place for days to get this done.


title: Users roles, make a page belonging to multiple users

text: I have a website with a lot of users. They are all editor (with same custom roles). They can add page and post, and edit only their own page/post. But some users need the ability to edit some specific page/post belonging to other users (not all). I can't had a new role for those "special users", because the page list they need to edit is different for each "special users". I've try some plugins like co-authors-plus but the search of this plugin only find admin user when i try to add a new author to page. Any clue on how I could accomplish that?


title: Wordpress comment for URL rewritten pages

text: I am rewriting URL like this `product/product-category-name/product-name` Here product is the real wordpress page, the rest are generated by database query. So, there is only one comment section which is shared among all virtual pages. I want to have separate comment section for each virtual page. What's the best way to do this?


title: WP Query - Is this correct?

text: Trying to debug, getting headache so I want to ensure that I have placed the query args in the correct place. I want to sort/order all my posts based on "myvalue".               if ( have_posts() ) :         /* Start the Loop */         $args = array(             'meta_key' => 'myvalue',             'orderby' => 'meta_value_num',             'order' => 'DESC'          );         query_posts( $args );         /* End Condition */         while (have_posts()) : the_post();             get_template_part( 'content', get_post_format() );         endwhile;     endif;      **EDIT:** Updated the code:               $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     $args = array(         'posts_per_page' => 10,         'order' => 'DESC',         'paged' => $paged,         'meta_value_num' => 'likes_count',         'orderby' => 'meta_value_num'     );     $posts = new WP_Query($args);     while ($posts->have_posts()): $posts->the_post();     endwhile;      I'm using this piece of code to retrieve the meta value   http://wordpress.stackexchange.com/a/66955


title: Different amount of posts on homepage than paged pages

text: I've done some searches here and on Google but everything I'm finding isn't working correctly. I was hoping to post my code here and get help with where I'm going wrong. On the index page of my site, I have one "featured" post that has a different layout than the rest of the posts. When you click to the next page, that featured post goes away and leaves me with an uneven count of posts and I need an even post count. Here's the code I found and have tried implementing with no joy. I'm using the following query (everything else is the same at the count code and below):               <?php       $page = (get_query_var('paged')) ? get_query_var('paged') : 1;       query_posts("paged=$page&posts_per_page=10");      ?>      This is the code I want to be able to use:               <?php     $page = (get_query_var('paged')) ? get_query_var('paged') : 1;     $page_num = $paged;         if ($pagenum='') $pagenum = 1;         if ($pagenum > 1) { $post_num = 10 } else { $post_num = 9 }     query_posts('showposts='.$post_num.'&paged='.$page_num); `     ?>      This would be the same for the rest of the page:               <?php $count = 1; ?>          <?php while (have_posts()) : the_post(); ?>          <?php if ((!is_paged()) && ($count == 1 )){  ?>           // FEATURED HTML HERE          <?php } else {  ?>           // REGULAR HTML HERE          <?php } $count++; ?>          <?php endwhile; ?>          // PAGINATION HERE


title: Reading Setting Not Working for Number of Posts

text:
I set the number of posts to show on my blog to 1, but the blog is showing all the posts I have. I tried to insert a custom query into my index.php, but it just made one post show up endlessly. This is my index.php:               <?php get_header(); ?>          <?php if ( have_posts() ) : ?>
         <?php /* Start the Loop */ ?>             <?php while ( have_posts() ) : the_post(); ?>                      <?php get_sidebar(); ?>

<?php the_title(); ?>
                     <?php the_content(); ?>

             <?php endwhile; ?>              <?php endif;  ?>
               <?php get_footer(); ?>      I'd appreciate your help.


title: Remove id attribute from stylesheet link

text: Right now I'm serving up my own custom stylesheet.               // register main stylesheet     wp_register_style( 'custom-stylesheet', get_stylesheet_directory_uri() . '/library/css/main.css', array(), '', 'all' );      It outputs:               <link rel='stylesheet' id='custom-stylesheet-css'  href='http://localhost/wp-content/themes/custom-theme/library/css/main.css' type='text/css' media='all' />      Is there a way to remove the `id='custom-stylesheet-css` part of that stylesheet?? Is there a reason that they add an `id` attribute?


title: Importing Attachments with No Extension

text: Is there an extension, or a technique, during Wordpress import to pull in an attachment URL that doesn't have a file extension? I'm trying to import a Square Space blog into Wordpress. Most of the posts and URLs come over, but there's a small number (eight), where the images can't be imported. The importer fails with a message like > Failed to import Media “attachment-50b1b915e4b01c11f0ef7db4”: Invalid file > type If I lookup the `attachment-50b1b915e4b01c11f0ef7db4` attachment in the XML import file, I find the following item node set               <item>       <wp:attachment_url>http://static.squarespace.com/static/50a97ccee4b040d1420f6022/50a97ccee4b040d1420f6032/50b1b915e4b01c11f0ef7db4/1353824560608/file</wp:attachment_url>       <link>http://static.squarespace.com/static/50a97ccee4b040d1420f6022/50a97ccee4b040d1420f6032/50b1b915e4b01c11f0ef7db4/1353824560608/file</link>       <title>attachment-50b1b915e4b01c11f0ef7db4</title>       <wp:post_name>file</wp:post_name>       <wp:post_type>attachment</wp:post_type>       <wp:post_id>91</wp:post_id>       <wp:post_parent>90</wp:post_parent>       <wp:status>inherit</wp:status>       <content:encoded><![CDATA[img-50b1b915e4b01c11f0ef7db4]]></content:encoded>       <excerpt:encoded><![CDATA[exc-50b1b915e4b01c11f0ef7db4]]></excerpt:encoded>       <pubDate>Sun, 25 Nov 2012 06:22:13 +0000</pubDate>       <wp:post_date>2012-11-25 06:22:13</wp:post_date>       <wp:post_date_gmt>2012-11-25 06:22:13</wp:post_date_gmt>       <dc:creator>astorm@example.com</dc:creator>     </item>      Zooming in on the attachment URL, that's               http://static.squarespace.com/static/50a97ccee4b040d1420f6022/50a97ccee4b040d1420f6032/50b1b915e4b01c11f0ef7db4/1353824560608/file      There's no file extension on this URL. It appears that the `wordpress- importer` plugin checks the file types of the URL by extension, using the `wp_get_mime_types` function. Is there a way to work around this by mapping via the `Content/Type` header, or manually mapping specific URLs to specific file types during import?


title: Password protect the site (without htaccess or membership)

text: I'd like to display a simple password box where visitors need to enter a password before they can access the site.


title: Posts are duplicating on wp_post_update

text: I have stucked in writing a simple function that on certain page update refresh all posts in a custom post type. Here is my code (based on this):               add_action('save_post', 'bulk_refresh');     function bulk_refresh($post_id) {         if($post_id != 123)//123 is the 'certain page' id             return;         $posts_to_update = new WP_Query(array('post_type' => 'MY_CUSTOM_TYPE', 'posts_per_page' => -1));         while($posts_to_update ->have_posts()) : $posts_to_update ->the_post();             $args = array( 'ID' => $post->ID );             wp_update_post( $args );         endwhile;         // Reset Post Data         wp_reset_postdata();     }      On first sight all must be working fine, but when I save the page with id '123' all posts in the custom post type are duplicated. I want just to 'refresh' them. Any ideas where I am wrong?


title: Broken comments section - Wordpress 2014 Theme

text: I recently switched my Wordpress theme to the "default" 2014 one. Everything looks great, except I'm having trouble with comments showing up correctly. Can somebody help me understand what's wrong? See http://gregloesch.com/997/notes-from-eloquent-ruby/#


title: include php file if page_id matches

text: I think this is a simple question: I'm building a plugi, and up until now, if i wanted to include a php file, i would have to know the page_id - i would put the following command in page.php (or whatever page template i'm using):               if (is_page(4552)) {          include WP_PLUGIN_DIR .'/file_to_include.php';     }      now, A bit more background: i now have a hook that creates a post on activation, and saves the post_id using update_options. so, that's how i know what $page_id is. So, to summarize - **how do i dynamically write the code above - in my plugin - assuming I know the $page_id**? Thanks for helping!


title: Create shortcode in Child Theme?

text: I have created a child theme, and I am trying to add a shortcode to its functions.php file, by doing this:               // functions.php of child theme          <?php           include(WP_CONTENT_DIR . '/graduates_functions.php');          ?>          // graduates_functions.php          <?php          // [bartag foo="foo-value"]     function sayhi_func( $atts ) {              extract( shortcode_atts( array(             'graduate_type' => 'seo',             'bar' => 'something else',         ), $atts ) );         echo 'test';     }          add_shortcode( 'sayhi', 'sayhi_func' );          ?>      But when doing [sayhi] from a page I don't see the echo, I see [sayhi]. It works if I add the same in the functions.php of the theme itself, not the child. Any thoughts?


title: White screen of death WP multisite memcache

text: We have a WordPress multisite running 3 blogs and have had http://pecl.php.net/package/memcached installed by our hosts. We have tried the Memcache Object Cache plugin, we'll refer to it as MOC from now, but it does not install successfully. It errors out with `Cannot redeclare wp_cache_add() (previously declared in /wp-includes/cache.php:24) in /wp- content/plugins/memcached/object-cache.php on line 22` So seeing this, we add the `object-cache.php` file to the wp-content folder manually, as the plugin suggests, and after reloading any page we get the dreaded WSOD. We also tried adding in batcache following the instructions but the same eventuality occurs. With no decent leads in the error logs, we are scratching our heads. Our host has told us that memcache is running but we are unsure where to go from this point. Does anyone know how to fix the white screen of death issue on a WP multisite install using Memcache?


title: Filter get_adjacent_post() for private posts, how to modify JOIN/WHERE?

text: _Edit 3 - revised per G.M.'s suggestions. Code runs error free, but adjacent post filter still not filtering. Changes noted in code comments, current question noted at bottom of post._ _Edit 2 - reflects G.M.'s code suggestion below. I'm confused about where the modified join/where filter function should go, so I added more of the mu- plugin code structure._ _Edit 1 - reflects Kaiser's comment below, examples provided. Also, I was mistaken about which code was filtering my posts. Question does not relate to the Members plugin._ I have a mu-plugin filtering my WP query so that in the index loop, a visitor only sees posts they can read. It does this by offering post author the ability to assign a multi-level membership taxonomy for each post. At the lowest (public) level, there is no membership taxonomy attached to the post. Here is the query filter in the mu-plugin:               if ( ! class_exists ( 'Site_Members_Taxonomy' ) ) {          class Site_Members_Taxonomy     {         //define( 'LANG', 'some_textdomain' ); deleted LANG, was throwing errors              public $post_types = array( 'post', 'page', 'gallery' );         public $tax = 'membership';         public $tax_label; // CHANGE: made these three vars public              public function __construct()         {         $this->tax_label = __( 'Membership' );              // plugin defines taxonomy and membership meta and then:              add_action( 'pre_get_posts', array( &$this, 'filter_query' ) );              /**          * Modify the query based on membership taxonomy          */         function filter_query( $query ) {                  //quit right now if in admin             if( is_admin() ) return;                  $tax_query = '';             $terms = $this->get_terms_to_exclude(); // see function below                  if( $terms )                  $tax_query = array(                        array(                             'taxonomy' => $this->tax,                             'field' => 'slug',                             'terms' => $terms,                             'operator'=>'NOT IN'                         )                 );                  // if after all that we have a tax query to make, lets do it!             if ( $tax_query )                 set_query_var('tax_query', $tax_query);              }              } //end class              global $Site_Members_Taxonomy;         $Site_Members_Taxonomy = new Site_Members_Taxonomy();          }          // finally, outside the class definition, there is a function `members_can_view` to be used as a conditional to hide/show various template tags etc.      So far, so good. This filter works great. The problem is, in single-post view, `next_post_link()` and `previous_post_link()` don't get the filter, so visitors can navigate to posts they **cannot** read. I want to filter the links to these posts to show the link only to the next post they can actually read. I'd basically like to use the above query filter on get_adjacent_post(). In WP core trac for link-template.php (as well as in the post Kaiser linked to below) I found that `next_post_link()`, `get_next_post()` and `get_adjacent_post()` run the adjacent post query through the following filters:   * `get_{$adjacent}_post_join`   * `get_{$adjacent}_post_where`   * `get_{$adjacent}_post_sort` * * * **REWRITE JOIN/WHERE FILTER** I tried the following rewrite of JOIN/WHERE suggested in G.M.'s answer. As he says, it is very closely based on the wp-core function, with tr and tt given different names and the excluded terms passed directly to the function. This function is currently active on the site and not throwing errors, however it's not filtering the adjacent posts query correctly either. **Current Question:** When converting $excluded_terms from slugs to IDs in the function _filter_adjacent_ below, am I correctly building the array? How can I log the excluded terms and find out what's going on?                   // Filters for get_adjacent_posts() so they don't show up in single-post navigation           // These filters are added within function __construct{} noted above         // CHANGE: &$this to $this              add_filter( 'get_previous_post_where', array( $this, 'filter_adjacent' ) );         add_filter( 'get_next_post_where', array( $this, 'filter_adjacent' ) );         add_filter( 'get_previous_post_join', array( $this, 'filter_adjacent' ) );         add_filter( 'get_next_post_join', array( $this, 'filter_adjacent' ) );                   /**          * These functions added within mu-plugin class:          *          * First, modify excluded terms based on membership taxonomy          *           * NOTE: Excluded terms may be an array          */              function get_terms_to_exclude() {                  // if a real admin or "level1" we won't change tax query at all             if( current_user_can ( 'manage_options' ) || current_user_can ( 'view_level1_posts' ) )                 return false;                  // default/public will exclude all upper level posts             // in other words, all posts with membership taxonomy             $terms = array( 'level1','level2','level3' );                  // if a level3 reader we'll exclude level1 and level2 posts             if( current_user_can ( 'view_level3_posts' ) )                 $terms = array( 'level1', 'level2' );                  // if at level2 level we'll exclude level1 level posts             if( current_user_can ( 'view_level2_posts' ) )                 $terms = array( 'level1' );                  return $terms;              }                   /**          * Next, use these terms to filter the get_adjacent_post JOIN/WHERE          */              function filter_adjacent( $clause ) {                  if ( substr_count( current_filter(), '_post_join' ) ) { // filtering join                      if ( empty($clause) ) $clause = '';                 global $wpdb;                 $clause .=                     " INNER JOIN {$wpdb->term_relationships} AS trmship ON p.ID = trmship.object_id                     INNER JOIN {$wpdb->term_taxonomy} ttmship                     ON trmship.term_taxonomy_id = ttmship.term_taxonomy_id";                 return $clause;                  } elseif ( substr_count( current_filter(), '_post_where' ) ) { // filtering where                      $excluded_term_slugs = get_terms_to_exclude();                 if ( ! $excluded_term_slugs ) return $clause; // nothing to filter if no terms                 $excluded_terms = array(); // we needs term ids, let's convert slug in terms ids                 foreach ( $excluded_term_slugs as $slug ) {                     $t = get_term_by( 'slug',  $slug, 'membership' );                     if ( ! $t || is_wp_error($t) ) continue;                     $excluded_terms[] = $t;                 }                 // something wrong in get_level_term_to_exclude()?                 if ( empty($excluded_terms) ) return $where;                       $posts_in_ex_terms_sql =                      " AND ttmship.taxonomy = 'membership'                     AND ttmship.term_id NOT IN (" . implode( $excluded_terms, ',' ) . ')';                 // return filtered where clause                 return $clause. $posts_in_ex_terms_sql;             }         }


title: Saving plugin data returns "You do not have sufficient permissions to access this page."

text:
I'm developing a quote plugin which will save a quote to the WPDB using a form to input the quote. I've created half this code and got the other piece from another programmer on here. I'm looking to try and understand these 3 lines better.                if (is_null($quotes)) {             $quotes = array();         }              if (isset($_GET['delete']) && is_numeric($_GET['delete'])) { // ???             unset($quotes[$_GET['delete']]); // remove that quote from the array             $quotes = array_values($quotes); // reorder the keys             update_option('dw_quotes', serialize($quotes)); // store results             echo '
Quote Deleted
';         }              if ($_POST && isset($_POST['random_quote']) && $_POST['random_quote'] !== '') { //???             array_push($quotes, $_POST['random_quote']);             update_option('dw_quotes', serialize($quotes));             echo '
Quote Added
';         }      However this isn't my only problem, I'm getting an error when trying to save the plugin quote. Possible Cause:`<form action="admin.php?page=wse140202.php" method="post">` Reason for possible Cause: Looking at when the error appears its got to be something to do with accessing this page. error:"You do not have sufficient permissions to access this page." Full plugin code:                   <?php          /*idea to develop further would be, add a text box that the user can input the quote in     this then gets added to the DB and passed to the $quotes array. From here the results get     output the same way*/     /*     Plugin Name: Random Quotes     Plugin URI: xxx     Description: This Plugin randomly generates Quotes input by the user.     Version: 0.0.1     Author: xxx     Author URI: xxx     License: GPL2     */          /*          Function Reference      is_numeric() - Finds whether a variable is a number or a numeric string     unserialize() - takes a single serialized variable and converts it back into a PHP value.     isset() - tests to see if a variable isset               */          add_action('admin_menu', 'dw_quotes_create_menu');          function dw_quotes_create_menu() {         //create custom top-level menu         add_menu_page('Quotes Settings', 'Quotes Styling', 'manage_options', __FILE__, 'dw_styling_quotes_settings');     }              //generating the random quote     function dw_get_random_quote() {         $quotes = get_option('dw_quotes', null);          $quotes = unserialize($quotes);         $rand_quotes = array_rand($quotes);         $result_quote = $quotes[$rand_quotes]; // assigns $result_quote the random quote              return $result_quote;                }         //styling the admin menu     function dw_styling_quotes_settings() {              // load quotes         $quotes = get_option('dw_quotes', null);         $quotes = unserialize($quotes); // unserialize the data from the $quotes array              if (is_null($quotes)) {             $quotes = array();         }              if (isset($_GET['delete']) && is_numeric($_GET['delete'])) { // ???             unset($quotes[$_GET['delete']]); // remove that quote from the array             $quotes = array_values($quotes); // reorder the keys             update_option('dw_quotes', serialize($quotes)); // store results             echo '
Quote Deleted
';         }              if ($_POST && isset($_POST['random_quote']) && $_POST['random_quote'] !== '') { //???             array_push($quotes, $_POST['random_quote']);             update_option('dw_quotes', serialize($quotes));             echo '
Quote Added
';         }              ?>
             <?php screen_icon( 'plugins' ); ?>
Quotes Page
                       <form action="admin.php?page=wse140202.php" method="post">                 Add Quote:  <input style="width:600px;" type="textarea" name="random_quote" value="" />
<input type="submit" />             </form>

Current Quotes

             <?php             if ($quotes !== null) { // checks if $quotes is not set to 0                 $index = 0; //counter                 if (is_array($quotes)) { // checks if $quotes is an array to prevent error                 foreach ($quotes as $quote) {                     echo '
[ Delete ]  ' . $quote . '
';                     $index++; //increment counter                     }                 }             }?>

A Random Quote
             <?php echo dw_get_random_quote();     }          ?>


title: Post of a specific category - not to be seen in paging previous/next post

text: i have a specific post category, eg. id=x which is not shown in category list. These posts are password protected and should be visible only to those provided with the link. However current version still allows see posts from all categories using prev/next posts. What is the easiest way to ommit some of these category id=x from paging?