How to add/edit content Custom Content item in theme

For my first wordpress/website, I purchased a WordPress theme. I can edit and add pages fine. My level of understanding is: to add a page I use the Pages | Add New button in the Dashboard. Where I'm stuck: The theme also comes with a header that cycles through images and accompanying text. I can't figure out how to change the text. Are there files somewhere that I'm supposed to edit, or somewhere through the dashboard to enter this information, or has this been forgotten by the theme developer? The examples for the header from the dummy content that's currently loaded appear in the Dashboard under Custom Content, but I can't see anything that links to the actual content, e.g., the text that's displayed. (I've pasted the code below, but I think it's all just style info).               [lnt_flexslider gallery_id="979" image_type="image-1980-600" slider_style="1" title_enable="1" title_font_size="70" title_animation_initial_position="25,15" title_animation_target_position="0,15" title_animation_duration="800" title_animation_easing="easeInOutExpo" subtitle_enable="1" subtitle_font_size="28" subtitle_animation_initial_position="25,55" subtitle_animation_target_position="0,55" subtitle_animation_duration="1000" subtitle_animation_easing="easeInOutExpo" pagination_style="1" pagination_position="inner" pagination_bottom_border="1"]      I'm a complete novice with these tools, so please let me know if there's some additional info that would help.


Is there a way to prevent author change when editor/administrator edits a post?

As an administrator when I change or edit a post of an author (for example add a category through quick edit) the author of the post changes. We do not want this to happen. Is there a way to prevent this?


Wordpress site blacklisted by Google about .htaccess

my website www.saoyuying.com (the site is in Chinese :)) is included in Google's malware blacklist yesterday. But I didn't find any unusual files on the server. Google's report mentioned that "Some of the URLs on this site redirect browsers to web pages that install malware. This indicates that the server(s) that host pages for this site may contain altered configuration files (such as Apache's .htaccess file)." While my .htaccess content is copied below:               # BEGIN WPSuperCache     # END WPSuperCache          # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      Is anything harmful here? Or what else should I check? I would really appreciate your help! Thanks & Regards, Joe * * * **[UPDATED]** @Dwayne Thanks to Dwayne's answer, the actions below have been taken: I. Installed 3 security plug-ins in wordpress: Exploit Scanner, WP firewall 2, BulletProof Security. Exploit Scanner scanned the website and found several 'eval' and 'base64_decode' like               eval(function(p,a,c,k,e,r){e=function(c){return(c<a?      I know it just means executing string content. But I was not able to find anything suspicous. II. Sucuri SiteCheck. The result is here: Sucuri SiteCheck on saoyuying.com which says: > Malware found in the URL: http://www.saoyuying.com//404javascript.js > > Known javascript malware. Details: http://sucuri.net/malware/malware-entry- > mwht291 Location: http://namesti.bee.pl/ But I can't find this '404javascript.js' on the server, nor inside functions.php or index.php. This js looks like the root cause as the URL 'namesti.bee.pl' is also mentioned in Google's warning. But how to locate and get rid of it? Thanks again in advance.


How can this multiple loop have pagination as described?

In the paste below is the code for the template running the CPT archive page at http://www.m.angiemeekerdesigns.com/totd Everything about the page is working as expected except the pagination. What would like to happen is that when "Next Page" is clicked, Page 2 and forwards show the next posts from the CPT archive that were not also shown in one of the two loops on the first page. SO, I would not like for the first loop to repeat on subsequent pages, and I do not want subsequent pages to have the first post offset, and since there are 11 total posts on page 1 of this archive, I'd like the next page to not show those first 11 posts. Right now what is happening is that it is not showing the first loop (good), it is not offsetting the first post (good), but it is showing all 11 posts from the first page - for page 2 and every page after. Whew! Can this archive be corrected to paginate as I'd like? I have read MANY other posts and the codex on pagination for loops, and multiple loops (that's how I got to what I have), but alas, what I have is not working.               <?php          /**      *      * Display the Tip of the Day Custom Post Type archive custom fields using      * ACF.      *      * @author Angie Meeker      * @uses   Advanced Custom Fields      */          add_action('genesis_entry_content','genesis_do_post_title', 2);                               //* Add Tip of the Day body class to the head     add_filter( 'body_class', 'add_tiparchives_body_class' );     function add_tiparchives_body_class( $classes ) {        $classes[] = 'tiparchives-post-type-archive-{tipoftheday}';        return $classes;     }           // Return Category and Tip of the Day on Single Posts     add_action ( 'genesis_before_content', 'show_totd', 9 );     function show_totd() {             echo '
Tip of the Day
';     }       // Remove Post Author     add_filter( 'genesis_post_info', 'remove_post_author_totd_posts' );     function remove_post_author_totd_posts($post_info) {         $post_info = '[post_date]';         return $post_info;     }               /** Replace the standard loop with our custom loop */     remove_action( 'genesis_loop', 'genesis_do_loop' );     add_action( 'genesis_loop', 'totd_do_loop');     add_action( 'genesis_loop', 'totd_teasers_do_loop');                                   add_action('genesis_loop', 'totd_do_loop');     function totd_do_loop() {     if ( !is_paged() ) {         global $wp_query;         // Set up your query here         $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;         $query = array(             'post_type'      => 'tipoftheday',             'orderby'        => 'date',             'posts_per_page' => '1',              );              $wp_query = new WP_Query( $query );              if( $wp_query->have_posts() ):             while( $wp_query->have_posts() ): $wp_query->the_post();                 // Get the custom fields                         // Store the pre tips data             $tips_data_pre = array(                     'totd_tags' => get_field( 'totd_tags' ),                     'tip_article_headline' => get_field( 'tip_article_headline' ),                     'article_author' => get_field( 'article_author' ),                     'article_author_link' => get_field( 'article_author_link' ),             );               // Only output if we have tips data                 if ($tips_data_pre['totd_tags'] != '' ||                     $tips_data_pre['tip_article_headline'] != '' ||                     $tips_data_pre['article_author'] != '' ||                     $tips_data_pre['article_author_link'] != '') {                    echo '' , do_shortcode('[post_date]'),'' ;                          echo '

';                    echo '
' . get_the_title() . '
';                                echo the_excerpt();                                     echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;                                     echo '

Share This Tip:

';                               echo '
';             }                            endwhile;              endif;         // Reset the query         wp_reset_query();         }     }                                             add_action('genesis_loop', 'totd_teasers_do_loop');     function totd_teasers_do_loop() {         global $wp_query;         // Set up your query here         $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 0;         $query = array(             'post_type'      => 'tipoftheday',             'orderby'        => 'date',             'posts_per_page' => '10',             'offset'        => '1',             'paged'  => $paged,         );              $wp_query = new WP_Query( $query );              if( $wp_query->have_posts() ):             while( $wp_query->have_posts() ): $wp_query->the_post();                 // Get the custom fields                         // Store the pre tips data             $tips_data_pre = array(                     'totd_tags' => get_field( 'totd_tags' ),                     'tip_article_headline' => get_field( 'tip_article_headline' ),                     'article_author' => get_field( 'article_author' ),                     'article_author_link' => get_field( 'article_author_link' ),             );               // Only output if we have tips data                 if ($tips_data_pre['totd_tags'] != '' ||                     $tips_data_pre['tip_article_headline'] != '' ||                     $tips_data_pre['article_author'] != '' ||                     $tips_data_pre['article_author_link'] != '') {                     echo '
                     ',get_the_time( 'l' ),'                     ',get_the_time( 'm/d/Y' ),'
';                          echo '

';     echo '
' . get_the_title() . '
';                     $excerpt = get_the_excerpt();       echo string_limit_words($excerpt,25); echo 'ID) . '"> Continue Reading→';                                     echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;                                     echo '

