title: Why does pagination always break when used on any form of a home page?

text: Why does WP pagination break when used on the homepage? If you take the code below and use it in a page template it works perfectly (make sure you have 3 or more posts). However, as soon as you use the same code on home.php, front-page.php, index.php or even as a page template but set as a static homepage, it breaks. The URL shows `/page/2/` but you get a 404 page. If you change the URL to `/?page=2` it works. I have seen so many questions related to this all over the place, yet none have a solution that works. For the sake of simplicity I have simplified the loop below and I'm using the default WP next and previous posts links. I don't wish to use a plugin such as WP-PageNavi or similar.               <?php get_header(); ?>              <?php                  // taken from https://codex.wordpress.org/Pagination             if ( get_query_var('paged') ) {                  $paged = get_query_var('paged');              }              else if ( get_query_var('page') ) {                 $paged = get_query_var('page');              }              else {                 $paged = 1;             }                  $wp_query = new WP_Query( array(                  'posts_per_page' => 2,                 'paged' => $paged             ));              ?>              <?php if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                   <?php the_title(); ?>              <?php endwhile; endif; ?>              <?php previous_posts_link(); ?>         <?php next_posts_link(); ?>              <?php wp_reset_query(); ?>          <?php get_footer(); ?>


title: Custom order for Mysql array

text: I have a Page of Posts, each post has a Custom Field "expired" which contains a date in the format YYYY-MM-DD which is used to order the posts. This date is used for a script that tells the visitor if an offer has either expired or is valid for X days more. My array is as follows:               $postid = get_the_ID();     $meta1 = get_post_meta($postid, 'shop', true);     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(     'post_type' => 'post',     'meta_query' => array(         array(             'key' => 'shop',             'value' => $meta1         )     ),     'paged' => $paged,     'posts_per_page' => '4',     'meta_key' => 'expired',     'orderby' => 'meta_value',     'order' => 'ASC'     );          $query = new WP_Query( $args );      This orders the posts using the meta_value of "expired", earliest date at the top. When the "expired" meta_value date is before 'TODAY' the post script will show "EXPIRED" When the "expired" meta_value date is after 'TODAY' the script will show "Expires in X days" **How posts currently display:** When a post 'expires' it currently stays at the top of the post list.               Post 1: Expired     Post 2: Expired     Post 3: Expires in 3 days     Post 4: Expires in 4 days     Post 5: Expires in 6 days      **Instead, I'd like to automatically order it thus:** (note Post # for comparison to above)               Post 3: Expires in 3 days     Post 4: Expires in 4 days     Post 5: Expires in 6 days     Post 2: Expired     Post 1: Expired      How can I create a custom order where once a post expires (ie. it's 'expired' date is before Today's date) it is put to the back of the post list yet still above older expired posts? Thank you.


title: Add custom attributes to a post

text: My blog is mainly composed of posts describing hiking. Actually, since I just moved from a Wordpress.com blog to a self-hosted Wordpress blog, every hike is inserted in a simple post. However, every hike has certain parameters (e.g.: ascent, length, difficulty, ...) I'd like to save in the database in form of attribute and not simple text. My idea would be to use Wordpress to:   1. Automatically fill-in the hiking list page.   2. Add a search form that will help the reader to find the best hike for him, on the basis of certain parameters (for example: "I do not want to exceed 1'000 meters of ascent"). Essential requirement is that the permalink URLs will not change because the blog has been active for a few years. I was wondering: might the _Wordpress Custom Post Types_ work for my specific case? Or are there better solutions? Might I use the _Custom Meta Boxes_ for the hike's attributes like ascent, length and difficulty? To create the hiking list page could I use the _Shortcodes_? How can I implement the search form that will help the reader to find the best hike for him?


title: how to place a link on the first post only using a plugin

text: i want to add a link to the first post of every WP blog that i have. For example this simple function adds the link to every post.                   function add_link($link){              $link .= 'Link';     return $link;         }         add_filter('the_content','add_link');      so basically instead of the link showing below each post, I want it to show only at the bottom of the first post only. thanks.


title: All URLs are having '/blog/' appended to them.

text: I just made a WP theme, and I'm using a custom page template for the blog and for the home. The problem is that all the URLs now have /blog/ appended to them (which, I believe is the name of the page that's using the Blog Page Template). Following an article in the Codex, I made the Blog page template empty, and instead added the blog content to `home.php`. What am I doing wrong?


title: Why a SlideShow (made using JQuery FlexSlider) can't work if I load it form functions.php but work if I load it from my footer.php file?

text: I have the following situation: I am carrying this pure HTML theme (that use BootStrap CSS framework) into a WordPress theme. This is the original pure HTML demo theme (I have the entire source code because it is a downlodable example): http://www.html.it/guide/img/bootstrap/demo/home.html And this is my personal WP theme on wich I am working on: http://onofri.org/WP_BootStrap/ As you can see the only difference from the original demo website and my personal WP theme is that in the second one the SlideShow in the header (made using the flexslider JQuery plugin) is not shown. I have do the following operations: 1) In my footer.php file I have disabled the JavaScript loading commenting them and I call **wp_footer()** , in this way:                   <!--         <script src="http://code.jquery.com/jquery.js"></script>         <script src="/wordpress/wp-content/themes/AsperTheme/assets/bootstrap/js/bootstrap.min.js"></script>         <script src="/wordpress/wp-content/themes/AsperTheme/assets/plugins/flexslider/jquery.flexslider.js"></script>         <script src="/wordpress/wp-content/themes/AsperTheme/assets/plugins/fancybox/jquery.fancybox.pack.js"></script>         <script src="/wordpress/wp-content/themes/AsperTheme/assets/js/scripts.js"></script>         -->         <?php wp_footer(); ?>     </body>      2) I have insert the following code into my functions.php file to load all the previous JavaScript using the WP standard way:               /* Function automatically executed by the hook 'load_java_scripts':      * 1) Load all my JavaScripts      */     function load_java_scripts() {              // Load JQuery:         wp_enqueue_script('jquery');         // Load FlexSlider JavaScript         wp_enqueue_script('flexSlider-js', get_template_directory_uri() . '/assets/plugins/flexslider/jquery.flexslider.js', array('jquery'), 'v2.1', true);         // Load bootstrap.min.js:         wp_enqueue_script('bootstrap.min-js', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', array('jquery'), 'v3.0.3', true);              // Load FancyBox:         wp_enqueue_script('fancy-js', get_template_directory_uri() . '/assets/plugins/fancybox/jquery.fancybox.pack.js', array('jquery'), 'v2.1.5', true);         // Load scripts.js:         wp_enqueue_script('myScripts-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '1.0', true);         // Load Modernizer:         wp_enqueue_script('myodernizer-js', get_template_directory_uri() . '/assets/js/modernizr.custom.js', array('jquery'), '2.6.2', true);          }     add_action('wp_enqueue_scripts', 'load_java_scripts');      As you can see I set all scripts depend on JQuery so JQuery is loaded first. But as you can see the **jquery** and\or the **jquery.flexslider.js** can't work. The strange thing is that I change the end of my **footer.php** file in this way the SlideShow is correctly shown:                   <script src="http://code.jquery.com/jquery.js"></script>         <script src="/wordpress/wp-content/themes/AsperTheme/assets/plugins/flexslider/jquery.flexslider.js"></script>              <?php wp_footer(); ?>     </body>     </html>      So what am I missing? What could be the problem? Looking at the source code of my website (into FireFox) it seems to me that all the JavaScript is loaded but can't work, the SlideShow not appear. What is the difference?


title: Is this a good case for Multisite?

text: Okay, I'm sort of new to Multisite and I've seen a few cases that state one _should_ use it, and similarly one _shouldn't_ use it. I suppose I'm trying to figure out what's a Best Case scenario. I run several WordPress sites on my VPS, a couple using WooCommerce, some are just blogs. The case I'm trying to identify currently is for a client I'm hosting. The client has 1 site currently but wants to move to a 3 site type approach.   * **Site 1** : Basic Overview of Services between the 2 sub brands, sharing some content from each if the following sites but not ALL   * **Site 2** : Vehicle Performance Products and Services   * **Site 3** : Vehicle Entertainment and Aesthetics So each Site 2 & 3 may share information also, but not all of the pages. So my question is, can a Multisite be the proper way to do this type of thing or should I be thinking of developing a custom solution entirely (which is the road I started down on first)?


title: Why do mass updates to post_content shows in front end, but not in edit screen?

text: We had someone migrate several blogs in Movable Type to Wordpress recently, but we just realized they missed some of the content that was in a database field in MT labeled *entry_text_more*. For various reasons, we do not want to have the original service provider work on this; so, we are trying to fix this issue with a UPDATE... JOIN... on the old *mt_entry* table and the new *wp_posts* table in the database. (All the old and new data is in the same database, with different table prefixes.) This command works:               UPDATE wp_posts        INNER JOIN mt_entry        ON entry_basename=post_name        SET post_content=CONCAT(post_content, '\n', entry_text_more)        WHERE entry_text_more IS NOT NULL          AND LENGTH(entry_text_more) > 0          AND entry_basename='a-sample-post-name';      (We're just using the last AND-clause for testing. Once it's working, we can drop that last AND-clause and do a mass-update.) We have run this query on several individual posts, and when we view those updated posts in the front-end, or SELECT it from the *wp_posts* table in the database, the *entry_text_more* has been appended to the existing WP content. However, when we go to Edit the post (to clean it up), only the old content appears in the Edit box, either in Visual or Text mode. And when we hit Update, the appended content disappears from the database, and of course from the front-end view as well. We have WP-Supercache disabled, and we even tried adding this to the wp- config.php file:               define('DISABLE_CACHE', true);      but that didn't help. Can anyone help us figure out how to get the appended content to "stick"?


title: How do you display a comment into a mail?