';                               echo '
';             }                       endwhile;             // Pagination! Woo!             genesis_posts_nav();         endif;         // Reset the query         wp_reset_query();     }               genesis();      * * * EDITED I've come back to show my progress which used most of that same code offered by @mneil below (someone also mentioned in it the WP.org forums). The pagination does work correctly, and the first post is showing correctly in the first loop, but now the second loop is not offsetting properly (not skipping that latest post - the same shown in the first loop). Besides that though, this does work. Any thoughts on why the second loop would now skip the offset post?                  /** Replace the standard loop with our custom loop */     remove_action( 'genesis_loop', 'genesis_do_loop' );     add_action( 'genesis_loop', 'totd_do_loop');     add_action( 'genesis_loop', 'totd_teasers_do_loop');          add_action('pre_get_posts', 'myprefix_query_offset', 1 );     function myprefix_query_offset(&$query) {              //First, define your desired offset...         $offset = 0;              //Next, determine how many posts per page you want (we'll use WordPress's settings)         $ppp = 11;              //Next, detect and handle pagination...         if ( $query->is_paged ) {                  //Manually determine page query offset (offset + current page (minus one) x posts per page)             $page_offset = $offset + ( ($query->query_vars['paged']-1) * $ppp );                  //Apply adjust page offset             $query->set('offset', $page_offset );              }         else {                  //This is the first page. Just use the offset...             $query->set('offset',$offset);              }     }          add_filter('found_posts', 'myprefix_adjust_offset_pagination', 1, 2 );     function myprefix_adjust_offset_pagination($found_posts, $query) {              //Define our offset again...         $offset = 0;              //Ensure we're modifying the right query object...             //Reduce WordPress's found_posts count by the offset...              return $found_posts - $offset;         }                    add_action('genesis_loop', 'totd_do_loop');     function totd_do_loop() {     if ( !is_paged() ) {         global $wp_query;         // Set up your query here         $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;         $query = array(             'post_type'      => 'tipoftheday',             'orderby'        => 'date',             'posts_per_page' => '1',              );              $wp_query = new WP_Query( $query );              if( $wp_query->have_posts() ):             while( $wp_query->have_posts() ): $wp_query->the_post();             $do_not_duplicate = $post->ID;                  // Get the custom fields                         // Store the pre tips data             $tips_data_pre = array(                     'totd_tags' => get_field( 'totd_tags' ),                     'tip_article_headline' => get_field( 'tip_article_headline' ),                     'article_author' => get_field( 'article_author' ),                     'article_author_link' => get_field( 'article_author_link' ),             );               // Only output if we have tips data                 if ($tips_data_pre['totd_tags'] != '' ||                     $tips_data_pre['tip_article_headline'] != '' ||                     $tips_data_pre['article_author'] != '' ||                     $tips_data_pre['article_author_link'] != '') {                    echo '' , do_shortcode('[post_date]'),'' ;                          echo '

';                    echo '
' . get_the_title() . '
';                                echo the_excerpt();                                     echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;                                     echo '

Share This Tip:

';                               echo '
';             }                            endwhile;              endif;         // Reset the query         wp_reset_query();         }     }                                             add_action('genesis_loop', 'totd_teasers_do_loop');     function totd_teasers_do_loop() {         global $wp_query;         // Set up your query here         $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 0;         $query = array(             'post_type'      => 'tipoftheday',             'orderby'        => 'date',             'posts_per_page' => '10',             'offset'        => '1',             'paged'  => $paged,         );              $wp_query = new WP_Query( $query );              if( $wp_query->have_posts() ):             while( $wp_query->have_posts() ): $wp_query->the_post();                      // Get the custom fields                         // Store the pre tips data             $tips_data_pre = array(                     'totd_tags' => get_field( 'totd_tags' ),                     'tip_article_headline' => get_field( 'tip_article_headline' ),                     'article_author' => get_field( 'article_author' ),                     'article_author_link' => get_field( 'article_author_link' ),             );               // Only output if we have tips data                 if ($tips_data_pre['totd_tags'] != '' ||                     $tips_data_pre['tip_article_headline'] != '' ||                     $tips_data_pre['article_author'] != '' ||                     $tips_data_pre['article_author_link'] != '') {                     echo '
                     ',get_the_time( 'l' ),'                     ',get_the_time( 'm/d/Y' ),'
';                          echo '

';     echo '
' . get_the_title() . '
';                     $excerpt = get_the_excerpt();       echo string_limit_words($excerpt,25); echo 'ID) . '"> Continue Reading→';                                     echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;                                     echo '

';                               echo '
';             }                       endwhile;             // Pagination! Woo!             genesis_posts_nav();         endif;         // Reset the query         wp_reset_query();     }


Logout redirect to current page - function

I'm looking for a function that can redirect users when they logout to the current page. I'm looking for a code I can use in `functions.php`?


How To Change Custom Taxonomy To Radio Buttons

I've actually found a solution to my problem here: Altering the appearance of custom taxonomy inputs but I wanted to ask a followup question, and it seems I couldn't ask in that thread. Here's the code provided on that thread that seemed to work.               add_action('add_meta_boxes','mysite_add_meta_boxes',10,2);         function mysite_add_meta_boxes($post_type, $post) {         ob_start();     }     add_action('dbx_post_sidebar','mysite_dbx_post_sidebar');          function mysite_dbx_post_sidebar() {         $html = ob_get_clean();         $html = str_replace('"checkbox"','"radio"',$html);         echo $html;     }      When I use the code above, it does transform the checkboxes in all taxonomy boxes to a radio button. But I only want 3 boxes to change their checkboxes into a radio button. So how do you turn the checkboxes into radio buttons for a specific taxonomy box? tnx.


Why won't draft listings appear for non-admins?

I have a draft post with the author set to 5. User #5 is trying to view that draft on the front end using a WP_Query with the following arguments:               array {       ["name"]=> "example-52f00a8ba19f4"       ["post_status"]=> array {         [0]=> "draft"         [1]=> "private"       }       ["post_type"]=> "customlisting"       ["posts_per_page"]=> 1       ["author"]=> 5     }      The user trying to view this is user #5. They are trying to view their own draft post, so that they can publish it... (on the front end) The SQL query that is available in `$wp_query->request` **does in fact return the listing** (screenshot from HeidiSQL). But it does not appear in `$wp_query->posts`, and it seems WP_Query is removing it after the actual SQL query. How can I prevent WP_Query from removing this? I don't know where to look. I don't know why it's happening either :/ **Update:** It seems the query only fails if searching by post name. It works by post ID (post__in, rather).


Plugin could not be activated because it triggered a fatal error, unexpected '['