text:
So I want to notify the author (via mail) that his comment have been removed, and which post the comment was related to.                   // Mail author when their answer is deleted/trashed     function authorANotification($comment_id) {       $comment = get_comment($comment_id);     $author = get_userdata($comment->user_id);            $headers = "MIME-Version: 1.0" . "\r\n";            $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";            $headers .= "From: Fustions.com <admin@fustions.com>" . "\r\n";            $subject = "Your comment has been deleted";          $message = "
";         $message .= "
";         $message .= "
".$sitename."
";         $message .= "

";         $message .= "
";         $message .= "
Dear ".$author->display_name.",
";         $message .= "

";            $message .= "
Your comment: ".$comment->comment_text." - has been removed by an admin.
";         $message .= "
Read about why your comment might have been removed here: **********
";         $message .= "
Best regards,
";         $message .= "
Administration - Fustions.com
";         $message .= "

";         $message .= "
";                    wp_mail($author->user_email, $subject, $message, $headers);     }     add_action('trash_comment', 'authorANotification');      What am I doing wrong? And also, how do I display the title of the involved post? Thanks!


title: Retrieve a post's featured image with PHP outside of WordPress

text: I have a little Windows application that I would like to be able to use featured images from posts on my site with. My site lists and reviews modifications for a computer game and the application installs those modifications. Think of it as a very basic Steam, for those that know what Steam is. When a user installs a modification from a file on my site, I would like the application to visit the site, search for the file and then use the featured image within the application. I understand most of that is outside the scope of this thread, but is there a way to find the URL of the image using PHP but outside of WordPress? Perhaps from the post ID.


title: Add class to current post in query_post

text: I have a query like this;                                       <?php $temp_query = $wp_query; ?>                         <?php foreach(get_the_category() as $category) {                             $cat = $category->cat_ID; }                             query_posts('orderby=date&cat=' . $cat . '&order=desc&posts_per_page=-1');                          ?>      It grabs all the posts from the current category. What i then do with this information is create a list of all the thumbnails associated with those posts. What i would like to do is highlight in some way, the current post. (through a class or something), something that is obviously done automatically normally. Thanks Alex


title: Exclude Current and Sticky Post

text: On a single Post page I have a side bar displaying up to three other, related posts. How can I exclude both Sticky Posts and the Current post? I know how to exclude the Current post and how to exclude Sticky Posts by using post_not_in in a WP_Query, see code example below. But I guess you can not use post_not_in twice in the same query. Any suggestions?               $current_post_ID = get_the_ID();                  $args = array(                 'post_type' => 'post',                 'post_status' => 'publish',                 'order' => 'DESC',                 'orderby' => 'date',                 'posts_per_page' => 3,                 'post__not_in' => get_option( 'sticky_posts' )                 'post__not_in' => array($current_post_ID)             );


title: Any plugin/theme available which suits my requirement?

text: ![insighter](http://i.stack.imgur.com/Yx4LO.jpg) I have this WordPress website up. As one can see I've displayed alternate red and blue bands (which are images) with text written on them. I had the bands (around 100) manually created on Photoshop fitting in different sentences on them which is very tedious and time consuming. Are there any themes/plugins available where this kind of structure is available where I have to only add texts? I've searched on the net but no luck so far. Thanks in advance!


title: Getting 404s on New Pages

text: Can't figure out why this would be happening- wp install issue or .htaccess issue? I am using a theme but the same problem occurs with the default wp themes. After I create a new page (example: about), I get a 404 when I try to access it from the navigation or when I just enter the URL: domain.com/dev/about, I am also getting 404. WP installed in httpdocs/dev. All plugins are deactivated. Everything else appears to be working correctly.


title: Advice Needed for Post Meta Database Efficiency

text: So I have this custom post type and I have atleast 20 custom meta boxes for it which means there will be 20 postmeta rows. So my question is, since I have that many, would it make more sense to just create a custom table to handle this instead of having 20 separate rows, one for each meta value...etc. I would think there would be some kind of efficiency issues down the line if each 1 custom post equates to 20 post meta rows. It can add up pretty quickly I would assume. And yes I realize I can serialize the data so it only takes 1 row however, this would prevent search query from finding anything. What are your thoughts on this?


title: How to disable limit login attempts plugin

text: Its really sucking me. I have not installed limit login attempts plugin but it is working when someone get login failed. In the admin it is showing in under setting menu. I tried to disable it but it is not showing in installed plugin. I saw plugin editor also, it was not there. After it I open ftp and opened plugin folder and I did not find any limit login attempts plugin. Now how can I deactivate or disable this plugin. Thanks....


title: How to set a default page for load first time?

text: Now I am creating a WordPress site for an academy. But my client has more than one site. So I need to set a home page that contains choose site option at first time. Simply I need to set a home page which contains some site's link. Eg: When user enter into my site first time need to show a welcome page for the user.


title: Theme Development -> Specific Homepage

text:
I am a beginner to starting a Wordpress template from scratch, so I am open to any helpful links or help that can be given to me :) Questions:   * What would this file be called front-page or home.php?   * How could I make it so that both quotes are edited via the specific set page in the admin area? I have the following HTML Code:

"If you've got the right lawyer with you, we've got the best justice system in the world"

Robert Trott - Justice

Home »

My Expertise »

About Us »

Testimonials »

Case Reports »

Contact Us »

"I specialise in criminal defence and have done so for over ten years.  I have experience in all levels of criminal law from traffic law and minor offences to serious offences involving drugs, sexual violation, serious assaults or murder.

I will listen to you and give you honest and confidential representation."

Copyright © 2011 John Munro


title: Is is possible to rebuild wp_term_relationships table?

text: Stupidly, I truncated my posts table with out thinking about the term relationships. Now I have a bunch of 404s because there are broken term relationships. Is is possible to rebuild the table with the correct pairings?


title: How to show my sidebar in specific page only?

text: I would like to show a plugin in a specific page's sidebar only. **For Example:** I have the pages like ..   * home   * about us   *     * sub page 1   *     * sub page 2   *     * sub page 3   *     * sub page 4 **UPdate:** i want to show, **plugin 1** in **sub page 1** and **sub page 4 only** and not to all other pages.i tried `is_page('sub page 1','sub page 4')` but not working :(.please help me.


title: Show all post titles

text:
I want to make a parallax type link, but I have no idea how to go about it yet. I need to get all post titles with # link and then I can try the parallax thing. My current category page code bellow. I want to show all post in there..
         <?php if ( have_posts() ) : ?>
<?php single_cat_title('',true); ?>

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

<?php the_content(); ?>
         <?php endwhile;                  ?>         <?php else : ?>         <?php endif; ?>

      I get all post titles with content nicely. No problem .. but I want to add one div after H2 then want to show

title

title

title

title
     ...     ..
      How could I do that? Category page will be like bellow               **Category Title**          All Post Title (list)                    (under all post )          --------------     Post title     Post Content     ---------------          Post title     Post Content     ---------------          Post title     Post Content     ---------------          Post title     Post Content     ---------------          Post title     Post Content     ---------------


title: Is there a filter to programmatically change the HTML tab switching output of the page editor?

text: I am wondering if Wordpress allows us to change the onclick attribute of the tab switching in the HTML editor? For example this is the a tag for the Visual editor:               Visual      I would like to know if we can easily change the value of the onclick attribute using filters? Or any other means.. Thanks.


title: Customer portal (posts as checklist)

text: This is a pretty difficult one: We are extending our services for our customers. Our customers have to do some things like, buy a apple developer account, generate google analytics key, buy a google play account etc. I would love to setup standard posts and mark them as todo list for specific users. I've already setup a service custom post type with a couple of tutorials as posts but would like to add a metabox with registered users and mark a post as 'todo' and 'done'. When a user logs in I like fetch these and show them as seperate lists. Does anyone have a clue how to get started? I'm a designer myself and know a little bit of PHP but not hardcore..


title: Wordpress editor, change code wrap (bbpress?)

text: I am developing a theme and using jquery prettify to style code tags. Sofar I love prettify, and for the most part wordpress is cooperating. When text is wrapped in `<code>` tags everything works dandy. But on certain editors, and the bbpress topic / reply / edit , editor the code is wrapped in the the little dash marks just like on these forums, and sometimes the code gets all mangled. What I am looking to do is force every editor on my wordpress install , or atleast the `code` buttons on the editor to wrap code in tags instead of the little dash marks. I have looked at some filters but sofar i do not see how to change the output or behavior of the tiny mce fancy editor buttons thats standard with wordpress. Thanks for any direction or suggestions.


title: How to add tags (custom taxonomy) to post class css?

text: I am trying to figure out how to add my custom taxonomy for tags to the post class css when I already have added the custom taxonomy for categories. The code Im currently using to add the category taxonomy is -                 <?php $terms = get_the_terms( $post->ID, 'videoscategory' ); ?>       <div class="box<?php foreach( $terms as $term ) echo ' ' . $term->slug; ?>">      This works fine but I also need to add a class for tags I've created with a custom taxonomy. I came across this code that will add the regular tags, but I need to use my custom tags.               <?php $tags = get_the_tags();     if( $tags ) : ?>       <?php foreach( $tags as $tag ) { ?>        <span class="<?php echo $tag->slug; ?>"><a href="<?php echo get_tag_link($tag->term_id); ?>"><?php echo $tag->name; ?>       <?php } ?>     <?php endif; ?>      Thanks.


title: Single post page from static home not working

text:
I'm struggling with displaying a single post page. I have the following code on the static front page:               <?php                     $args = array( 'numberposts' => 5, 'order'=> 'ASC', 'orderby' => 'date' );                     $postslist = get_posts( $args );                     foreach ($postslist as $post) :  setup_postdata($post); ?>

<?php the_date(); ?>

                                 <a href="<?php get_permalink();?>">                                     <?php the_title(); ?>
                             <?php the_excerpt(); ?>
                 <?php endforeach; ?>      That fetches latest posts. I'm trying to understand how single post page works by copying it from twentytwelve wp theme folder but for some reason it doesn't work. I would really appreciate any help in pointing directions i should follow to make single.php work. Thank you.