I'm attempting to dynamically create a text widget, add it to a named sidebar widget that my theme has already created ($sidebar_id = 'home-header-widget'), then populate the text widget with some preset content. I'm getting an error as indicated above at line 35 (commented below). Any ideas what I'm doing wrong?               Parse error: syntax error, unexpected '[' in C:....widgettest.php on line 35               <?php     /*     Plugin Name: Widget Test     */               function cb_activate_widgettest(){              $ops = get_option('widget_text');         // find an $id that works...         $ops[$id] = array(           'title' => '',           'text' => 'bar', // content?         );         update_option('widget_text', $ops);              $sidebar_id = 'home-header-widget';         $sidebars_widgets = get_option('sidebars_widgets');         $sidebars_widgets[$sidebar_id] = ["widget_text-$id"];  //this is line 35         update_option('sidebars_widgets', $sidebars_widgets);     }          register_activation_hook(__FILE__, 'cb_activate_widgettest');     ?>


Is it possible to move a comment that should be a reply to another comment?

I like to have a clean blog, and I also like that comments that are replies to other comments actually are replies to other comments. Some people don't mind that difference too much and just leave another comment instead of a reply. That's alright, but I'd like to fix it so that my blog stays clean and so that things are clearer to myself. Is there a way that I can "move" a regular comment so that it becomes a reply to a certain comment instead?


Re-write URL for certain sub-pages only

For better Organization in my Admin panel for Pages on a site I would like to add a page called "Unlisted" and then add sub-pages to this page that I do not want to be listed on the site...the purpose of these "landing pages" is for them to only show up in search engines or directly linked. Now if I do this, these sub-pages will end up with a url like this `/unlisted/page-name` and I would like to do a re-write for sub-pages of the 'unlisted' page ONLY so that all the sub-pages of that page will instead have a url like this `/page-name` I am pretty sure this is possible as I have done many fancy re-writes in the past with WordPress but I could use some help here please?


Possible to use pagename inside get_template_part?

I'd like to grab the current page name and pull that specific template part per page. This way I can just set up a generic tier-1 template that calls in a secondary section based on the current page's title (without having to use a bunch of conditional statements). So, it'd look like this...               <?php get_template_part( 'section', '$pagename' ); ?>      Pulling in the file: **section-pagename.php** (eg., **section-about.php** ). Is this possible? I wonder if anyone has used this approach. I think it'd be a really efficient way of templating.


How would I go about listing only unattached media in say a sidebar?

I have a client who uses PDF files for their newsletter, I don't think that this is a good idea personally, but it's not negotiable. They have a news page where they put real time news and they'd like to add a sidebar to this page where there would be links to download these PDF files which would update automatically when they add them to the media library. So that the page doesn't over populate we've agreed that only the 12 most recent newsletters should be shown, that's 1 for each month of the year. They have no plans to add media of any other type without it being attached directly to posts or pages, so I figure that just a list of the 12 most recent unattached media files should suffice. Is there a way that this can be done using say a custom loop or WP_query object? I really have no idea how to go about starting this. I've done all sorts of workarounds in all sorts of ways regarding custom loops and sidebars so that's not the issue, what I really need to know is if there is an option for the loop to only display unattached media, or some WordPress function that lists media. I can't really give any examples or snippets of my code because I haven't started anything yet. EDIT: Okay, figured it out. Okay, I found a pretty straight forward sort of solution. It's not perfect because it's taking excessive amounts of steps per newsletter but it works exactly how I want it to. This is what I've got sitting in my sidebar:                       <?php query_posts('category_name=newsletter&number_of_posts=12');                   if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                        // From here down I found on a site which I'll cite below.                   <?php $args = array(                         'post_type' => 'attachment',                         'numberposts' => null,                         'post_status' => null,                         'post_parent' => $post->ID                   );                   $attachments = get_posts($args);                   if ($attachments) {                         foreach ($attachments as $attachment) {                               echo '<li>';                               the_attachment_link($attachment->ID, false);                               echo '</li>';                         }                   } ?>                        <?php endwhile; endif; ?>                   <?php wp_reset_query; ?>      I made a category called Newsletter and the only thing I put in each post is a title and attach a PDF, the title doesn't even carry through, but it's necissary to publish the post. Finally, here is the link to the source for that code. I love these guys.


Automatically adding meta data to posts or multiple query help

I run an events company whose website uses a custom post type system for posts (blog), events and tickets all stored as CPT's in the DB. On the guestlist (which counts 'ticket' custom posts if the event [post] number == current post) I would like to implement a "New Customer" tag to prompt the host to look out for them. There are two problems with this: you cannot search for the oldest 'ticket' post, as they may not have bought them in chronological order, and you cannot get all tickets and order by post number as they may not have been added to the site in chronological order either. The two ways I can think of getting around this is either: (1) By multiple search arrays, i.e. query TICKET > to get USER > get all TICKETS for USER NUMBER > get EVENT [POST] NUMBERS from those tickets (stored as meta) > get EVENTS by post number > - SORT ARRAY BY DATE of event > IF FIRST EVENT IN THAT ARRAY == CURRENT EVENT [post] NUMBER echo **NEW CUSTOMER**   This seems to be an awfully long way around and I am a little reluctant to try and make all that work as a relatively novice coder. (2) Somehow retrospectively adding a 'date of event' meta data tag to all ticket posts and then I can directly query them.... Much easier, but I am unsure how to then re-translate that 010214 so that the query recognises it as a date rather than a number... Number (2) would be ideal but I can't find any information as to how to add all this data retrospectively, and then for future posts - all the data is there in the system but all searches for information lead me to people talking about going back and batch adding search engine meta, not WordPress post meta. I started coding Number (1) and realised the mountain ahead of me and stopped - if anyone would like that portion of the code though, I can still post it... Thanks in advance, sorry for the long question - trying to equip any helpers with as much information as possible. > EDIT: A way around this could be actually to use the event page itself as > each `$event` and `$ticket` are called there. Structure could be:               write meta to `$ticket`     with     meta key = 'event_date'     value = $eventDay [= date( 'dmy', $event->start );]      Then a simple query to find all user tickets, and order by this new meta tag 'event_date'. If first entry event number == current post, BINGO!


How build a custom login/register form with error handling?

So, I'm working on a plugin in which I'm making a custom page containing a login form as well as one for user registration; I have the forms built and operational, below is my code.                                   <form name="loginform" id="login_form" class="login_form" action="<?php echo esc_url( wp_login_url() ); ?>" method="post">
             <input type="text" name="log" id="user_login" class="input" placeholder="Username" />

             <input type="password" name="pwd" id="user_pass" class="input" placeholder="Password" />
              <button name="wp-submit" id="wp-submit" class="btn"><?php _e("Sign in", "shorti"); ?></button>              <input type="hidden" name="redirect_to" value="<?php echo $_SERVER["REQUEST_URI"]; ?>" />          </form>                    <form method="post" id="register_form" class="wp-user-form" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>">
             <input type="text" name="user_login" id="user_login" class="input" placeholder="username" />

             <input type="email" name="user_email" id="user_email" class="input" placeholder="email address" />

You will receive an email with a generated password
(which you can change in your "user settings")
              <?php do_action('register_form'); ?>         <button name="wp-submit" id="wp-submit" class="btn"><?php _e("Register!", "shorti"); ?></button>         <?php $register = $_GET['register']; if($register == true) { echo '
Check your email for the password!
'; } ?>         <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?register=true" />         <input type="hidden" name="user-cookie" value="1" />          </form>      This works fine beside the fact that whenever there's an error message it redirects the user to wp-login.php. I'm needing the page with the form to handle all the errors with AJAX; so as to give a better user experience. What is the best way to go about doing this?


How do I list multisite users for the current site only

I'm looking for a way of selecting the users for one site within a multisite set up. Can anyone tell me how to do this please? This is what I have at the moment:               $user_search = $wpdb->get_results("SELECT ID, display_name, user_email FROM ".$wpdb->base_prefix."users");      but this selects all users across the multisite. Many thanks!


Jetpack - stats_get_csv period parameter

I'd like to create a query to show the top 6 most read posts over the last two days. However, I'd like to only include posts created within the last month to prevent older stories from showing up. I am using Jetpack and wordpress.com stats, so I've created this query for Top Posts, but I'm unsure whether it is the correct approach               $top_posts = stats_get_csv('postviews', 'period=month&days=2&limit=6')      My primary confusion is with the stats_get_csv API period parameter, and how it is used / what the effects are.


How to change how many list item show in category generated by file edit-tags.php

It's always been a pain in the @$$ to see only 20 item in category. If i have 30, it paged on 2 pages, i hate that. If WordPress had a preference for that. So the question, Hot to list ALL the category, whatever the number... if i have 200, list them all, no paging. I inspect edit-tags.php and could not find "show_item=20" of something like that The question, how to make edit-tags.php show 9999 item (or unlimited) of have a plugin to customize that without hacking the WP core file. * * * I think the magic is happening here, but changing 20 to 999 dont change anything               add_screen_option(          'per_page',          array(             'label' => $title,              'default' => 20,              'option' => 'edit_' . $tax->name . '_per_page'         )      );      It's for product attribute in woocommerce.


Title tags show twice

My Title tags same sentence show twice. please see it. how i can solve this problem . my site


Separator for multiple terms

I'm trying to show terms of custom taxonomies. I have that. But, my problem is how to separate when I have multiple terms.   My code:
         <?php $loop = new WP_Query( array( 'post_type' => 'member', 'posts_per_page' => -1 ) ); ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); $do_not_duplicate = $post->ID; ?>

<?php $terms = get_terms('department');                     foreach ( $terms as $term ) {                         echo $term->name.' and ';                     }                 ?>
                 <?php the_post_thumbnail('full'); ?>

<?php the_title(); ?>

<?php $terms = get_terms('position');                         foreach ( $terms as $term ) {                             echo $term->name.' and ';                         }                     ?>
                     <?php the_content(); ?>                     <a href="<?php the_permalink(); ?>">See Full Biography

         <?php endwhile; wp_reset_query(); wp_reset_postdata(); ?>
      With this I am able to display all terms used (good). But, I need it to say "and" only between terms. Right now, it says "and" after every term, even it's only one term.   I know my problem lies within here:               <?php $terms = get_terms('department');         foreach ( $terms as $term ) {             echo $term->name.' and ';         }     ?>      How do I only get the "and" to only show between terms and not after every term?


Wordpress Network site edit missing user list?

`[domain]/wp-admin/network/site-users.php?id=2` shows no users listed but there are definitely users in the blog. Where/How can I fix this?


Can I use Pages like a Wiki

I would like to have a central place to keep my notes for projects. Does it make sense to use pages like a Wiki?


Redirect deleted posts to category archive

I have a website (http://www.ticketyoda.co.uk) and the events listed become outdated after they have been and gone. I have set it up so that posts automatically expire and are moved to Drafts. So now I have links which point to the site which are outdated. What I want is the following redirection               example.com/1stcategory/2ndcategory/eventABC      when it expires to go to               example.com/1stcategory/2ndcategory/      This not only makes sense for a user point of view but also as an SEO factor. I cannot seem to get any plugins to work for me so stuck at the moment.


Web 2.0 theme with content on a single page and scrolling links?

I've been looking for a specific WordPress theme for days now and still can't find anything. I appreciate that this isn't really the place to ask but I'm really out of options. http://cellprivate.com/ I'm looking for a theme like this, which scrolls down the page when you use the header links, and also has a lot of Web 2.0 aspects like a custom web font and text shadows.


Get Category ID inside Category template

how do I get the cat ID inside the Template. Very important: I can not do it by the name, because we have muliple cats with the same name. Only the slug is different. If I'd get the slug, it would be okay, too. But like I said: I can not use the Cat title.....


Publish pages/posts as HTML?

We're looking to use a plugin or custom setup for authors to create pages or posts and publish them as single HTML files. The file could be saved on the server in a specific directory or have a download button from within the editor. So far we have found 2 plugins that almost achieve this function: WP Static Output Really Static Both work fairly similar but need admin access to generate. They also create the files in the following fashion: dir-on-server/page-title/index.html _where I would need_ dir-on-server/page-title/page-title.html Any thoughts on this? Has anyone done something similar? Thanks in advance.


How to prevent multiple comments

We have an internal WordPress blog and a sort semi-trolling type situation going on. Almost all posts are flooded with comments by a single person. Basically the person is keeping a blog in the comments. This is pretty annoying and discourages other people. I don't think we want to block this person entirely (commenters use real names). Is it possible to only allow one comment per person? Maybe being able to answer in a thread? I'm not responsible for maintaining the site, but it would be nice if you could point me to a resource so I could forward it to the appropriate people.


nested Shortcode doesn't work

Shortcode:               [permalink][title][/permalink]      Output:               [title]      Wordpress shortcode API sais, it's correct: http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes Any Ideas?


get posts and postmetas in assoc array

how do I get all posts and postmetas in an associative array?               $allposts = $wpdb->get_results("     SELECT $wpdb->posts.post_title, $wpdb->postmeta.meta_key     FROM $wpdb->posts     JOIN $wpdb->postmeta      ON $wpdb->postmeta.post_id = $wpdb->posts.id     WHERE $wpdb->posts.post_type = 'post' AND $wpdb->posts.post_status ='publish';", OBJECT_K);      I just don't get it....


Favicon plugin for WordPress running in network mode (multisite)?

What favicon plugin should I use in order to define favicons for Wordpress when I run in multi-site mode. Uploading favicon.ico files is not an option for multi-site wordpress instances. I am looking for something simple that will not pollute the generated pages with hidden advertising. **EDIT:** Looking to be able to define favicons on a per site basis. Different favicons for different sites.


Any guides on creating custom admin pages?

I basically want to create a table (preferably AJAXified) that lets the user enter a line of information, and be able to add new lines of information, and delete selected ones. I've found this post and this post. The design side looks very straightforward, but I want to know about the functionality. How do I go about adding the field contents to the database and summoning them back up? How do I get that page "plugged in" to Wordpress as a whole? I have literally no idea where to start. I'm coming from the perspective of someone who's confident in HTML & CSS, and fairly so with JS/jQuery, but basically just hacks up PHP code that he finds around. Any help would be appreciated, even up to telling me that it's beyond me right now, and to go play with X plugin. FWIW, I was considering doing this with a custom post type, or the Magic Fields plugin, but I wanted a more user- friendly experience. Many thanks!


Creating a social media score plugin

I'm creating a plugin which counts social scores on various sites. It uses the various API's available on the web to determine a "count" of shares or likes across facebook, twitter, delicious, linkedin, stumbleupon, digg etc. Many of you are probably familiar with javascript widgets for these sites. I'm frustrated with the overhead which this brings (multiple javascript calls, so I'm building something to work this out and store natively within Wordpress). This will also give scope for designers creating their own buttons with HTML, and a shortcode will show the share count. My problem lies in the speed of the response for the networks. They can be slow, so I'm looking for architecture / design advice. I was thinking of creating a table which holds POST_ID and a collection of scores which is updated often via WP-CRON.. and updates when a user clicks the share button as well to keep it in synch. Sound like a valid idea? Or any other ideas? If you are still confused, take a look at the new share button on the BBC. I want to bring this to Wordpress, minus the speed overhead.


Can /%year%/%monthnum%/%day%/ structure tags be added to custom post type permalinks?

Just wondering if anyone had tried using any of the structure tags available to post permalinks with custom post types... I'm moving my "listings" posts on a site I manage from a category hack under Posts to their own custom post type, but I'd like to still keep some sort of numeric date reference in the permalink structure. How difficult is that to set up?


How can I change the theme of different posts using a plugin?

I'd like some posts to look different from others. Wordpress let's me easily switch themes for pages, but not posts. Is there a plugin that will let me do that for posts?


Redirect to another page using contact form 7?

I'm using CF7 to send some information to my email and everything's working fine, but I need to redirect the users to a different page after the email has been sent, by default the forms are sent to the same page via ajax, I was thinking about setting a hidden field with the page url but since the form submits asynchronously I don't know how to set it in my page template. If the form was submitted normaly I'd do something like:               if (isset($_REQUEST['hidden_field_url']) {         wp_redirect($_REQUEST['hidden_field_url']);     }       So is there any way to send the form without ajax? Or maybe do what I need in any other way? Thanks in advance!


WPML icl_register_string() throws fatal error but works

I'm helping someone with a custom plugin and they need it to be WPML compatible. Using the method from WPML I was able to register a string in WPML and output it on the other end. However, when the plugin was initially activated I got a **Call to undefined function icl_register_string()** error. It worked, but threw a fatal error. Any idea why this could be? Source: http://wpml.org/documentation/support/translation-for-texts-by-other-plugins- and-themes/ Here's my code:               //Register Settings with WPML     icl_register_string( 'Match Previous Order' , 'match_order', 'Do you want these items to match a previous order from Direct Linen? If yes, use "Additional Notes" to explain.' );


How to display a message about updates in the plugin list

I am trying to use the hook `in_plugin_update_message` in order to display a one line message below the name of my plugin in the admin plugin list section. However, the function called in the hook does not seem to be triggerd: no message is displayed. I can't figure out what I am doing wrong. **Building the hook**               global $pagenow;     if ( 'plugins.php' === $pagenow )     {         $file   = basename( __FILE__ );         $folder = basename( dirname( __FILE__ ) );         $hook = "in_plugin_update_message-{$folder}/{$file}";         add_action( $hook, 'your_update_message_cb');     }      **Callback function**               function your_update_message_cb( $plugin_data, $r )     {         echo 'Hello World';         $output = 'Hello World';         return print $output;     }      Should I use another hook or is there an error in my code? thanks for your help


How to disable JS? info windows from WP-FirePHP

I'm using current ver of WP and WP-FirePHP. When I load the WP dashboard, firebug's Console window shows the FirePHP data. That's all good. As expected, the main browser window shows the WP Dashboard page itself. **But,** the upper left corner of the browser window shows an iframe with textual debugging info. It appears to be the names of all of the WP scripts that were used to create the Dashboard page. And the upper right has another debugging iframe that tracks the mouse position. **How do I get rid of, or move** those extra debugging iframes? And what exactly is being shown in them? The upper left one hides needed parts of the page. **ps** I don't have rep to create a FirePHP tag.


Registering a static menu?

I have a website with a very large sidebar menu that uses an accordion plugin to keep everything compact and organized. Unfortunately, my menu has grown so big that I am unable to save any new entries; my research shows that this is a known problem. Is there any way that I can create a static menu and register it so that it is recognized as a WordPress custom menu? I've been digging though codex, but haven't found what I'm looking for.


Is there a standard public URL convention used on a Wordpress site directly to a page listing all of a user's public content?

Is there a standard convention for a full direct public URL address that, when visited/clicked on, will show a page list all of user account's public content uploaded on that site. Background: I have an account with getmedia.org.uk Podcasting site and here is my home page/user profile page: http://www.getmedia.org.uk/members/therobyouknow/ However it only lists _'recent content'_ but I know I have earlier content not shown on that page. I have recently contacted the site admins but haven't heard back from them yet and not sure if they are in a position to resolve my query so I thought I would ask here. To further illustrate my point I'm looking for something like: getmedia.org.uk/members/therobyouknow/content or getmedia.org.uk/members/therobyouknow/all or getmedia.org.uk/members/therobyouknow/uploads to list _ALL_ of my content **Update:**   * I don't want an answer based on search engine results - because:     1. I want a URL of the site because it's direct and part of the site      2. The Google URL is messy      3. The google URL could change as they develop their search      4. The google URL may include other sites the refer both to the site and me     5. The google search results have superfluous and unrelated information (ads, links optiond etc) making it harder to read, if messy for such a    * Just to pre-empt any other unhelpful contribution: This question is _not_ a self-promotion of myself or my content by stealth to readers of wordpress.stackexchange.com. It is a genuine query. That said, I would like to use the URL on profiles of myself but know that others would find a similar solution useful for their posted wordpress content, so it's for me _and_ others.


Using wp-postratings to rate user on profile pages

I'm using wp-postratings on my site and I want to include it on the buddypress profiles of my members so other users can rate them. I place the function on the profile page but it doesn't do anything when a rating is clicked. Any ideas on what I can add to make it work?


add sidebar area to header of child theme

How can I add some extra sidebar locations for widgets in a child theme. The difficulty I'm having is because the parent theme uses some pretty gnarly setup to define the current sidebars. I would like to add a sidebar area to my site's header and another sidebar area to the home template. The parent theme's functions.php file starts off with:               <?php           add_action( 'after_setup_theme', 'et_setup_theme' );     if ( ! function_exists( 'et_setup_theme' ) ){         function et_setup_theme(){             global $themename, $shortname;             $themename = "Chameleon";             $shortname = "chameleon";                  require_once(TEMPLATEPATH . '/epanel/custom_functions.php');                   require_once(TEMPLATEPATH . '/includes/functions/comments.php');                   require_once(TEMPLATEPATH . '/includes/functions/sidebars.php');                   load_theme_textdomain('Chameleon',get_template_directory().'/lang');                  require_once(TEMPLATEPATH . '/epanel/options_chameleon.php');                  require_once(TEMPLATEPATH . '/epanel/core_functions.php');                   require_once(TEMPLATEPATH . '/epanel/post_thumbnails_chameleon.php');                  include(TEMPLATEPATH . '/includes/widgets.php');                  add_action( 'wp_enqueue_scripts', 'et_add_responsive_shortcodes_css', 11 );                  add_action( 'pre_get_posts', 'et_home_posts_query' );                  add_action( 'et_epanel_changing_options', 'et_delete_featured_ids_cache' );             add_action( 'delete_post', 'et_delete_featured_ids_cache' );                 add_action( 'save_post', 'et_delete_featured_ids_cache' );         }     }      Where "require_once(TEMPLATEPATH . '/includes/functions/sidebars.php');" is the only reference to sidebars in this file. So the sidebars.php file in the includes directory contains the following:               <?php     if ( function_exists('register_sidebar') ) {         register_sidebar(array(             'name' => 'Sidebar',             'before_widget' => '
',             'after_widget' => '
 ',             'before_title' => '
',             'after_title' => '
',         ));              register_sidebar(array(             'name' => 'Footer',             'before_widget' => '
',             'after_widget' => '
 ',             'before_title' => '
',             'after_title' => '
',         ));              register_sidebar(array(             'name' => 'Homepage',             'before_widget' => '
',             'after_widget' => '
 ',             'before_title' => '
',             'after_title' => '
',         ));     }      ?>      There is a sidebar.php file in the theme's root directory that contains the following:
         <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar') ) : ?>          <?php endif; ?>
       So, let's (for now) work with adding a new sidebar area to the home template... The home.php template (which I have a modified copy of in my child theme folder) contains the following references to sidebars:               <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Homepage') ) : ?>                  <?php endif; ?>      and just before the end of the code for this template...               <?php get_sidebar(); ?>      My themes folder directory structure appears as so: mywebsiteroot > wp-content > themes > Chameleon > includes | home.php   mywebsiteroot > wp-content > themes > Chameleon > includes | functions.php   mywebsiteroot > wp-content > themes > Chameleon > includes | sidebar.php   mywebsiteroot > wp-content > themes > Chameleon > includes | style.css   mywebsiteroot > wp-content > themes > Chameleon > includes > functions > sidebar.php   mywebsiteroot > wp-content > themes > Chameleon > includes > css > other stylesheets... mywebsiteroot > wp-content > themes > lppscustom | home.php   mywebsiteroot > wp-content > themes > lppscustom | header.php   mywebsiteroot > wp-content > themes > lppscustom | footer.php   mywebsiteroot > wp-content > themes > lppscustom | style.css And... this is where I'm stuck. I know you can have your own custom functions.php and sidebar.php files in the child theme folder, but how do I structure them? Do I have to include all code from the parent theme's files? If so, how do I modify the code so any reference to sub-directories are relative? If not, how do I make it load the parent theme's function file and sidebar file as well as my custom ones? Any help would be greatly appreciated.