title: How can I install WordPress as blog provider , stable?

text: can I make a Blog Provider like Wordpress.com? Which features and Plugin exist in wordperss.com but we cant have them in our clone site of WordPress free source?


title: Sorting WP Auctions by date/price?

text:
I'm using this plugin called WP Auctions with the List plugin, and as you may have guessed, it is to display a list of auctions on a page much like eBay where users can bid on items. It is simple to set up. I just need to activate it and plug in the shortcode. The reason why I am having trouble is because I want users to be able to sort the list of auctions by price and date. This is not built into the plugin unfortunately. However, the author did build filters into the shortcode so I can use something like this to organize the list by date:               [wpa_list_widget mode="list" order="date"]      Or I can use something like this to organize the list by price:               [wpa_list_widget mode="list" order="price"]      However, I can't put both shortcodes onto one page. So my idea was to use jQuery tabs (content via AJAX) and include one shortcode on the page and call the other one through AJAX. However, this doesn't seem to be working. Here is how I have the auction page template set up:

Order by date

<a href="<?php bloginfo('template_url'); ?>/auction_price.php">Order by price

         <?php echo do_shortcode('[wpa_list_widget mode="list" order="date"]'); ?>

      With this setup, tab 1 shows up fine; however, tab 2 (order by price) shows nothing, and nothing shows up in the HTML as well. In the above code, you'll notice that I am trying to call the content from 'auction_price.php'. Below is how I currently have the 'auction_price.php' template set up:               <?php require('./wp-blog-header.php'); ?>     <?php echo do_shortcode('[wpa_list_widget mode="list" order="price"]'); ?>      Just two simple lines. And finally, below is the script that starts it all up:               jQuery(document).ready(function($){       $(function() {         $( "#tabs" ).tabs({            beforeLoad: function( event, ui ) {               ui.jqXHR.error(function() {                   ui.panel.html(                     "Load fail." );             });           }         });       });     });      Any help would be massively appreciated!


title: How to add code to just before closing body tag

text: How would I put the following code, for a certain shopping cart, just before the closing body tag in my WordPress site? In the footer? It seems to me that I would only want to call startcart() for product pages. Thanks very much.               <script language="javascript" type="text/javascript">     startcart()     </script>


title: Loading by Ajax a plugin that also uses Ajax

text:
I'm having problems with some "contact form" plugins whose use Ajax. The problem is that I use Ajax to call the plugin. Then the plugin is loaded, but when I try to submit the form, I'm redirected to this URL: `SITE/wp- admin/admin-ajax.php`, when it should send the Ajax request, and only a `0` is printed on the window. I think I'm using Ajax correctly: `functions.php`:               function theme_name_scripts() {              wp_enqueue_script( 'mi-script-ajax',get_bloginfo('stylesheet_directory') . '/js/ajax-search.js', array( 'jquery' ) );         wp_localize_script( 'mi-script-ajax', 'MyAjax', array( 'url' => admin_url( 'admin-ajax.php' ) ) );     }               function llamadaAjax_callback() {         $pageId = 0;         $newSlug = '';         $reviewSlug = '';         $sPostType = 'any';         $sTemplatePart = '';         $sTaxonomy= false;              //Busqueda         if( isset(  $_POST['search'] ) ) {             $sTemplatePart = 'search-ajax';             $sPostType = 'any';         }         //Links         elseif( isset(  $_POST['href'] ) ) {             $pageId = preg_match( '/^http:\/\/.+\/\?page_id=\d+$/', $_POST['href'] ) ? substr( strrchr( $_POST['href'], '=' ), 1 ) : 'no-page' ;             if( $pageId === 'no-page' && preg_match( '/^http:\/\/.+\/\?(news|reviews|entrevistas|radio_shows|podcasts|cat|tag)=[a-zA-Z0-9\-]+$/', $_POST['href'] ) ) {                 $newSlug = substr( strrchr( $_POST['href'], '=' ), 1 );             } elseif( $pageId === 'no-page' && preg_match( '/^http:\/\/.+\/\?(artistas|sellos|generos)=[a-zA-Z0-9\-]+$/', $_POST['href'] ) ) {                 $sTaxonomy = true;             }             //$pageName = get_page_template_slug( intval( $pageId ) );             if( $pageId !== 'no-page' ) {                 if( $pageId === '8' ) {                     $sPostType = 'any';                     $sTemplatePart = 'home-ajax';                 } elseif( $pageId === '22' ) {                      $sPostType = 'reviews';                     $sTemplatePart = 'reviews-rvw-ajax';                 } elseif( $pageId === '6' ) {                     $sPostType = 'news';                     $sTemplatePart = 'noticias-news-ajax';                 } elseif( $pageId === '109' ) {                     $sPostType = 'entrevistas';                     $sTemplatePart = 'entrevistas-ajax';                 } elseif( $pageId === '112' ) {                     $sPostType = 'radio-shows';                     $sTemplatePart = 'radio-shows-ajax';                 } elseif( $pageId === '412' ) {                     $sTemplatePart = 'podcasts-ajax';                 } elseif( $pageId === '415' ) {                     $sTemplatePart = 'contacto-ajax';                 }                  } elseif( $sTaxonomy === true ) {                 $sTemplatePart = 'reviews-rvw-ajax';                 $sPostType = 'reviews';              } elseif( $newSlug !== '' ) {                 $sTemplatePart = 'single-ajax';                 $sPostType = 'any';                 if( preg_match( '/^http:\/\/.+\/\?cat=\d+$/', $_POST['href'] ) ) {                      $sTemplatePart = 'category-ajax';                        $sPostType = 'category';                        } elseif( preg_match( '/^http:\/\/.+\/\?tag=[A-Za-z0-9\-]+$/', $_POST['href'] ) ) {                      $sTemplatePart = 'tags-ajax';                        $sPostType = 'tag';                         }                      //get_template_part( 'single-ajax' );             }              //Siguiente y Anterior         } elseif( isset( $_POST['cadenaAll'] ) && ( isset( $_POST['cadenaPrev'] ) || isset( $_POST['cadenaNext'] ) ) ) {             if( isset(  $_POST['pageName'] ) ) {                 if( $_POST['pageName'] === 'reviews' ) {                     $sPostType = 'reviews';                     $sTemplatePart = 'next_reviews-rvw-ajax';                 }                 elseif( $_POST['pageName'] === 'news' ) {                     $sPostType = 'news';                     $sTemplatePart = 'next_noticias-news-ajax';                 }                 elseif( $_POST['pageName'] === 'entrevistas' ) {                     $sPostType = 'entrevistas';                     $sTemplatePart = 'next_entrevistas-ajax';                 }                 elseif( $_POST['pageName'] === 'radio-shows' ) {                     $sPostType = 'radio-shows';                     $sTemplatePart = 'next_radio-shows-ajax';                 }                 elseif( $_POST['pageName'] === 'podcasts' ) {                     $sPostType = 'podcasts';                     $sTemplatePart = 'next_podcasts-ajax';                 }                 elseif( $_POST['pageName'] === 'categories' ) {                     $sPostType = 'category';                     $sTemplatePart = 'next_categories-ajax';                 }                 elseif( $_POST['pageName'] === 'tags' ) {                     $sPostType = 'tag';                     $sTemplatePart = 'next_tags-ajax';                 }                 elseif( $_POST['pageName'] === 'search' ) {                     $sPostType = 'any';                     $sTemplatePart = 'next_search-ajax';                 }             }         }                   //Submenu         echo '

';         if( $sPostType !== '' ) {             if( $sPostType == 'any' || $sPostType == 'category' || $sPostType == 'tag' ) {                 $allCategories = get_categories();                 foreach( $allCategories as $cat ) {                     echo '
cat_ID ) . '">' . $cat->name . '
';                  }             } else {                      global $wpdb;                 // set the target relationship here                 $post_type = $sPostType;                 $taxonomy = 'category';                      $terms_ids = $wpdb->get_col( $wpdb->prepare( "                     SELECT                         tt.term_id                     FROM                         {$wpdb->term_relationships} tr,                         {$wpdb->term_taxonomy} tt,                         {$wpdb->posts} p                     WHERE 1=1                         AND tr.object_id = p.id                         AND p.post_type = '%s'                         AND p.post_status = 'publish'                         AND tr.term_taxonomy_id = tt.term_taxonomy_id                         AND tt.taxonomy ='%s'                     ", $post_type, $taxonomy ) );                      $terms = get_terms( $taxonomy, array(                     'include' => $terms_ids,                     'orderby' => 'name',                     'order' => 'ASC'                 ) );                            //$aTypeCategories = get_categories( array( 'post_type' => $type, 'number' => '10'  ) );                  foreach( $terms as $cat ) {                     echo '
term_id ) . '">' . $cat->name . '
';                   }             }         } else {             echo '
Sin categorías
';          }         echo '

';         if( $sTemplatePart ) get_template_part($sTemplatePart);     }          add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );     add_action('wp_ajax_llamadaAjax', 'llamadaAjax_callback');     add_action('wp_ajax_nopriv_llamadaAjax', 'llamadaAjax_callback');      and in the `/js/ajax-search.js` file:               jQuery(document).ready(function($) {              var linksPages = $('.menu-menu-container a');              linksPages.on('click',function(e){                     e.preventDefault();                     $('#content').addClass('cortinaOut');                     if( !$(this).attr('href').match(/=8$/) ) {                         $('#slider').fadeOut(800);                     }                     jQuery.post(MyAjax.url, {action : 'llamadaAjax' ,href : $(this).attr('href') }, function(response) {                     setTimeout(function() {                         $('#content').html(response).fadeIn();                         $('#content').removeClass('cortinaOut');                     }, 500);                 });         });     });      I'm trying to found out the problem since two days ago. Any idea of how to solve it?


title: How to link a Custom Post Type submenu to a Nextgen Gallery page?

text: I've created a custom posts top level menu item but I would like to have a submenu under that linking to the Add Gallery page of Nextgen, as the client wants all their functionality bundled up under one top level menu item. So far I'm doing :               add_submenu_page(          'edit.php?post_type=events',          'Add Gallery',          'Add Gallery',          'administrator',          'nggallery-add-gallery',          'event_add_gallery'     );      But the link looks like:               http://example.com/wp-admin/edit.php?post_type=events&page=nggallery-add-gallery      Is there any way to achieve this?


title: Changing the media library default tab

text: > **› Moderator Notice ‹** > > This question exists as it fills a specific criterion and/or has historical > significance. The current answers do not work for current WordPress > versions. If you got a working solution, please add it as a new answer. If > you got the _exact_ same question, you could offer a bounty to attract > working solutions. When adding media to the post from Media Library, an iframe that opens in a popup has these tabs:   1. From Computer    2. From URL    3. Media Library `From Computer` is currently the default, but I almost never use it and switching to `Media Library` takes up about 3-4 seconds every time, I wonder if its possible somehow to make it the default instead? Thanks


title: Redirect user based on his language and country using WPML

text: I am using WPML as a languages solution in my blog (in my case it's English and Spanish) I would like to know if there is a simple way of detecting where is a user coming from (which country.. I believe by IP) and redirect him immediately to either the Spanish site or the English site.   for instance: my site is **www.website.com** and the Spanish version is **www.website.com/es** I want people from lets say Argentina (and more latin countries) to see **www.website.com/es** and English spoken countries will see the regular English homepage as default.   Does someone have a solution? Thanks a lot Gil


title: On adding new field in post table my all posts not displaying in post section in php wordpress

text: I have created a module for posts. Now I have to modify this module by adding a new column to it. I have done it and it is working fine on local, but when I upload the code on live server, none of post type are visible to me. if I remove the newly added column then it works fine for me, please help me to resolve this issue.


title: How to Setup a CDN for All Content?

text: I know it's possible to setup a CDN with W3 Total Cache for cached content. However, how would I setup a CDN with WordPress to initially upload all media content (images, videos, files, etc.) directly to the CDN instead of my web host/local install. I'd like to completely bypass uploading content to my hosting account and simply host it via CDN. For example: if I uploaded an image via WordPress, I'd like it to automatically be sent to the CDN.


title: Prevent large image uploads

text: I want to prevent users in my blog from uploading large size images. And I mean large in px size not MB. Max Upload is set to 8MB which should be ok but I wan't to prevent uploading for images larger than 3000x3000px. Is there any hook I am missing that I could write a function for to tell users their image is too large?


title: filter out "uncategorized" from all category listings with one filter in functions.php?

text: I'd like to add code to my functions.php to intercept all calls to wp_list_categories() AND the_category() so that it excludes "uncategorized" and any children of "uncategorized" (OR cat_id 1). I'd also like to limit the number of words returned in the "title" attribute of each list item anchor. Currently the default is to set $cat_args['use_desc_for_title'] = 1; but It does not appear it's possible to insert that into the exclusions filter below. I'm using the code below which effectively removes the unwanted categories from the lists that use wp_list_categories, however, it does not remove them from lists derived from the_category...               function my_list_terms_exclusions($exclusions,$args) {       $children = implode(',',get_term_children(1,'category'));       $children = (empty($children) ? '' : ",$children");       return $exclusions . " AND (t.term_id NOT IN (1{$children}))";     }     add_filter('list_terms_exclusions', 'my_list_terms_exclusions', 10, 2);?>


title: Init hook function to call other hook in function.php

text: I am trying to add a function in the `init` hook that will call another hook like this :               add_action( 'init', 'loadAfterUserRegistrationHook' );         function loadAfterUserRegistrationHook(){         add_action( 'user_meta_after_user_register', 'createNewPost' );       }              function createNewPost( $response ){     global $userMeta;          $userID = $response->ID;     $user = new WP_User( $userID );          $role = $userMeta->getUserRole();          if( $role = 'artiste' ){               $newPost = array(           'post_title'    => $user->nickname,            'post_content'  => $user->description,           'post_status'   => 'pending',           'post_author'   => $userID,           'post_type'     => 'cpt_artists'         );              $post_id = wp_insert_post( $newPost );         error_log('Post ID : '.$post_id);              wp_set_object_terms( $post_id, array('dj'), 'artist-category');             }      }      Why is the function `createNewPost` is not being executed?


title: Why is my plugins activation hook not working?

text: Can somebody tell me why this isn't working? I'm trying to get it to create a file in the plugins directory. After I get this working, I'll be trying to get this to create a file in the active theme's directory. Can somebody help me out here? **EDIT** I've changed my code, right now it creates the file but it does not input the text 'Testing' into the file even. Is there something I'm missing here?               $filename = __FILE__;          register_activation_hook($filename, 'superActivation');     register_deactivation_hook($filename, 'superDeactivation');          global $myFile, $fh, $stringData, $filename, $pluginbase, $full_plugindir;          $myFile = "../wp-content/themes/striking/testFile.php";     $stringData = "Testing\n";     $fh = fopen($myFile, 'w') or die("can't open file");          function superActivation() {         global $myFile; global $fh; global $stringData; global $filename;         fwrite($fh, 'test');         fclose($fh);     }          function superDeactivation() {        global $myFile;        if(is_file("$myFile")) {        unlink("$myFile");        }     }


title: A plugin doesn't show up and refuse to be installed

text: I'm trying to install the SEO by Yoast plugin. My WordPress is host on DigitalOcean (previously host on OVH) and is located in /var/www/. When I check inside /var/www/wp-content/plugins/, there is no wordpress-seo folder. In my dashboard, when I install the plugin, WordPress displays:               Installing the plugin…     Destination folder already exists. /homez.722/culturesc/www/wp-content/plugins/wordpress-seo/      What is interesting is that I have no /homez.722/culturesc/ folder on my server (I can't find it). It seems that Wordpress is not installing the plugin in /var/www/wp-content/plugins/ and that is probably the reason why when I manually upload wordpress-seo inside the plugin directory it doesn't show up on my dashboard. What is happening?


title: After rewriting post type's URL, the number of queries has increased dramatically

text: I rewrited the URL of post type, and the main loop ( example.com/post-type/ ) generates an expensive number of queries. So I have a post type "cd" and taxonomy "artist", and the url are:   * example.com/cd   * example.com/cd/artist/name-cd   * example.com/cd/artist The code...               add_filter( 'post_type_link', 'cd_type_link', 1, 3 );     function cd_type_link($link,$post) {         global $post;         $post_type = 'cd';         $taxonomy = 'artist';              $terms = wp_get_object_terms( $post->ID, $taxonomy );         $slug = $terms[0]->slug;              $post_name = $post->post_name;              if ( $post->post_type == $post_type ) {             $link = get_post_type_archive_link($post_type) ."/{$slug}/{$post_name}";         }         return $link;     }      ......................................................               add_action('init', 'new_add_rules');     function new_add_rules() {             add_rewrite_rule(             '^cd/([^/]*)/([^/]*)?',             'index.php?post_type=cd&cd=$matches[2]&artist=$matches[1]',             'top'         );         add_rewrite_rule(             '^cd/([^/]*)/?',             'index.php?post_type=cd&artist=$matches[1]',             'top'         );         global $wp_rewrite;         $wp_rewrite->flush_rules();     }      The loop in archive-cd.php :               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>     <?php endwhile; endif; wp_reset_query(); ?>      Without url rewrite, the queries are low. With url rewrite, the queries are high. The problem is "the_permalink()", because if I leave the function the_permalink(), the number of queries drops significantly. How can I resolve? Thanks.


title: Grid layout "last" class to every third item

text: Seems like a trivial problem but I can't get it to work. I need to add `class="last"` to every third post. Here is my code:                 <?php          $count = 0;          $my_query = new WP_Query('cat=-18,-7&showposts=9');          while ($my_query->have_posts()) : $my_query->the_post();         ?>              <article class="<?php if ($count % 3 == 0) { echo "last "; }" ?>> </article>              <?php                $count++;               endwhile;          ?>


title: Stop certain classes showing up in TinyMCE Advanced Style dropdown

text: I'm using the TinyMCE Advanced plugin so that I can add my own custom styles to the Style dropdown in the Visual Editor. However, I don't want some of the styles that are included in the style.css file to be listed there, as they are 'internal' classes (for aligning pictures etc). Is there a way to stop these classes being shown in the dropdown? Either by changing the TinyMCE Advanced configuration, or by editing the CSS file in a certain way?


title: How oEmbed works

text: I want to start with some problem I have: I'm using buddypress plugin, now I want to add some functionality to it: I want to embed links, just like facebook (or any other social network) does this. I have written code for it, which saves link information inside meta table. For performance reasons, I think its slows down the query for every time checking meta table if there is `acitivity_link` meta for this activity. So I decided to use whats already is in query - and thas oEmbed. I found that when I link youtube (for example), activity content still contains that link and in meta table there is some meta (oembed_something) I thought looking inside code how its written, but for my it seemd too much complicated. Could you please tell me if this hack is possible (not in terms of everything is possible, but simply possible) if yes - I want to now some basic mechanism how it works. paritcaullary: IF I detect that link myself, by what name to save this meta so then I can manipulate wp_oembed


title: Load post content into iframe

text: I would like to load a Wordpress post into an iframe when a link on a wordpress page is clicked. This is the link I currently have.               ID) . '" target="map-loader">Read the report      Then I want the content of that post (no header or footer etc) to load into an iframe when the link is clicked. This is the iframe that is on the page.                     I am half way there. When the link is clicked, the iframe loads a full wordpress page with the header and footer etc. what I want is the actual post content to be loaded into the iframe, no header or footer. I have tried this in map-iframe.php but no success. Still loads the whole wordpress template.               <?php the_content('Read the rest of this entry »'); ?>      I'm thinking that my link needs something that specifies that I only want to load the post content. Or would it be better to load with ajax?