Exclude categories from homepage not longer working

I was using query for excluding categories from my homepage without problems until this week. I'd like to know the reason of the change and a better way to get this. I was trying also diverse solutions that I found here, no success.               function excludeCat($query) {       if ( $query->is_home() ) {         $query->set('cat', '-99, -263, -255, -268, -105');       }       return $query;     }     add_filter('pre_get_posts', 'excludeCat');      I also tried this in the index. No results.               if ( is_home() ) {     query_posts( 'cat=-99, -263, -255, -268, -105' );     }      updated: [the loop in the index: homepage.php]               <?php query_posts( array( 'posts_per_page' => $homePortfolioShow ) );      rewind_posts();     if (have_posts()) :     while (have_posts()) : the_post();     if(!get_post_format()) {     get_template_part('format', 'standard');     } else {     get_template_part('format', get_post_format());     }     endwhile;     endif;     ?>


Custom Post Type Root Template

I've created a custom post type for this project I'm working on. I've defined the URL slug to be 'vendors'. So now when I browse to www.mysite.com/vendors, it shows all of my Custom Post Type posts. I don't want the root slug to be a listing of all my posts. Is there a way to have a custom template defined for the /vendors/ slug?


How to import a Typo3 database to a wordpress site?

I have a SQL database export from a Typo3 site. Does anyone know know or have any experience of dealing with these cases?


Parent Page > Child Page Menu

I am trying to create a collapsible menu using Bootstrap. The problem I am having is getting the correct Wordpress PHP code to call the right pages. Also this menu will be displayed on these child pages. I would like the menu hierarchy to look like this: Specific Page 1 --- Child Page One --- Child Page Two Specific Page 2 --- Child Page One --- Child Page Two


How to create custom taxonomy URLs without taxonomy name?

I have a website that lists businesses in different cities (this is a niche site, so all businesses have the same "classification"). For starters I created a CPT for locations and a taxonomy called "Cities," which 150 or so cities as terms. All 300+ locations have been tagged with a city. I was able to modify the CPT links so that they appear like so: example.com/cityname/business-name What I'd love to have (and not been able to accomplish yet) are urls like example.com/cityname which would list all businesses from that city. My understanding is that by default WP attempts to find a page with "cityname" as the name. What would be the easiest way to reroute this request to use a taxonomy template? Or as an alternative, what would the easiest way be to have the page template detect the city name and pull posts tagged with that taxonomy term? I suppose I could create rewrite rules in htaccess for all cities, but I'd prefer where the redirects were automatically added when a new city name is added to the taxonomy.


Can I move WordPress to another folder?

My client has a very bare bones host who would not allow installation of WP. They insisted on doing it and in that process installed the files in a subfolder rather than at the top level. The question is, can I simply move the file to the top level and expect WP to run, or is there pathway information in the database?


Complex Search functionality. Advice needed

I have a pretty complex search feature I would like some advice on. I need to build a pretty advanced custom search in Wordpress and would like to get your opinion on how I can achieve it. I've made a lot searches for current plugins but nothing that really caters for this. I've also looked at creating custom functions (function.php) It works like this:   * Input keywords into a text field,    * these can then be added to a keyword 'bank'.    * you can then select from drop down the industry to search in (post category maybe).    * Then another drop down for country    * and a final one listing the months published (september 2012, october 2012 etc) Once the search button is hit, I need to display results based on relevance.   * So the top result would say 'Matched 4 filters: keyword, industry, country & date'.    * After there are no more results matching all 4 search options it displays any that match 3,    * then 2    * and eventually just displaying keyword searches.  So the search is essentially   * a text field to hold all keywords,    * 3 drop down select fields    * and then the search button.  I'm not convinced this is the best method to store a list of keywords given by the user before launching the search. May need to think alternatives. Hope it makes sense so far. ![http://tinypic.com/r/33dwner/6](http://i.stack.imgur.com/bCPud.png) My knowledge of customizing wordpress is pretty good but I've never created a search before. I would like to ask for opinions for tackling this as a solution. Hope you can help. Thanks


Any way to insert text on page from a query results?

I'm using Woocommerce and its atributes (custom taxonomies). I have some pages which I query this way: > http://example.com/?tax1=term1&tax2=term2 This query gives me the posts from taxonomy 1 and taxonomy 2 that matches term1 and term2. I'd like to insert some text on these pages. Any way to accomplish this? Thank you


What is the difference between "manage_{$post_type}_posts_columns" and "manage_edit-{$post_type}_columns"?

What is the difference between **`manage_{$post_type}_posts_columns`** and **`manage_edit-{$post_type}_columns`**? Could somebody explain what is the difference between these two approaches?


Function to list posts from current post's category fails in WP 3.8