title: Wordpress Home Page

text: I'm setting up Wordpress version 3.8.1 on my website. It's installed at the domain root (`http://www.mywebsite.com/[wordpress installation]`). I added a "Home" page. Afterward when editing the menu settings I noticed that there were two entries for Home. Upon further investigation I discovered that the Home page I made had a permalink of `http://www.mywebsite.com/home/`. So, now I have two questions:   1. How do I fix the permalink for my Home page, so that it is `http://www.mywebsite.com/`?   2. Since I'm only able to get at one of the Home pages shown in the menu settings, how do I get rid of the extra Home page, so that I have only one editable Home page?


title: wordpress multi image upload problem

text: I had a great tutorial at http://themefoundation.com/ .I followed it and it works for me .Now about image uploader,it works only for one metabox.Cann't it be for multiple meta boxes?the code               Example File Upload     <input type="text" name="meta-image" id="meta-image" value="<?php echo $example_stored_meta['meta-image'][0]; ?>" />     <input type="button" id="meta-image-button" class="button" value="Choose or Upload an Image" />      Now if I add another upload field it breaks down.               Example File Upload     <input type="text" name="meta-image" id="meta-image" value="<?php echo $example_stored_meta['meta-image'][0]; ?>" />     <input type="button" id="meta-image-button-1" class="button-1" value="Choose or Upload an Image" />      The code for this jQuery(document).ready(function($){               // Instantiates the variable that holds the media library frame.     var meta_image_frame;          // Runs when the image button is clicked.     $('#meta-image-button').click(function(e){              // Prevents the default action from occuring.         e.preventDefault();              // If the frame already exists, re-open it.         if ( meta_image_frame ) {             meta_image_frame.open();             return;         }              // Sets up the media library frame         meta_image_frame = wp.media.frames.meta_image_frame = wp.media({             title: meta_image.title,             button: { text:  meta_image.button },             library: { type: 'image' }         });              // Runs when an image is selected.         meta_image_frame.on('select', function(){                  // Grabs the attachment selection and creates a JSON representation of the model.             var media_attachment = meta_image_frame.state().get('selection').first().toJSON();                  // Sends the attachment URL to our custom image input field.             $('#meta-image').val(media_attachment.url);         });              // Opens the media library frame.         meta_image_frame.open();     });      }); And lastly enqueing scripts.               function example_image_enqueue() {     global $typenow;     if( $typenow == 'post' ) {         wp_enqueue_media();              // Registers and enqueues the required javascript.         wp_register_script( 'meta-image', get_stylesheet_directory_uri() . '/meta-image.js', array( 'jquery' ) );         wp_localize_script( 'meta-image', 'meta_image',             array(                 'title' => 'Choose or Upload an Image',                 'button' => 'Use this image',             )         );         wp_enqueue_script( 'meta-image' );     }       } add_action( 'admin_enqueue_scripts', 'example_image_enqueue' ); Thanks


title: How to list top 5 custom post types depending on comments?

text:
I am running a web site with custom post types. I would like to show my visitors my top 5 custom posts based on their comment counts. I already have some code, but it shows the last 5 posts, not the top 5 commented custom posts. If it's too difficult, it may display random posts. Here is the code I have:

 Recent Posts
     <?php         $my_query = new WP_Query('post_type=customp&showposts=5');         while ($my_query->have_posts()) : $my_query->the_post();     ?>
     <?php         if ( has_post_thumbnail() ) { ?>             <img class="thmb" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=80&w=90&amp" alt="<?php the_title(); ?> Recipe"/>     <?php } else { ?>                  <?php } ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo short_title('...', 5); ?>

  Date: <?php the_time('M - j - Y'); ?>

<?php comments_popup_link('0 Comment', '1 Comment', '% Comments'); ?>

     <?php endwhile; ?>


title: RSS feed error stopping parsing of page template

text:
hope you can help me with this! I have a custom page template that pulls in an RSS feed from a separate site (owned by the same guy, my client). While testing the page on my own server, it works beautifully, but when I migrated the theme over to my clients' wordpress install (both are v3.0.1), the feed would not appear, and neither would the page's sidebar or footer. When I investigated further, it appeared that WP simply stops parsing the page template when it hits the feed section. I suspect a plugin conflict, although I've not been able to replicate the error on my own server, even when I installed the same plugins as my client & configured them similarly. Any ideas as to what may be causing WP to choke? I'd really appreciate any guidance. For reference, here is the RSS feed code I'm using:               <?php     // Get a SimplePie feed object from the specified feed source.     $rss = fetch_feed('http://digitaldads.com/feed/');     if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly      // Figure out how many total items there are, but limit it to 5.      $maxitems = $rss->get_item_quantity(5);           // Build an array of all the items, starting with element 0 (first element).     $rss_items = $rss->get_items(0, $maxitems);      endif;     ?>
     <?php if ($maxitems == 0) echo '
No items.
';     else     // Loop through each feed item and display each item as a hyperlink.     foreach ( $rss_items as $item ) : ?>
         <a href='<?php echo $item->get_permalink(); ?>'         title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>         <?php echo $item->get_title(); ?>
     <?php endforeach; ?>
      Thanks! Jason


title: Why is my Wordpress install using full server directory paths for media URLs?

text:
So I have this Wordpress blog at ilovetheupperwestside.com. It uses the Aggregate Theme from Elegant Themes.   I moved it from a temporary location to the current URL. This action broke some things, but thanks to a plugin called "Velvet Blues Update URLs" and a (serialization safe) database search & replace script nearly everything was fixed. One problem seems to still remain. Media paths that are generated by Wordpress are server directory paths, example from this article:

             The file in question is a new file which I just uploaded. The thumbnail was generated by Wordpress with the faulty URL. This seems to occur with all media content. Does anyone have any idea what's going on? Any help would be greatly appreciated.


title: define css class in functions.php

text: In my theme I use theme options to set colors to categories (heading colors, dividers colors etc etc) The way I do it is defining variables which holds a color hexa like so:               $category1_color = get_option('category1_color');     $category2_color = get_option('category2_color');      etc etc.. and inside my admin I set the color ( **e.g - #ffccoo or yellow** ) in a "theme options" I already built where my client can easily change global colors to each category element in a second. like so:               if (is_category("news")) { echo ' style="border-bottom-color:' . $category1_color . ';"'; } ?>      now - my client has a custom top menu which has items (mostly categories) I want him to also be able to change the color of the texts in the menu. now, I know it is possible to add class to each menu item (this is fairly easy) but I dont want to create classes in the CSS file because it is not dynamic what I want it to grab the variable which was already changed by the client eg - **$category1_color** (lets say it is set to purple right now) and assign it dynamically to a class called "category1-item" which is used as a class on the menu item so if later the client is changing the color in my theme options it dynamically changes the color of the menu item too without going to the CSS file and edit it. I wwas thinking about setting a class in the **functions.php** file and simply stored the variable I already created (which holds a color already) in this class like so: category1-item = $category1_color I just don't know how to add classes to the functions.php file and store a variable into each class. any idea?


title: Neaten content -- different widget or CSS change?

text: I want to neaten up the content in a widget. I'm not sure if I should use a different widget, or get a change to the CSS made, or something else... On a largish screen on this site: http://richardclunan.com/ …on the right-hand side, the section "From my Inbox" -- that's a Text widget. On a largish screen, the lines of text look too long. I'd like to make the line-length shorter than the text fields above them. (On a smaller screen, the widget pops down to the bottom of the site, and the lines are shorter than the text fields above them -- it looks neater this way.) Is there a different widget I can use to neaten that up? Or do I need to make a CSS change for this?


title: Adding a second email address to a completed order in WooCommerce

text: Before I ask this question, I know there is a (legitimate) hesitation to answer questions here about Woo products since they have their own support and their users should be encouraged to use that. I am a paying Woo user but couldn't solve this with their paid support, and my question is about overriding classes in WP so I hope it will get a fair hearing. My question: when a completed order email is sent out to a customer, I also need to receive this email, verbatim and automatically, exactly as it is sent to the customer rather than in some other format such as is created by the various invoice PDF plugins for WooCommerce. I can very easily accomplish this by changing the following line in `/woocommerce/classes/emails/class-wc-email- customer-completed-order.php`:               $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );      to read:               $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );     $this->send( me@myemail.com, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );      However, obviously a hack like this isn't going to survive an upgrade. I have a child theme which overrides WooCommerce templates. Is there any equivalent mechanism by which I can override a class in a similarly encapsulated way? Or can you recommend an alternate approach (besides setting the SMTP server to bcc all outgoing emails to the second address) for accomplishing my specific task of receiving this email when the customer also receives it?


title: How to show large image in checkout page using WP Ecommerce plugin

text: I want to show large image in checkout page right now it showing 31x31 size image in `wpsc-shopping_cart_page` and using `<img src="<?php echo wpsc_cart_item_image(); ?>` to call thumbnail image. what should i do for that? ![enter image description here](http://i.stack.imgur.com/osB40.jpg)


title: Wordpress db prepare

text: I am not trying to use $wpdb->insert, but prepare. Insert method will have one query string and an array which includes # of data which is not defined but will be defined for each query string keyword. For example, "address.insert" query string defines a string of query with 3 variables when it process query such as owner_id, address_info, city. Instead of using $owner_id, ... , $country at the $wpdb->prepare section, I am trying to pass an array holds all of variables listed in below. Does anyone know if it is doable passing an array for prepare? It wasn't working for me when I tried. Works               $sql = $wpdb->prepare($this->queryArray[$selectQuery], $owner_id, $address1, $address2, $city, $zip, $country);      Trying to do               $sql = $wpdb->prepare($this->queryArray[$selectQuery], $inputArray);      Here's an example code.               public function Insert($selectQuery, $inputArray)     {         try         {             global $wpdb;             $wpdb->show_errors();             $sql = $wpdb->prepare($this->queryArray[$selectQuery], $owner_id, $address1, $address2, $city, $zip, $country);             $result = $wpdb->query($sql);             return $result;         }         catch(Exception $e)         {             echo $e->getMessage();             return -1;         }     }      Solved: This just works fine.               $sql = $wpdb->prepare($this->queryArray[$selectQuery], $inputArray);


title: Adding an extra attribute to menu link using wp_nav_menu

text: I need a little help, I'm basically trying to add a custom data attribute to the a tag in all menu items. So as it stands, I have this:               Home     About      and I'm aiming to have this:               Home     About      I've been able to find a little info on extending the Walker class and also found the following question - Adding attributes to  link in wp_nav_menu using custom Walker function I had a look at the linked question/answer but couldn't quite figure out how to change the start_el function to suit my needs without doing it in the core WP files. I've got as far as extending the class:               class My_Walker_Nav_Menu extends Walker_Nav_Menu {          // function start_el(....          }      Any help on adapting this to my needs would be great! Thanks!


title: Using WHERE on a WP_Query

text: I have two custom post types: **Books** and **Subjects**. For this projects, I'm using Super-CPT to create custom post types:               $books = new Super_Custom_Post_Type( 'book', '', 'book', $register = array(             'supports' => array( 'title', 'editor', 'thumbnail'),             )     );          $subjects= new Super_Custom_Post_Type( 'subject', '', '', $register = array(             'supports' => array( 'title', 'editor'),             'hierarchical' => true,             )      );      To select which are the subjects of the book, I create a meta box and the values from Subjects:               $profissionais->add_meta_box( array(             'id' => 'subjects',             'context' => 'side',             'fields' => array(                   'subjects' => array( 'type' => 'select', 'label' => '', 'data' => 'subject', 'multiple' => 'multiple' )             )     ) );      Now, I need to show on the page of each subject, the books with this subject. I start with this:               $args = array(       'post_type' => 'book',     );     $books = new WP_Query($args);      But I do not know how to move forward. I'm trying to do something like this:               SELECT book_title FROM books WHERE subject = subject page title      **UPDATE** Solved!               $current = get_the_ID();           $args = array(        'post_type' => 'book',        'posts_per_page' => -1,        'meta_key' => 'subjects',        'meta_value' => $current,      );           $books = new WP_Query($args);


title: “open_basedir restriction ” when changing wordpress URLs

text: I got these error messages when trying to move WordPress (3.5.1) to a different directory (changing "WordPress Address (URL)" and "Site Address (URL)" from `http://example.nl/wordpress` to `http://example.nl/business` using WordPress `settings` » `general`) : > **Warning:** is_writable() [function.is-writable]: open_basedir restriction > in effect. >File(/) is not within the allowed path(s): > (/usr/share/php:/home/domainname.nl/:/usr/share/pear:/usr/sbin:/usr/bin:/bin:/tmp:/etc/phpmyadmin:/usr/lib/php4:/usr/lib/php5:/opt/ioncube/lib) > in /home/domainname.nl/public_html/wordpress/wp-admin/includes/misc.php on > line 133 > > **Warning:** Cannot modify header information - headers already sent by > (output started at /home/domainname.nl/public_html/wordpress/wp- > admin/includes/misc.php:133) in > /home/domainname.nl/public_html/wordpress/wp-includes/pluggable.php on line > 876 I asked on the wordpress forum, they said to "contact the host about the open_basedir" error. I found this StackOverflow answer by Andrei which suggested editing the `httpd.conf` so I sent that along with the error message to the hosts. The hosts reply: > _I'm afraid there is nothing we can do for you. The application that is > giving this error is trying to access a file in the directory File(/)   >  This directory is incorrect. There must be a programming error in the PHP > code._ So now I still don't have a clue where the problem is, or how to solve it. Do you?


title: Why is the post type on the search result page random?

text:
So I think I might be doing something fundamentally wrong in my Wordpress themes since this issue seems to crop up every once in a while and I don't know why. So basically I created search.php and I use relevanssi to sort my search results by relevancy. When I search for "camera" and do `echo get_post_type();` I get "reviews" but if I search for "test" and do `echo get_post_type();` I get "articles". I tried injecting wp_reset_query() just about everywhere to try and see if I was changing it randomly but it's not that. I think WP is confused since my search result page isn't really linked with any specific page so it is not set to a specific post type. Is there a way to have it be a page? Any help is appreciated edit: I added the code below. In the var_dump I just see the query stuff but get_post_type() is different on every search term. search.php:               <?php     get_header();          global $query_string;          $query_args = explode("&", $query_string);     $search_query = array();          foreach($query_args as $key => $string) {         $query_split = explode("=", $string);         $search_query[$query_split[0]] = urldecode($query_split[1]);     } // foreach          $args = array(         'posts_per_page' => get_option('posts_per_page'),         's' => $search_query['s']     );          echo get_post_type() .'
';     var_dump($args);          $search = new WP_Query($args);          if( $search->have_posts() ) {         while( $search->have_posts() ) {             $search->the_post();                  include( get_template_directory() . '/includes/templates/search_result.inc.php' );                    }         wp_reset_query();     }     ?>          Load more search results     <?php     get_footer();


title: Get post type in header.php

text:
I'm creating menu in wordpress and I would like add **class="active"** to link when its page is active. I'm not using inbuilt wordpress menu feature. I'm making menu hardcoded in header.php because this menus are linked to custom posttype archive pages. So I would like to keep class active if one is inside **single** or **archive** page of that posttype. Here is what i would like to do: **header.php**               <?php if ($post_type == "custom_post_type1") : ?>
Post type 1
     <?php else: ?>
Post type 1
     <?php endif; ?>          <?php if ($post_type == "custom_post_type2") : ?>
Post type 2
     <?php else: ?>
Post type 2
     <?php endif; ?>      I hope I explained what I'm looking for well. Thanks.


title: Is there a way to run upgrade.php for one blog?

text: I just ran the auto update to verion 3.9 today, but am having problems with the "Network Update". I seem to have a firewall or network problem with this error : > Your server may not be able to connect to sites running on it. Error > message: couldn't connect to host Anyways, is there a way to run the database updates per blog ? Can I use a special URL ? Can I do it from shell command line ? On an old forum post, someone suggested that update.php runs automatically the first time you log into your blog admin ( even if Network Update hasn't been run ). I wonder if that's true. Thanks


title: Organize a content site - should I use cpt and taxonomies or the theme?

text: I have built a content site which includes several types of posts: text article, video post, image gallery / presentation, audio, etc. I am using a theme for the front-end. the theme includes a page builder and several built-in page templates, which are similar to the above post types. How should I organize and present the content to the site visitors, should I use custom post types and taxonomies and if so, which ctp and which taxonomies should I create, assuming that I have currently several categories and several subcategories, and also each post has tags associated with it...? Is there a plugin or theme that addresses this problem? (I just want to mention that the organization of sites like amazon.com in terms of ease of navigation, and how easy it ease to find the requested content is what I am trying to achieve). So, the content structure at the moment is: Category1 ------> Subcategory1_1, Subcategory1_2, Subcategory1_3 ---------> post1,post2,post3 (types: article, video, presentation,audio, etc.) -----------> tag1, tag2, tag3 It is important to note that a certain post can belong to several categories or subcategories, and that a tag can be associated with several posts.


title: Sort posts by popularity/page views

text: How can I sort posts by popularity or page views in my template file? I guess I need to count page views first, is there any good plugin to integrate with to sort posts by views or what is the best practice of doing it.


title: Assigning certain pages or posts to use the template of the parent page or category

text: I created a website that's using Wordpress as its CMS. There are parent pages -> sub categories -> content within each sub category. Some of the 3rd level pages are generated using posts with categories. I would like to assign a template to a parent page so that the look of the site remains consistent according to each parent template. Additionally, is it possible to assign a template to a post category?


title: Arrange posts by date in front page

text:
I have code to show the 5 last posts from every category on the front page. However, at the moment they are ordered category by category. Is it possible to order them by post date, but still have 5 posts per category? Here is my current code:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     if( $cats = get_categories() ) foreach( $cats as $cat ) :     //go through all site's categories and get up to 5 posts each////              $cat_query = new WP_Query( array(             'post__not_in' => get_option( 'sticky_posts' ),             'category__in' => array($cat->term_id),             'posts_per_page' => 5,             'paged' => $paged             ) );                  if($cat_query->have_posts()) : ?>
<?php echo $cat->name; ?>
             <?php while ($cat_query->have_posts()) : $cat_query->the_post();             get_template_part( 'loop', 'index' );                  endwhile; endif; wp_reset_postdata();     endforeach;


title: Proper approach to moving complete site from one domain to another AND preserve widgets

text: I consider myself fairly versed in this matter, however I've recently had a rash of issues when moving sites. I am able to successfully move the site, edit wp-config.php, move the database, etc. Once I've moved the database, I then execute these queries:               UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com');     UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');     UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');     UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');      This correctly updates all of my links, image references, etc. - _HOWEVER_ I end up with a different problem: What happens is that some widgets break (examples are the WP Text Widget, as well as the add-on widget WYSIWYG Widget). Completely. As in the widget does not appear under the sidebar any longer, and I have to completely reconstruct them (the plugins are fine, it's just the widget disappears from the sidebars). I've searched around WP-SO, and I've seen comments that warn against this method of updating the db, but what I'd like to know is if there is a way to resolve this, and what that way is.


title: Can't output do_settings_sections . Can't understand why

text:
I've this code:               /* Hook to admin_menu the yasr_add_pages function above */     add_action('admin_menu', 'yasr_add_pages');          function yasr_add_pages() {              //Add Settings Page         add_options_page(                          'Yet Another Stars Rating: Settings',               //Page Title                         __('Yet Another Stars Rating: Settings', 'yasr'),   //Menu Title                         'manage_options',                                   //capablity                         'yasr_settings_page',                               //menu slug                         'yasr_settings_page_content'                        //The function to be called to output the content for this page.                         );           }          /* Settings Page Content */     function yasr_settings_page_content() {         if ( !current_user_can( 'manage_options' ) )  {             wp_die( __( 'You do not have sufficient permissions to access this page.', 'yasr' ) );         }         include (YASR_ABSOLUTE_PATH . '/yasr-settings-page.php');          } //End yasr_settings_page_content      and, this is the content in yasr-settings-page:

Settings API Demo
         <form action="options.php" method="post">             <?php                  settings_fields( 'yasr_multi_form' );                  do_settings_sections( 'yasr_settings_page' );                 submit_button( 'Salva' );             ?>         </form>
          <?php          add_action( 'admin_init', 'yasr_multi_form_init' );          function yasr_multi_form_init() {         register_setting (                      'yasr_multi_form', // A settings group name. Must exist prior to the register_setting call. This must match the group name in settings_fields()                     'yasr_multi_form_data' //The name of an option to sanitize and save.          );          add_settings_section( 'yasr_section_id', 'Gestione Multi Set', 'yasr_section_callback', 'yasr_settings_page' );     add_settings_field( 'yasr_field_name_id', 'Nome Set', 'yasr_nome_callback', 'yasr_settings_page', 'yasr_section_id' );     }          function yasr_section_callback() {         echo "Descrizione sezione";     }          function yasr_nome_callback() {         $option = get_option( 'yasr_multi_form_data' );         $name = esc_attr( $option['name'] );         echo "<input type='text' name='yasr_multi_form_data[name]' value='' />";     }      The settings page output `settings_field` function (I can see the input type hidden on my source) and the submit button, but I can't render the `do_settings_section` and I really can't understand why. Any suggestions?


title: multiple query to match post title and custom field and category

text: I'm building a film site. I have News posts, Work posts and Director posts. Director posts have the director name as a post title. What I'm trying to do is query the database and pull out any Director posts with a post title that matches the custom field value of any Work posts (the director name), but that also have a certain category (location and type of work). I'll be using isotope to sort/display by the category and showing thumbnail etc. The client ultimately wants to click the selected director and go to a page displaying all related type of work by that director. Seems a complicated query - and feel it can't be done without raw SQL. Can anyone suggest a better method? Thanks!


title: Is it worth checking if class_exists when developing a plugin and how to do it?

text: I'm learning WordPress plugin development using OOP approach. In most resources before declaring a class there is usually a check if class exists `class_exists()`. Is it a good approach to check this or can it be omitted? Also, I was wondering if it's a good approach to check in one block if none of plugin's classes exist. Even if one class already exists, the whole plugin can't work correctly as it can't re-declare a class. So, instead having `class_exists()` through the code, I was wondering if it's better to have it in one block when activating a plugin, something like:               if ( class_exists( 'Class_Name_One' )     || class_exists( 'Class_Name_Two' )     || class_exists( 'Class_Name_Three' )     || class_exists( 'Class_Name_Four' ) ) {              exit;      } Any advice and feedback is hugely appreciated. **EDIT** If there is a conflict with another plugin that declares the same class names, I want to deactivate my plugin and display admin notice.


title: Sidebar widget: Randomly select text from a given set

text: I have a sidebar text widget, which displays a nice quote that's related to the blog contents. I change the quote every now and then, And I'm looking for a way to create a set of quotes and display one of them at random. Is there a plugin for that?


title: mod_rewriting conflict with WP permalinks in htaccess

text: I need some help! I'm trying to rewrite this...               localhost/blog/?c=var  to->  localhost/blog/var       But seems there is some problem... **I get a 500** :( I also believe there is some conflict with the default rules of wordpress too. This is my entire htaccess:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /blog/     RewriteCond %{REQUEST_FILENAME} !-f     RewriteRule ^(.*) localhost/blog/?c=$1  [L]          # BEGIN WordPress     RewriteEngine On     RewriteBase /blog/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /blog/index.php [L]     # END WordPress     </IfModule>      Any idea? Thanks


title: get_the_terms issue

text: I'm trying to list the custom taxonomy term that is attached to the post in question (which is a custom post type). I want to list it without it being a link, it is in fact a title. I've tried this, but it clearly doesn't work. What am I doing wrong?               function woocommerce_output_product_brand() {          $terms = get_the_terms( $post->ID, 'brand' );     foreach($terms as $term){         echo $term; }     }      Thanks in advance!


title: Add an extra field to the navigation menu box?

text: Goal: I like to use a subtitle in the navigation bar. The most logic location, in my opinion, would be Appearance > Menu and add a field below navigation label called subtitle. So the end user can easily add and change a subtitle there for the different menu items. Looking at `wp-admin/includes/nav-menu.php`, I can't find an action to hook onto, is this correct? Does anyone have an idea to accomplish this?


title: How to multiply a post to test internal search results?

text: I'm using two ways to do my search. One, located in `search.php`:               <?php /* Search Count */           $allsearch = &new WP_Query("s=$s&showposts=-1");      $key = wp_specialchars($s, 1);           if($wp_query->found_posts<2){         _e('Pesquisa para');          _e(''); _e('');          echo $key; _e('');          _e(' — ');          echo $wp_query->found_posts . ' ';          _e('resultado');     }else if($wp_query->found_posts<100 && $wp_query->found_posts>1){         _e('Pesquisa para');         _e(''); _e('');          echo $key; _e('');          _e(' — ');          echo $wp_query->found_posts . ' ';          _e('resultados');     }else{         _e('Você atingiu o limite de resultados por pesquisa, para');         _e('');          echo $key; _e('');      }          wp_reset_query(); ?>      This is to display a message of how many results were found in a user search. `$wp_query`, is a global variable, found in the plugin. With that variable, I can find the number of results, using:               $wp_query->found_posts;      With that, I'm using Relevanssi Plugin to set a number of maximum results per search. To increase performance, I've set the maximum number of results per search to 100. For testing purposes, I'd like to know, if there's a way, to multiply a post? For example: I have one post, in my site. Then, somehow (through code), multiply it by 100. So that I'll have 100 posts in my site. With that, I could check what happens in my theme, when there are 100 or more search results.


title: theme_root returning a truncated URI

text: I'm unable to access the theme editor via the control panel, receiving 'Sorry can't edit files with .. in the name....' and after trying to trace back the cause, I've found that the theme_root is being returned as /home/websitename.co./(the rest is correct). I'm at a loss to determine where the theme_root is being read/set from and why it's truncating the .co.uk to just .co. This last issue is causing it to fail the allowed_files error testing as it's reading ./ and falling over. Any assistance in plain enough english for a non php coder to understand would be appreciated. Thanks.


title: Shows only one Category in home page

text:
Hi i'm trying to change the home page, because i'd like to have a slider and down only one category of article. you can look at the page on line: http://goaboa.it/home-2014/ I cannot see anything articles in the homepage... Can you help me to change correctly the code, to show only category with ID 17, called "home2014". you can see the code about my new template here:               <?php     /*     Template Name: HOME 2014 BIS     */     ?>          <?php get_header(); ?>
                             <?php           $displayed = false;           if (function_exists('shareit_output')) {             $h_sticky = shareit_output();             $home_page = get_option ('shareit_home', 0);             if (!$displayed and $h_sticky && $home_page == 1) {               echo $h_sticky;               $displayed = true;             }           }           ?>         <?php get_template_part( 'loop', 'flexslider-homepage' ); ?>              <?php     if ( have_posts() ) : while ( have_posts() ) : the_post();     ?>                  <?php the_content(); ?>                      <?php endwhile; endif; ?>
                             <?php     foreach((get_the_category()) as $category) {         echo $category->cat_ID . '17';     } ?>                        <?php // Category - Featured Slider         $category_id = get_cat_ID( '17');         $category_featured_enabled = get_tax_meta($category_ID,'omc_featured_slider');                 if ($category_featured_enabled == 'on') { get_template_part('loop', 'module-flex'); } else { ?>                        <?php } ?>              <?php // Determine whether to use a preset blog style or echo content (with shortcodes)              $category_blog_style = get_tax_meta($category_ID,'omc_blog_style');                 $category_content = get_tax_meta($category_ID,'omc_content_field_id');              if ($category_blog_style == '') {                     get_template_part('loop', 'blog-style-2');             } else if ($category_blog_style == 'shortcodes') {                     echo do_shortcode($category_content);         } else {                     get_template_part('loop', $category_blog_style);                 }         ?>
          <?php get_sidebar(); ?>          <?php get_footer(); ?>


title: Use Wordpress Login for a non-wordpress site

text: Please read the following example and tell me if it's possible. Website A (wordpress) has alot of different users who must login to see some pages Website B (non-wordpress) same as A. Is it possible when a user makes login at wordpress to be also loged in at the non-wordpress site? I simple searching for a way not to make login two times but one. Thanks in advance.


title: Wordpress displaying content from sub pages

text: Im trying to pull in content from the 'sub pages' onto the homepage, I used the below to pull in content from the 'child pages' but unsure how to do this for the 'sub pages' Does anyone know how this could be done? -Parent page (4) --Child page -----sub page --Child page -----sub page               <ul>         <?php         $children = get_children( array( 'post_parent' => 4, 'post_type' => 'page' ) );         if ( $children ) {             foreach( $children as $child ) { ?>                 <li>                     <?php echo get_the_title($child->ID); ?>                 </li>         <?php } } ?>     </ul>


title: Main RSS feed from custom post type only shows title but the text is missing

text: In the functions.php i've used the following snippet:               function thefeed_request($qv) {         if (isset($qv['feed']) && !isset($qv['post_type']))             $qv['post_type'] = array('post', 'news');         return $qv;     }     add_filter('request', 'thefeed_request');      news is the name of the custom post type i've added to the RSS functionality. In the admin area - settings - read, i have set "the newsfeed shows" to the last 10 posts as well as "the newsfeed shows" the whole text. but if i test it in a feedreader or check the main feed url in the browser (page.com/feed) then there is only shown the title but the text is missing. Is it due to Wordpress only knows what the title is but doesn't know in which field the text is contained? And is there a way to set that? Best regards Ralf


title: "Static" pages within a theme

text: What I want to achieve is to add vCards to my contact pages, created on the fly and downloadable. I guess I could make a very bare template with the functionality and the correct mime-settings to the header etc, add a page (which is never displayed as it is) to get an address and call it with the ID of the current contact in a querystring. I'm pretty sure that would work, but it feels instinctively wrong. The other way to do it would be to create a proper static file, as you would outside of a CMS, and, when called, let it look through the database. But this seems even more wrong. So what would be the proper way to do something like this? This time, my hope is to make a vCard solution, but based on my previous experiences (mainly from ASP and custom built CMSes) similar things comes up every now and then - maybe you need a downloadable XML-file based on something in the database or a slightly dynamic css/js file based on a setting (like an AJAX file with proper references to the theme or what not).


title: Editing wp-config.php file asks for another installation

text: I edited wp-config.php and now I can't access my existing site and I see the Wordpress installation page! Help! How do I get to my existing site?


title: How to get category name from URL and pass to a template

text:
I'm using the following page template to display the posts in a single category and plan to format the first post differently than the others. This works as desired but I have the category_name hard coded in the template. I want to use this template for several different categories and would like to learn how to pass the category_name to the template from a link. For example, the link to the desired page using the special template is http://wildcatweb.net/5th/ and '5th' is also the category_name. How do I tell the template to get the category_name from the URL and use it in the template?               <?php     /*     Template Name: pageAssignments     */ ?>          <?php get_header(); ?>

<?php the_title(); ?>
                                             <?php query_posts('showposts=1&category_name=5th'); ?>              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php the_title(); ?>
                                  <?php the_content(); ?>
           <?php endwhile; endif; ?>                     <?php query_posts('showposts=5&offset=1&category_name=5th'); ?>         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink() ?>"     rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?>
             <?php the_excerpt(); ?>
          <?php endwhile; endif; ?>
          <?php get_sidebar(); ?>          <?php get_footer(); ?>


title: How do I display an image before the first post of the loop when I'm using get_template_part?

text:
I have used $count before, but never run into this problem. I cannot get it to work. I have limited php background, so please be patient with me! Here is the $count setup code:               <?php $count = 0; ?>     <?php if ( have_posts() ) : // Start the Loop ?>         <?php $count++; ?>               <?php while ( have_posts() ) : the_post(); ?>             <?php get_template_part( 'content', get_post_format() ); ?>         <?php endwhile; ?>       <?php endif; ?>      Within content.php - here is what I am trying to do:               <?php if ($count == 1) { ?>
             <img src="<?php bloginfo('stylesheet_directory'); ?>/assets/stories-title.jpg" />
     <?php ;} ?>      Can anyone explain to me what's happening? To the best of my knowledge, I'm running into an undefined variable issue, but I'm not sure how to fix this without breaking the $count... do the conditional statements and content have to be in the same file for $count to work? UPDATE: The issue (as described below) was with variable scope - the $count variable does not carry over when using template_part. Here is the fixed code: **functions.php**               // remember number (so we can count posts)          /**      * Remember a number.      *      * @param  int|FALSE $add A number to add, or FALSE to reset the counter to 0 (zero).      * @return int      */          function wpse_count( $add = 0 )     {         static $counter = 0;              if ( FALSE === $add )             $counter = 0;         else             $counter += (int) $add;              return $counter;     }      **index.php**               <?php wpse_count( FALSE ); ?>          <?php if ( have_posts() ) : // Start the Loop ?>              <?php while ( have_posts() ) : the_post(); ?>           <?php wpse_count( 1 ); ?>             <?php get_template_part( 'content', get_post_format() ); ?>              <?php endwhile; ?>          <?php endif; ?>      **content.php**                   <?php if (count_posts() == 1) { ?>
                 <img src="<?php bloginfo('stylesheet_directory'); ?>/assets/stories-title.jpg" />
         <?php ;} ?>      **Additional Solution** For a MUCH simpler solution to this problem, see a different answer below. Just needed to use wp_query               <?php if ( $wp_query->current_post == 0 ) { ?>      No $counter needed.


title: Add Field to WordPress Register Form

text: How can I add a field to the WordPress Register form? For example, I want to add the "First Name" field in the users profile to the Register form, but I can't figure out how to do that. The field's name is first_name, but adding `<input type="text" name="first_name" id="first_name" value="<?php echo $_POST['first_name']; ?>" required="required" placeholder="<?php _e('First Name'); ?>" />` doesn't work for some reason. The form submits fine, but the profile doesn't get the "First Name" field filled in in the back end. I'm editing this plugin to tweak the register form: http://wordpress.org/extend/plugins/s8-custom-login-and-registration/


title: how can I do something on new user registration?

text: When I register a new user to my blog, I always receive an email. The code in simple terms should look like this.               on_new_user_registration(){                  //send email to admin             //I want to do something else.            }      I would like to do more than receiving an email. Can someone point me to the right code. I have tried using the `wp_insert_user()` function in wordpress but that creates the user inside the editor. thanks a lot.


title: Strange behavor of wp_nav_menu by not appearing

text: It is in header.php                 wp_nav_menu(array('theme_location' => 'top-nav','container_class' => '',  'fallback_cb' => ''));      in functions.php               function register_custom_menus(){         register_nav_menus(             array(                 'sidebar-menu' => __( 'Sidebar Menu' ),                 'about-menu' => __( 'About Menu' ),                 'toe-menu' => __('To Exhibit'),                 'tov-menu' => __('To Visit'),                 'media-menu' => __('Media'),                 'top-nav' => __('Top Nav')             ));     }         I do same thing for other theme and the menu appears just fine. I notice that wp_list_page() works as well. But I wanted to use wp_nav_menu so that I could add in custom link using menu admin. Could anyone tell me why it is not appearing at all?


title: menu entries are lost

text: Suddenly I cannot add any menu entry via the "Menu" settings option (....wp- admin/nav-menus.php). Any new menu I set results in de-selecting the currently selected menu and saving a "null" menu structure in my homepage! Any help would be greatly appreciated because my home page is affected/ Thank you


title: Remove ?preview=true from the address of custom post types

text: For some reason because i am using a custom function the preview doesn't work.               http://www.domain.com/template-for-rent/?preview=true      leads to 404 Page not found. However,               http://www.domain.com/template-for-rent/      works even if I don't publish the post. is there anyway to use htaccess or a custom function to remove `?preview=true` from all URLs of custom post types i am previewing? My custom function is:               add_filter( 'post_type_link', 'filterslash_post_type_link', 11, 2);          function filterslash_post_type_link( $post_link, $post ){ $post_link = home_url("/$post->post_name/"); return $post_link; }


title: Regenerate thumbnails after upload

text: I have this nice little code coming straight from the Wordpress codex               if($_FILES['user_picture']['size'] != 0):                 if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );                 $uploadedfile = $_FILES['user_picture'];                 $upload_overrides = array( 'test_form' => false );                 $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );                 if ( $movefile ) {                     $wp_filetype = $movefile['type'];                     $filename = $movefile['file'];                     $wp_upload_dir = wp_upload_dir();                     $attachment = array(                         'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),                         'post_mime_type' => $wp_filetype,                         'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),                         'post_content' => '',                         'post_status' => 'inherit'                     );                     $attach_id = wp_insert_attachment( $attachment, $filename);                 }             endif;      The thing is that it works great but it doesn't create all the image size set in the function.php. I don't want to run a plugin that regenerate a thumbnail each time I upload an image, there must be a way to create all those thumbs after upload. How ? **Update** After some investigation on how other script work, I need to get the file back and use the `wp_get_image_editor` function to make my thumbs... kinda a pain in the know what. Can't believe that wordpress don't resize images after running `wp_handle_upload` or `wp_insert_attachment`.