**I have this function in my child theme's functions.php** , whose simple aim is to list a number of posts, only from the category of the current post, but not the current post itself. It was working fine until tonight, when **it started listing posts from _all_ categories**, not just the current post's category. The _only_ change I had made to my site was to update it to WordPress version 3.8. I'm not sure if that has anything to do with it, but I thought it might, since I have a "cloned" site which is still running WordPress 3.7.1, and the _exact_ same function on that site works, doing exactly what I want it to, i.e., it lists a number of posts, _only_ from the category of the current post, but not the current post itself. Here's the function:               <?php     function list_posts_from_current_category() {     if(is_single()){     $cat_ID = get_the_category($post->ID);     $cat_ID = $cat_ID[0]->cat_ID;     $this_post = get_the_ID();     $PostsPerPage = 5;     query_posts(array('cat' => $cat_ID, 'post__not_in' => array($this_post), 'posts_per_page' => $PostsPerPage, 'orderby' => 'rand'));     while ( have_posts() ) : the_post();     $ThisPermalink = get_permalink();     $ThisTitle = get_the_title();     echo ''.$ThisTitle.'
';     endwhile;     wp_reset_query();     }     }     add_action('do_my_list', 'list_posts_from_current_category');     ?>      It's added to the child theme's content.php in the usual manner:               <?php do_action('do_my_list'); ?>      Like I say, it all works as intended in WP 3.7.1, but has somehow come a cropper in WP version 3.8, listing posts from _all_ categories. Does anyone know what can be wrong with it?


Need an idea of how to realize filling of accordion by editors

I have and accordion (something like this one but smaller). I already made one. OK. But I can fill it only using WordPress built-in theme editor (just changing php). My customer don't like this method, cause this accordion would be filled every day by editors. I can't give right to edit theme to some unknown editor. In accordion would be some text and pictures, which are links to some pages. So, I thought a little and have 2 ideas. * * * **1st:** realize it like pages. One accordion tab = one page. From page we parse content and paste it to accordion tab.   _Limitations:_ Too many pages. It is easy to get confused. **2nd:** using new sidebar. Tabs would be like an simple Text Widget with text, imgs, links and etc. Links would be to some pages and all is cool.   _Limitations:_ With this construction I will have a sidebar into a widget (cause the accordion is already in a widget). And I need to give rights for widgets edit.


How to display BBpress statistics?

This seems like a fairly simple question, and I'm sure I'm overlooking something, but how does one display forum statistics (registered users, posts, etc.)? I see there is a template in the theme compatibility folder called `page-forum-statistics.php` which seems to display some of this info but I'd like it to display in the footer on the homepage. Is there something I'm missing? Or do they have to be called manually?


Wordpress image resizing on home page (product category)

I have been working on resizing the images on my wordpress website, the images are not appearing on equal sizes or not aligning properly. But inside the product pages it looks normal size but in the shop/home page (products page) all images are appearing in bigger size. how to fix the image size in wordpress i have not idea. Please refer my website **(www-dot-carolinegoodwin- dot-com** and suggest me what to do and how to fix this issue. Thanks much in advance for your help.


Word Press Permalink Change

I had the following permalink structure in my WordPress blog:               /%category%/%post-name%/      I changed it to:               /%post-name%/      Everything is fine as I am using the permalink finder plugin, which redirects the posts to new address. But, the issue is that Google Webmaster Tools shows too many duplicate meta descriptions as follows:   * /category1/postid/   * /postid/ Can anyone help me how to solve this issue?


How to implement bulk actions in my plugin?

I am developing a WordPress plugin. This plugin displays a list of courses. Now I want to implement the bulk actions just like in other plugins. From where I can apply the delete and edit actions to the list. How will I do this. Is there any built-in function for implementing bulk actions in WordPress? Any help?


RSS2 Feed with two CDATA sections

**Why my feed description is breaking like this?** It occurs only on some posts, but the others are echoed perfectly in _like_ a single `<p>`. ![broken feed description](http://i.stack.imgur.com/GoDZp.png) The code for my feed is that simple:               <description><![CDATA[<?php the_content(); ?>]]></description>      And I inspected the particular post and found nothing:
হেফাজতে ইসলামী বাংলাদেশ’র সমাবেশে বিভিন্ন এলাকা থেকে দলে দলে কর্মী-সমর্থকরা এসে যোগ দিচ্ছে। আর ক্ষুধার্ত-তৃষ্ণার্র্ত কর্মী-সমর্থকদের জন্য সমাবেশে কিছুক্ষণ পর পর পানি, ক্ষীরা, তরমুজ, কমলা, আপেল থেকে শুরু করে বিরিয়ানি পর্যন্ত আসছে।
      It's broken on the second line where the glyph "ক্ষুধার্ত-তৃষ্ণার্র্ত" presents. For a critical scrutiny, I guess, 'ক্ষ' is a joint-glyph ( _যুক্তাক্ষর_ ) in Bangla a mixture of two character - that may cause a break there. But I inspected other similar post where I found plain character. ![broken feed description 2](http://i.stack.imgur.com/4Zydo.png) The line was broken here within: "চট্টগ্রাম থেকে ঢাকা অভিমুখে লংমার্চে". As though they are broken, it's producing two `<![CDATA[ texts here ]]>` within a single `<description>` tag. It's not good for an apps developer to fetch the whole description dynamically. I found nothing in between the broken words, or characters. And in the first example the line is broken within a single word, but in second one it's broken after a complete word. What am I missing?


how to use the_excerpt for two post queries?

I am new to Genesis, i created a child theme it has two post types, one for the THEMES i want to display and other for the PORTFOLIO. both of these are having the_excerpt in their loop, I want to add "View Theme" and "View Project" separately. I also want to control the limit of the excerpt for each one will have more excerpt to show and other will have less. the same filter is applied on both of the post types.


How to make woocommerce a private catalog

Are there any tutorials/functions/custom code that I could utilize to make my entire shop pages completely private to users? I need a private shopping experience for logged in users only. My client sells items to only a few local brick and mortar stores. Only these customers will have access to the shopping cart. But I still want to make other pages on the site viewable publicly such as the Home Page, About, Us, Contact, Etc... What would be the best way to make my shopping cart private?


$wpdb->prepare - supporting multiple search terms

I am trying to write an escaped SQL statement, for example:               $sql = 'SELECT * from TABLE where column LIKE %searchterm% AND column LIKE %searchterm2%';      Except I don't know how to handle it, as I do not know the number of searchterms the user has entered. How would I prepare this?               $wpdb->prepare( $sql, $searchterm, $searchterm2 );      If the user enters 3 search terms it won't be utilised?


Advanced Custom Fields (ACF) Plugin - Random Image in Sidebar

I’ve created a Custom Post Type, “Slide”, and I’m attempting to load a random slide image, with title and caption, in my sidebar. I’m using the Advanced Custom Fields Plugin for the post/slide creation. The code below is what I have in my sidebar.php – I do get a random post loaded in the sidebar (showing title and caption) but the image URL does not output/echo, just `<img src="" />` Can anyone tell if I have ACF code wrong or maybe using the WP_Query wrong?                   <?php $args = array(              'post_type' => 'slide',              'posts_per_page' => 1,              'orderby' => rand         );         $attachment_id = get_field('slide_photo');         $size = "medium"; // (thumbnail, medium, large, full or custom size)         $image = wp_get_attachment_image_src( $attachment_id, $size );         // url = $image[0];         // width = $image[1];         // height = $image[2];              $loop = new WP_Query( $args );         while ( $loop->have_posts() ) : $loop->the_post();                  echo '<img src="';             echo $image[0];             echo '" />';             the_title();             the_field('slide_credit');              endwhile; ?>


Add information above a custom post type listing of all posts page

Ok, that sounds like a rather confusing title, let me explain. I have created a custom post type (CPT) and I want to add some summary information about the posts of that post type above their listing (where the filter and bulk action buttons are), the page in question would be:               http://www.example.com/wp-admin/edit.php?post_type={cpt}      Is there a hook for this ? Since I don’t really know what to call this area, i am not finding anything doing any further searches.


Issue when uploading past 8MB?

So I downloaded a plugin that sets your max_file_upload to 250 MB and I set my php.ini to the same. I own server so it is not a server issue - I have many apps that upload very large video files. When I am trying to upload a file, no matter how large (up to 200MB tested), it shows that the file uploads in the progress bar. If it were going over the upload limit I get an error telling me file is too big - but this is not the case. Instead a second or two after hitting 100% on progress bar it times out with "http error". Seems like a memory issue with WP so I added define('WP_MEMORY_LIMIT', '250MB'); Doesn't work. Let me know what else I can do. It is not an issue with server. When I do phpinfo it shows 250M and I have upload many files larger than 8M on other apps on same server. Name of the plugin is PBP Increase upload limit. Also when I do not have the plugin on I cannot download big files at all. With the plugin I can download the file - but when it gets to the "crunching" progression it faults out with the http error.


Posts with Tag on Bottom of Page

I have a plugin request that I cannot find by a Google search because I can't think of what it would be called: I need a plugin that will, on a page-by-page basis, allow me to define a list of tags (probably via a Custom Field), and should show the most recent 5 (or any number) posts that have that tag on the bottom of the page. Thanks!


How to remove text "Log In" from login page

I am using Theme My Login and have noticed that, even though I am customising my own `login-form.php` template and simply including the appropriate form on a blank page with `theme_my_login();`, the text `Log In` is always appearing and is _not even in a selectable DOM element_ :               Log In     <div class="login" id="theme-my-login1">       <form name="loginform" id="loginform1" action="http://domain/login/" method="post" target="_blank">       ...      I'm wondering if there is any way to remove this 'Log In' text? I'm not sure where it is coming from. I've also tried hooking `login_headertitle` as in this Codex Article.


How to get a meta value from all post

I searched for a while but I didn't find any solution. I used the functions listed here. It outputs something like this:               Array     (         [0] => 15         [1] => 30         [2] => 50     )      But I want something like this:               Array     (         [post_id_1] => 15         [post_id_2] => 30         [post_id_3] => 50     )      And this is the $wp query that is used in the function:               function get_meta_values( $key = '', $type = 'post', $status = 'publish' ) {         global $wpdb;         if( empty( $key ) )             return;         $r = $wpdb->get_col( $wpdb->prepare( "             SELECT pm.meta_value FROM {$wpdb->postmeta} pm             LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id             WHERE pm.meta_key = '%s'              AND p.post_status = '%s'              AND p.post_type = '%s'         ", $key, $status, $type ) );         return $r;     }


Display direct children of the current custom taxonomy in taxonomy.php template

Let’s say i have custom taxonomy named “Location” with hierarchial structure like the following : >   * ASIA > >     * CHINA >     * INDIA >     * JAPAN > >       * Fukuoka >       * Hokkaido >       * Okinawa >       * Tokyo > >         * Akishima >         * Machida >         * Tachikawa >         * ... >   * AFRICA > >   * AMERICA > >   * EUROPE > >   * ... > > On the taxonomy archive template (taxonomy.php) , i want to display links to all DIRECT CHILD of the current taxonomy being viewed. So for example, if someone view the “ASIA” archive page they will see link to CHINA, INDIA, and JAPAN archive page only and exclude the “grandchildren” taxonomy. Then if someone view the JAPAN archive page they will see a link to FUKUOKA, HOKKAIDO, OKINAWA, and TOKYO only . Same behavior until it reach the taxonomy with no children and obviously nothing will be displayed Please help me what to do, i’ve tried several method but none of them work. Most of the solution i found only manage to display ALL the children taxonomy including the grandchildren. So instead work like i explained above, the “ASIA” archive page will display all link to CHINA, INDIA, JAPAN, Fukooka, Hokkaido, Tokyo, Akishima, ..... I want to display ONLY the direct children of the current taxonomy and exclude the grandchildren.


Within the database, where is the flag which says that a user has Super Admin rights?

I have an user in a Wordpress Multisite installation and have access to the Mysql database, I would like to give myself super-admin rights to access the wp-admin/network page. Where can I do it on Mysql? I looked the database and I think the wp_usersmeta table is the one, but I have no idea how Wordpress manages the roles within the database. Any help?


A hook that runs only when the theme is previewed

Is there a function or a hook that runs only when a theme is previewed? I'm referring to the preview feature that you get on the Appearance->Themes page. The reason for this is that I want to **change specific design aspects on the theme but only when the user is previewing it**.


How to add super admin to all sites

Is there a way to add super admins to ALL sites without having to add them to each site individually? My group of super admins needs access to all sites.


Remove an uploaded header image

I'm developing a theme which supports a header image, when you've uploaded a few header images you can select to show them randomly as header image. When you want to remove one header image you can do that in the Media Library, but isn't there an easier way to remove them? Let's assume there are about 200 images in the Media Library and somewhere between them is a header image which you'd want to remove, how would you remove it? I believe there should be an easy way to remove a specific header image in the "Header" screen, but I can't seem to find this option (most probably because it doesn't exist)? **EDIT** ![Part of the WordPress custom header screen](http://i.stack.imgur.com/C5166.png) Currently there are 4 header images uploaded, these are shown randomly. Let's say I want to remove one header image so only 3 are shown. Is there are an other way rather than going to the Media Library looking between all the files for that one header image (really annoying) and then deleting it, to delete one single header image?


Remove Widgets in Dashboard

Another noob question...when authors log on and access their Dashboard, they see all sorts of widgets such as an Internet Explorer warning, news on what's going on with WordPress. Is there anyway to remove all of these for all users (present and future), so that they only see the 'Quick Press' & 'Right Now' widgets? Thanks!


Good plugin for managing outbound links?

I've looked around and around for a good WordPress plugin. I know this is a shopping question, but such an important aspect of managing your WordPress blog, I'm surprised to find that there isn't a more standard selection. Specifically, I need a plugin to help with:   * Set rel="nofollow"    * Open outgoing links in new tab/window   * Bulk processing   * Well-maintained What do you use?


url rewrite .htaccess extension to permalink

I have a custom page and template, that I'm passing a query-string to. It has a wordpress permalink like so /mypage/ I want to be able to add another rule so that the permalink receives a slug /mypage/this-slug is rewrote to /mypage/?myslug=this-slug


Creating a plugin that will display text on every page

I know there is going to be an easy way to do this but I just can't seem to find the best practice for the following; I have a plugin which when complete should generate HTML on every page, I want it to do this without the need for JavaScript and I want it to be independent of the theme when possible. It will appear on every single page, so it can't be a shortcode in a template file (but would a shortcode in the header.php file be appropriate?). Ideally there would be a hook that would allow me to insert code after the `<h1>` tag in the header (don't think it will be just that easy though!) Could someone point me in the right direction or send me some pseudocode to help me on my way? **Edit** Brian asked me What exactly are you trying to insert and where on the template, here is my answer; It will be a element styled from within the plugin with an options value generated by the plugin. It will be appearing at the top right of every page, in the header of the page.


why doesn't the_content() work in this {single-custom_post_type.php} page?

This code is from my page `single-publication.php`. It outputs the relevant custom fields etc (here wrapped in template tags), but `the_content()` won't output the post content. I've resorted to using `$post->post_content` (which works), but the mystery remains:
         <?php printf("
%s
", get_the_title() ); ?>
<?php the_publication_credit(); ?>

<?php the_publication_date(); ?>

<?php echo $post->post_content; // the_content() doesn't work. Why not? ?>

      What's going on here? **EDIT:** I was driven to ask this question because I believed - mistakenly, as it turns out - that `$post` working and `get_the_title()` returning a title were an ironclad sign of being inside the loop. But apparently this is not the case. cf Codex on The Loop (second para) and Codex on get_the_title() (parameter list). Can anyone explain?


Automatically create a new page daily with last three posts

Is it possible to create the following:   * A new page dynamically daily, containing the last three posts   * Archive this page, so that tomorrow's page is a new page, with the three newest posts Basically I'd like to use WordPress for our news releases, we publish three each day. The day's page should contain all three stories, and then be archived so the next day's page can be created. If you have any ideas how to setup something like this I'd appreciate it.


Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !

What I want to do is a loop like this is something like this I'm really sorry but its hard to format here! I going to put this short url http://pastebin.com/dEdKzgJz so you can see it better... Can anyone help me with this? Any advice! Category 1   ........Child Category 1.1   ...........Sub-Child Category 1.1.1   .................Post Title 1   .................Post Title 2   .................Post Title 3 Category 2   ........Child Category 2.1   ...........Sub-Child Category 2.1.1   .................Post Title 1   .................Post Title 2   .................Post Title 3 Category 3   ........Child Category 3.1   ...........Sub-Child Category 3.1.1   .................Post Title 1   .................Post Title 2   .................Post Title 3


Custom taxonomy admin description

Is it possible to add a short description to a custom taxonomy's admin area? For example, I've added a taxonomy that determines what kind of banners are displayed on a post's page. In the meta box for this taxonomy on the Edit/Add Post page I'd like to add a little blurb explaining how it works.


Using HTACCESS for Secret Access

I saw this post yesterday http://digwp.com/2011/01/simpler-login-url/ where a 'custom' word is used to direct the user from `url.com/admin` to `url.com/wp- login`.php and I'm asking (also did so in the comments without an answer) if its possible to **deny any access** to the admin **unless used a secret url** , so if a user is not logged in and tries `url.com/wp-admin` or `wp-login.php` he's denied access and only if he tries `url.com/my-secret` he's then redirected to the admin? thoughts?


Modify WP-Admin login fields

Hi is it possible to modify the login fields required to login into wp-admin? Say to use the email address instead of the username together with the password to gain access. How would I go about doing that? thanks


Conflicting save_post functions when passing the post id and saving custom meta boxes for different post types

Post save functions are conflicting with each other when adding them to the save_post action hook. 2 different custom post types with 2 different (one for each post type) custom meta boxes. I'm only including the code for 1 of the meta boxes. The other one is very similar and each one works fine separately but not together. ### The 'register_metabox_cb' call back function:               function c3m_video_meta() {         add_meta_box('_c3m_video_embed', __('Enter Video Embed Code In the Box Below') , 'c3m_video_embed', 'video', 'normal', 'low');         }      ### Adding the meta box to the post edit screen:               function c3m_video_embed($post) {         global $post;         wp_nonce_field(__FILE__,'video_nonce');         $embed-code = get_post_meta($post->ID, '_embed-code', true);         echo '<input type="text" name="_embed-code" value=""' . $embed-code . '" class="widefat" />' ;          }      ### The save function:                 function c3m_save_video_meta( $post_id , $post ) {                       if ( !wp_verify_nonce( $_POST [ 'video_nonce' ], __FILE__ ) ) { return $post ->ID;                  }                 if ( !current_user_can( 'edit_post' , $post ->ID )) return $post ->ID;                  $c3m_video_embed-code [ '_embed-code' ] = $_POST [ '_embed-code' ];                              foreach ( $c3m_video_embed-code as $key => $value ) {                              if ( $post ->post_type == 'revision' ) return ;                                   $value = implode( ',' , ( array ) $value );                             if (get_post_meta( $post ->ID, $key , FALSE)) {                              update_post_meta( $post ->ID, $key , $value ); } else {                              add_post_meta( $post ->ID, $key , $value ); } if (! $value ) delete_post_meta( $post ->ID, $key );                              }     }      ### The action hooks: `add_action( 'admin_menu' , 'c3m_video_meta' );` `add_action( 'save_post' , 'c3m_save_video_meta' , 1, 2);` This is fine and dandy and works but when I add another meta box to a different post type and use a similar function (different function name, nonce name and key ) when the post is saved I get this error: > Notice: Undefined index: _embed-code in > /Applications/MAMP/htdocs/wordpress/wp-content/plugins/ieew-custom- > functions/ieew-custom-functions.php on line 181 > > Warning: Cannot modify header information - headers already sent by (output > started at /Applications/MAMP/htdocs/wordpress/wp-content/plugins/ieew- > custom-functions/ieew-custom-functions.php:181) in > /Applications/MAMP/htdocs/wordpress/wp-includes/pluggable.php on line 897 The undefined _embed-code is when saving the post that does not contain the _embed-code variable. Since the error messages are reversed depending on wich post type I try to save it leads me to believe that both (2 different) save functions are being added to the save_post action. They are also being added when saving a normal post. If I'm only using 1 of the save functions there are no errors when saving a normal post. Rather than this question being a **"Fix My Code"** question I would rather the answer contain the how and why of adding custom meta boxes and using the various nonce methods. Sure I could use the More Fields plugin but I would rather learn the best way to accomplish customizing the post edit screen with custom content types. I have used this same code and method to add multiple meta boxes to a single custom post type and it has always worked fine.


CSS - why does my sidebar drops to the bottom of the page?

I spent almost an hour searching why my sidebar here: http://www.r-bloggers.com/ Is dropping to the bottom of the page. Could you please advise on how to fix it? Thanks.


Extract visitor and other measure data from Wordpress

Is it possible to extract visitor data (such as number of views, time of views etc) from Wordpress or do you have to use the WP back-end or GA? Thanks Rich


How to know which order Wordpress places CSS files?

I've installed the Roots theme (version 4 so I can use the 1140px Grid) on Wordpress 3.3.1, and want to edit the CSS. Initially I only get the style.css file in the editor and can't see the others. The css files I need are located in a subfolder marked 'css', and I see from a quick Google search that there is a known bug with css subfolders, so I moved them into the root folder which seems to be working, but the site now looks a bit wonky, so I don't think it's quite right. How do I ensure that the css files are placed in the right order in the Wordpress code? At the moment I don't know how to find out which order they have been set in. Thanks, Jason


Edit Custom Database Tables in Wordpress

I have a site that uses custom database tables to manage info that is inserted by a process completely independent from Wordpress. The data from the table is used in the Wordpress site but it is not manageable through the Admin interface. I want to make it manageable via the admin backend. What is the basic process for this? In my mind I need to create a link in the Admin sidebar to "Manage Custom Data" and that link opens up a page that permits basic CRUD management of the various rows in the table. This would be effortlessly simply in vanilla code but I am not familiar with such custom aspects of modifying Wordpress so I am just looking for pointing in the right direction. Give me the big picture, in other words.


Using Amazon Book Gallery Plugins in Wordpress

I am new to WordPress plugins. I have installed "Now Reading Reloaded" Plugin. My objective is to display bunch of books which i am reading or referring on a separate page : Books. I have installed, Activated, Also registered the Amazon Web Services Access Key ID. How to set the Plugin to the Books Page and make the list of books to display on that page?


Page of posts made to look like homepage

Is there any way i can get a page of posts from a certain category to look like the homepage (twentyeleven theme) of just blog posts? Thanks


How to redirect url requests to https?

I've searched far and wide for a solution to this and I am sure it's simple but I simply couldn't find a solution. This is the regular wordpress redirect code:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      How do I make it so that this will always route the url request to `https://`? **Note** : The reason this is posted here and not on any other SO site is that I thought there might be a catch when it comes to WP. BTW, I put the same question on ServerFault and got a big **On Hold** because "I did not try to solve this myself".


replace the WP_Query class in the main query

For a project I needed to heavily modify the behavior of WP_Query. So what I did was extending WP_Query basically like this:               class eacf_shared_query extends \WP_Query {              function query( $query ) {                  // do things before ...                  $posts = parent::query($query);                  // do things after ...                  return $posts;         }      This works like a charm for all my custom queries for which I now use my extended class, but I'm unable to find a way to stuff this into the main_query. So my question is: **Is there any known way to replace/extend the WP_Query class in the main_query?** * * * I did find the above to be the only solution and didn't get any further with using the filters supplied within the original class cause:   * There seems to be no filter pair that is guaranteed to be run before and after the query so I can't safely achieve a construct like in the example above.   * My _"do things after"_ logic contains nested calls to WP_Query() which too easily end up in a query-loop if I use filters.   * The SQL filters seem to be not powerfull enough to create a single query fetching all of the posts (like building a UNION query). I'm in the need of merging posts from different blogs in one query and it seems this can't be achieved with filters like `posts_clauses_request` or `query`.


How do I show a different secondary navigation menu for each section of my website?

My site is organised into three sections, like this:   * Reiki Basics (page ID 499) – page 1.1 – page 1.2 – page 1.3   * Practice & Study (page ID 501) – page 2.1 – etc   * Courses (page ID 471) – page 3.1 – etc. These all display in the primary menu at the top of the page. When you hover over ‘Reiki Basics’, you see an accordian come down with pages 1.1, 1.2 and 1.3. I want to create a secondary menu, in the sidebar, that only shows sibling pages (and the parent page). For example, when the user is browsing any page in the section 'Reiki Basics', including the 'Reiki basics' page itself, they would see links to all the pages in this section (1.1, 1.2, 1.3). They wouldn’t see pages from other sections. The same would work when they are browsing pages in section two. I want this menu to be created automatically for all new pages. I would rather not install any new plugins, although I do already use 'widget logic', which might help.


Update Post Meta of crowdfunding plugin on click front end

I'm using the astoundify crowdfunding plugin which has a lot of custom fields while creating a campaign. I'm trying to create a _save and preview_ functionality on that page. There are at least 20 custom fields, I'd like to update from the front end when the user clicks on the save and preview button. so that When they come back to the campaign they can start where they left off. I'm going to show two of those fields, please tell me how this can be accomplished, in context to the 2 fields I have added below. There is a submit button on the page, which probably is doing the same thing but it validates and submits the campaign, I'm sure there is a way to just store the information added in the session to the database to edit and submit at a later time via the update_post_meta() function. Any help would be greatly appreciated as I've spent 2 days on this already.               <p class="atcf-profile-info-<?php echo $key; ?> atcf-box">     <label for="<?php echo $key; ?>"><?php printf( __( '%s URL', 'atcf' ), $method ); ?>     <input type="text" name="<?php echo $key; ?>" id="bio" value="<?php echo esc_attr( $user->$key ); ?>" />
     <?php _e( 'Biography', 'atcf' ); ?>     <textarea name="bio" id="bio" rows="4"><?php if(isset($user->user_description)) {echo esc_textarea( $user->user_description );} ?></textarea>


Creating array to compare custom field values

I think I need some guidance here. I have a list of custom posts on a an archive template page that displays information from each of the custom posts. They are looped through using WPQuery:               <?php $restypes = new WP_Query( array( 'post_type' => 'reservation_type', 'posts_per_page' => -1 ) );?>      Each post has a several custom fields: `$price`, an optional `$promo_price` and a variable `$per` which determines if the price is per-person or per-room based on a custom taxonomy. The best price is then determined like so:                 if(in_array( 'dorm', $per )){           $person_room ='per-person';       } else {           $person_room ='per-room';       }              $post_id= $post->ID;       $promo_price = get_field('promo_price');       $norm_price = get_field('price');       $p_per_room = get_field('people_per_room');            if ($promo_price && !empty($promo_price)){                  if($person_room == 'per-room'){                 $addprice= $promo_price /$p_per_room;             } else {                 $addprice= $promo_price;             }                  $prices[$post_id]= $addprice;            } elseif ($norm_price && !empty($norm_price)){                  if($person_room == 'per-room'){                 $addprice= $norm_price /$p_per_room;             } else {                 $addprice= $norm_price;             }                  $prices[$post_id]= $addprice;       }            $best = array_keys($prices, min($prices));      My problem is that the array `$best` is not complete until all the posts have been looped through. The point of all this is to be able to add:               <?php     if(in_array($post->ID, $best)){?>

Best Price

     <?php  } else { ?>
     <?php } ?>      thus giving a different style to the item with the best price per-person. My question is would I need to create a separate loop to populate the `$best` array in order to do this? Or is there a better way? I was thinking initially of using the `orderby => 'meta_value_num'` having calculated the best price as a function and adding a meta value. PS The `get_field()` function comes from Advanced custom fields.


get_template_part and template file names

I have a custom post type that is going to use a loop in a couple different places and I wanted to make maintaining those loops easier. I remembered that get_template_part() is available and figured this would be an optimal time to get used to it. However, what has me at a standstill is how to set up a file for the loops so that I can call the specific parts accurately. Google, thus far, has been not helpful in understanding how get_template_part() and twentyten's loop.php actually work and call the 3 parts. I have it duplicated, stripped down and ready for altering for my CPT version, but that is it thus far. Any help?


mo / po translation files does not seem to work

I have a theme that was bought from themefuse and they say it supports localisation using a plugin called CodeStyling Localization However even though I make the necessary steps to translate strings in the theme, the translated texts do not appear in the frontend. The steps I have taken:   1. installing plugin   2. scan the theme    3. translate a few words   4. build "mo" file from plugin menu   5. empty cache + refresh ... no result Any ideas?


setting featured image is not working while running script in background, works when running that script from browser

I have creted a script which will fetch content from one of my site and automatically create new post in my wordpress blog. When I am running that script from browser, its working really cool! post is being created, intended image is being set as featured image but when I am trying to run it from background or as a cron job, post is being created, published but the featured image is not being set. Please suggest me the proper solution. Here is my code to set the featured image.               $wp_filetype = wp_check_filetype(basename($filename), null );     $wp_upload_dir = wp_upload_dir();     $attachment = array(             'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),             'post_mime_type' => $wp_filetype['type'],             'post_title' => preg_replace('/\.[^.]+$/', '', basename($post_title)),             'post_content' => 'just xyz',             'post_status' => 'inherit'     );     $attach_id = wp_insert_attachment( $attachment, $filename, $parent_post_id);     require_once(ABSPATH . 'wp-admin/includes/image.php');     $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );     wp_update_attachment_metadata( $attach_id, $attach_data );     if( $featured )     {         set_post_thumbnail($parent_post_id, $attach_id);     }      Additional info if it can help you in finding the problem. `wp_get_attachment_image` was not even working exactly after attaching image and executing above code. It was returning empty string.


Permalinks for custom taxonomy stopped to work

I'm not sure when this happened, I just noticed it. I have custom taxonomies and post types. For the longest time I was able to go to `domain.com/taxonomy/term` and it would display the posts related. Now it's not. I'm still able to access it by `domain.com/?taxonomy=taxonomyhere&term=termhere` The last time I remember this working I was on Apache but have recently moved over to nginx. I thought I tested a while ago and it and it was working though.


Best way to load page content in Fancybox popup?

I would like to have some links which load the page content of the page they reference to inside a Fancybox popup(pages like "shipping" or "returns", mainly text content). I would create the pages an then I will add the permalinks to these pages to other sections, like footer or sidebar, and they will open in the popup window. Have you come across anything like that? What would be the best way to implement it?? Any suggestion will be greatly appreciated.


What are the permalinks options for "Category" base and removing it?

Under "Settings > Permalinks", we can set up the default category base name to use for our category landing pages. For example, site.com/ **categories** /my- first-category/. Is there **a setting I can add to my functions.php** to allow the option to remove the category base and direct link to the category? For example, the above link becomes: site.com/my-first-category/ I realize that this opens up the possibility of having conflicting post names and category names (assuming I have a post slug that's the same as a category slug for example), but in this case, my post permalinks end in .html and my category permalinks will not, so there should never be a conflict (I expect).


Get comments only for certain specific users in template file

To return comments for a specific user, I use the code below:               $arg = array('user_id' => $userID);      $coms= get_comments( $arg );       How can I modify the arguments of this function so that I get comments for a group of users (get only comments for specific 2 or 3 users)? The arguemnt 'user_id' should be an integer, I cant find a way to pass an array. Or should I use PHP or SQL to get my goal? Your time and consideration of this issue is appreciated.


How can I stop WP media uploader from creating duplicates of my uploaded images?

I have a setting in my theme that seeks to prevent the WP media manager upload utility from creating multiple copies of each image I upload. Apparently the latest versions of WP have changed the required settings to defeat this? Here's the current settings I have in my theme's functions.php...               if(get_option('thumbnail_size_h')!==0){update_option('thumbnail_size_h', 0);}     if(get_option('thumbnail_size_w')!==0){update_option('thumbnail_size_w', 0);}     if(get_option('medium_size_h')!==0){update_option('medium_size_h', 0);}     if(get_option('medium_size_w')!==0){update_option('medium_size_w', 0);}      Even with these settings, I'm still getting a duplicate image every time I upload. For example, if my image filename is foo.jpg and it is 800x600 pixels, WP creates two images foo.jpg and foo-800x600.jpg How can I force WP to not create the duplicate?


How do I pass an array as an argument to a WP-CLI command?

I want to use WP-CLI to create some new posts with custom taxonomy terms assigned. The challenge is that wp_insert_post's `tax_input` argument only accepts arrays, which I would have to specify on the command line. According to the codex, here is the format required:               $post = array(         'tax_input' => [ array( 'taxonomy_name' => array( 'term', 'term2', 'term3' ) ) ] // support for custom taxonomies     }      But I need something like this:               wp post create --post_type=lecture --post_title='Test Post #1' --tax-input=[BIG FAT ARRAY]      So my idea was to write a PHP script that executes the WP-CLI command with the array serialized:               //DEFINE VARIABLES     $post_title = "Test Post #1";     $tax_items = array( 9,11,17 );     $tax_input = array( 'course' => $tax_items );          //SERIALIZE THIS ARRAY     $tax_escaped = escapeshellarg(serialize($tax_input));          //WRITE THE COMMAND     $exec_string = 'wp post create --post_type=lecture --post_status=publish --post_title="%1$s" --tax_input=%2$s --porcelain';     $exec_command = sprintf($exec_string, $post_title, $tax_escaped );     $post_id = shell_exec($exec_command);          //THE OUTPUT     //wp post create --post_type=lecture --post_status=publish --post_title="Test Post #1" --tax_input='a:1:{s:5:"class";a:3:{i:0;i:9;i:1;i:11;i:2;i:17;}}' --porcelain          //RELATE THE NEW POST TO THE TAXONOMY TERMS     wp_set_object_terms( $post_id, $tax_items,'course');      Alas, this doesn't work. It creates the new post alright, but it fails to assign the 'course' taxonomy categories I want. Any help would be appreciated. I know that this overall strategy works, because I succeeded in creating and taxonomizing my posts using `wp_insert_posts`. So this exercise is for educational purposes and future reference.


Determine page content based on page parent

How can I display a gallery shortcode for pages who are children of the page with an ID of 9, and the regular content for pages who aren't? This is what I've tried so far, but it's not working:               <?php global $wp_query; if( (9 == $ $wp_query->post->post_parent ) :?>         <?php echo do_shortcode('[gallery link="file" columns="1" size="large"]'); ?>     <?php else (); ?>         <?php the_content(); ?>