title: is there a way to get all queued scripts/styles into a template without `get_header()`?

text: in my main plugin page i check if a certain page is visited if so, i load a certain template. in the following way:               add_filter( 'template_include', array($this, 'includeTemplate'), 99 );     public function includeTemplate($template){          global $wp_query;         if(is_page() && $wp_query->query['pagename'] == 'my_page_name'){            include(plugin_dir_path( __FILE__ ).'templates/my_page_name.php');            die;         }         return $template;     }      my question is how can i load all the queue scripts and styles to this template without using `the_header()` I've tried :               global $wp_scripts;     foreach( $wp_scripts->queue as $handle ) :         echo $handle . ' | ';     endforeach;      The above echoed `admin-bar` Thanks.


title: How to add a second 'place order' button in WooCommerce

text: My client would like two 'Place order' buttons on his checkout page (http://www.jobgrandprix.fr/checkout/?set-cart-qty_2652=1). By default, the 'Commander' (his site is in French) button is at the bottom of the page. I'm trying to add a second one in the right hand column at the top of the page. I think form-checkout.php is what I need to modify. I think I need to add it where the shipping column usually is (not used here because it is a virtual product). If anyone has any pointers I'd be really grateful. Thanks.


title: Footer.php not showing?

text:
Here is my index.php file, for some reason the footer.php isn't being loaded through really weird, its in the directory of my theme, what could be causing this?                   <?php get_header(); ?>     <?php get_sidebar(); ?>
           <?php query_posts('cat=-15'); ?>      <?php if (have_posts()) : ?>            <?php while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink() ?>"><?php the_title(); ?>
          <?php          if ( has_post_thumbnail() ) { ?>          <a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?>          <?php } else {          } ?>
            <?php endwhile; ?>                <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
       <?php get_search_form(); ?>           <?php endif; ?>
          <?php get_footer(); ?>