WP Rewrite the last two parts of the URL

I have found quite a lot of post on the subject of WP rewrite but I can't find the right words to describe this problem. I'm trying to accomplish the following: `mysite.com/examentraining/vak/biologie/havo` To be rewritten to `/examentraining/vak?vakname=biologie&level=havo` So when the user types `mysite.com/examentraining/vak/biologie/havo` into their adress bar they should be shown the `mysite.com/examentraining/vak/` page, but the application should be able use the last two value's between slashes as get parameters (so for the shortcode script the url must look like `/examentraining/vak?vakname=biologie&level=havo`) I have tried the http://codex.wordpress.org/Function_Reference/WP_Rewrite. But the example closest to mine uses an number and only on variable. And at this point the syntax doesn't make enough sense to me to adapt it to my needs. Also when I want to use two variable do I have to call my_insert_query_vars( $vars ) twice? I hope there isn't a question exactly like mine that I have not found. EDIT after more than 2 weeks I still have not solved the problem. I have made the following but it doesn't seem to work, the rules are imported correctly (checked with wordpress plugin, the plugin even says the rule matches the request url). But it doesn't rewrite.                // Adding a new rule         function my_insert_rewrite_rules($rules)         {             $newrules = array();             $newrules['examentraining/training/([0-9]{1,})/?$'] = 'index.php/?p=1320&id=$matches[1]';                return $newrules + $rules;         }          // Adding the id var so that WP recognizes it         function my_insert_query_vars($vars)         {             array_push($vars, 'id');             return $vars;         }      I tried one of the simpler examples first, I want this code to rewrite `example.com/examentraining/training/513/ to example.com/?p=1320&id=513` So I want to open the page with the page id of 1320 (this works) and pass the id parameter to this page so my php code can use the variable either via `$wp_query->query_vars['trainingid']` or via $_GET['trainingid'] (visiting the url /?p=1320&id=513 works correctly). The only thing that changes in this url is the last part with the id (513 in the example). Could anybody tell me what is wrong with my rewrite rule? EDIT 2 I have since read that it is not smart to use such a generic get parameter as id with wordpress so I changed that and I tried another way of getting the page (Als works when called directly from wordpress)               / Adding a new rule         function my_insert_rewrite_rules($rules)         {             $newrules = array();             $newrules['examentraining/training/([0-9]+)/?$'] = 'index.php?pagename=examentraining/training&trainingid=$matches[1]';             return $newrules + $rules;         }          // Adding the id var so that WP recognizes it         function my_insert_query_vars($vars)         {             array_push($vars, 'trainingid');             return $vars;         }      For the sake of testing I flush my rules every init. I will keep searching but I really hope somebody can point me in the right direction.


How do I find where the current value of the option 'registration' in the SQL database?

I am trying to understand what the following line from wp-signup.php does:               $active_signup = get_site_option( 'registration' );      I can see from the following documentation: http://codex.wordpress.org/WPMU_Functions/get_site_option that this will return the value of the site option '`registration`'. But how do I find where the current value of the option 'registration' in the SQL database? Or in general, how do I find the association between a key and the data in the database?


Multiple WP_Query loops with Pagination

There are a few other questions about this (and WP_Query pagination seems to be a huge question for a lot of people) so I'm trying to narrow down exactly how to make it function. I'm able to create a single custom loop with pagination this code:               // http://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/     $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $args = array(         'showposts' => 2,         'paged' => $paged     );     $wp_query->query($args);     while ($wp_query->have_posts()) : $wp_query->the_post();          // The Post     the_title();     echo '
';     the_category(' ');     the_excerpt();     echo '
';          endwhile;     // http://codex.wordpress.org/Function_Reference/paginate_links#Examples     $big = 999999999;     $pag_args = array(         'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),         'format' => '?paged=%#%',         'current' => max( 1, get_query_var('paged') ),         'total' => $wp_query->max_num_pages     );     echo paginate_links($pag_args);     $wp_query = null;     $wp_query = $temp;      ...but naturally if I copy/paste this loop, it works as an exact clone, meaning, when you click on "Page 2" it takes you to Page 2 for BOTH the loops. Is there a way to break these apart from each other so each paginates separately? Here's the full code complete with duplicate loop if anyone is interested in setting up their own local version and toying with it: http://paste.pocoo.org/show/573108/


Record Paypal express checkout transactions into WordPress database after been processed

I am using the code bellow to process my transaction through Paypal express, but I would like to record it to my wordpress database under a custom post type name ORDERS. Could any one put me in the right direct? I want to know where I can make that call and how. /* ===================================== * PayPal Express Checkout Call * ===================================== */ require_once ("paypalfunctions.php");                $PaymentOption = "PayPal";      if ( $PaymentOption == "PayPal" )     {     /*      '------------------------------------      ' this  step is required to get parameters to make DoExpressCheckout API call,       ' this step is required only if you are not storing the SetExpressCheckout API call's request values in you database.      ' ------------------------------------      */     $res = GetExpressCheckoutDetails( $_REQUEST['token'] );          /*      '------------------------------------      ' The paymentAmount is the total value of      ' the purchase.       '------------------------------------      */          $finalPaymentAmount =  $res["PAYMENTREQUEST_0_AMT"];          /*      '------------------------------------      ' Calls the DoExpressCheckoutPayment API call      '      ' The ConfirmPayment function is defined in the file PayPalFunctions.php,      ' that is included at the top of this file.      '-------------------------------------------------      */          //Format the  parameters that were stored or received from GetExperessCheckout call.     $token                      = $_REQUEST['token'];     $payerID                    = $_REQUEST['PayerID'];     $paymentType            = 'Sale';     $currencyCodeType = $res['CURRENCYCODE'];     $items                      = array();     $i                              = 0;     // adding item details those set in setExpressCheckout     while(isset($res["L_PAYMENTREQUEST_0_NAME$i"]))     {         $items[] = array('name' => $res["L_PAYMENTREQUEST_0_NAME$i"], 'amt' =>   $res["L_PAYMENTREQUEST_0_AMT$i"], 'qty' => $res["L_PAYMENTREQUEST_0_QTY$i"]);         $i++;     }          $resArray = ConfirmPayment ( $token, $paymentType, $currencyCodeType, $payerID, $finalPaymentAmount, $items );     $ack = strtoupper($resArray["ACK"]);     if( $ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING" )     {              /*          * TODO: Proceed with desired action after the payment           * (ex: start download, start streaming, Add coins to the game.. etc)          '********************************************************************************************************************          '          ' THE PARTNER SHOULD SAVE THE KEY TRANSACTION RELATED INFORMATION LIKE          '                    transactionId & orderTime          '  IN THEIR OWN  DATABASE          ' AND THE REST OF THE INFORMATION CAN BE USED TO UNDERSTAND THE STATUS OF     THE PAYMENT          '                            '*******************************************************************************************       *************************          */              $transactionId      = $resArray["PAYMENTINFO_0_TRANSACTIONID"]; // Unique transaction ID of the payment.         $transactionType    = $resArray["PAYMENTINFO_0_TRANSACTIONTYPE"]; // The type of transaction Possible values: l  cart l  express-checkout         $paymentType            = $resArray["PAYMENTINFO_0_PAYMENTTYPE"];  // Indicates whether the payment is instant or delayed. Possible values: l  none l  echeck l  instant         $orderTime              = $resArray["PAYMENTINFO_0_ORDERTIME"];  // Time/date stamp of payment         $amt                            = $resArray["PAYMENTINFO_0_AMT"];  // The final amount charged, including any  taxes from your Merchant Profile.         $currencyCode           = $resArray["PAYMENTINFO_0_CURRENCYCODE"];  // A three-character currency code for one of the currencies listed in PayPay-Supported Transactional Currencies. Default: USD.         $feeAmt                     = $resArray["PAYMENTINFO_0_FEEAMT"];  // PayPal fee amount charged for the transaction     //  $settleAmt          = $resArray["PAYMENTINFO_0_SETTLEAMT"];  // Amount deposited in your PayPal account after a currency conversion.         $taxAmt                     = $resArray["PAYMENTINFO_0_TAXAMT"];  // Tax charged on the transaction.     //  $exchangeRate       = $resArray["PAYMENTINFO_0_EXCHANGERATE"];  //      Exchange rate if a currency conversion occurred. Relevant only if your are billing in their   non-primary currency. If the customer chooses to pay with a currency other than the non-  primary currency, the conversion occurs in the customer's account.              /*          ' Status of the payment:          'Completed: The payment has been completed, and the funds have been added successfully to your account balance.          'Pending: The payment is pending. See the PendingReason element for more information.          */              $paymentStatus      = $resArray["PAYMENTINFO_0_PAYMENTSTATUS"];              /*          'The reason the payment is pending:          '  none: No pending reason          '  address: The payment is pending because your customer did not include a confirmed shipping address and your Payment Receiving Preferences is set such that you want to manually accept or deny each of these payments. To change your preference, go to the Preferences section of your Profile.          '  echeck: The payment is pending because it was made by an eCheck that has not yet cleared.          '  intl: The payment is pending because you hold a non-U.S. account and do not have a withdrawal mechanism. You must manually accept or deny this payment from your Account Overview.          '  multi-currency: You do not have a balance in the currency sent, and you do not have your Payment Receiving Preferences set to automatically convert and accept this payment. You must manually accept or deny this payment.          '  verify: The payment is pending because you are not yet verified. You must verify your account before you can accept this payment.          '  other: The payment is pending for a reason other than those listed above. For more information, contact PayPal customer service.          */              $pendingReason      = $resArray["PAYMENTINFO_0_PENDINGREASON"];              /*          'The reason for a reversal if TransactionType is reversal:          '  none: No reason code          '  chargeback: A reversal has occurred on this transaction due to a chargeback by your customer.          '  guarantee: A reversal has occurred on this transaction due to your customer triggering a money-back guarantee.          '  buyer-complaint: A reversal has occurred on this transaction due to a complaint about the transaction from your customer.          '  refund: A reversal has occurred on this transaction because you have given the customer a refund.          '  other: A reversal has occurred on this transaction due to a reason not listed above.          */              $reasonCode = $resArray["PAYMENTINFO_0_REASONCODE"];              // Add javascript to close Digital Goods frame. You may want to add more javascript code to         // display some info message indicating status of purchase in the parent     window         ?>                                              echo "DoExpressCheckoutDetails API call failed. ";         echo "Detailed Error Message: " . $ErrorLongMsg;         echo "Short Error Message: " . $ErrorShortMsg;         echo "Error Code: " . $ErrorCode;         echo "Error Severity Code: " . $ErrorSeverityCode;     ?>                       <?php      }      }


Page not appearing in navigation bar

Here is the site: http://goo.gl/QgfSMq I have a Testimonial page and a Blog page but they are not appearing in the navigation bar. http:// progreenkleen.net/blog/ I have set this page to be the blog page http://progreenkleen.net/testamonials/ (I know it's spelled wrong) I have made sure that they pages are published, public, and I have looked in the Custom Menu but that does not seem to be operative. There are pages listed in the custom menu section, but I removed a couple of existing pages and they are still appearing in the navigation bar. I was able to set a couple of the existing pages as Draft and they disappeared. I have compared the pages I want to appear with existing ones and I don't see anything irregular. I'm lost as to what to check next.


Form Action submit over https

I am trying to make my website PCI compliant. It has a login form on top of each page in which the form tag is written like so:               <form id="wp_login_form" action="<?php echo site_url('wp-login.php', 'https') ?>" method="post">      According to wordpress documentation this should print an https url in the action, but it doesn't. Any idea why or how I should go about this?


How to show post from category select

This code is in my `functions.php`:               array( "name" => "Headline",     "type" => "section"),     array( "type" => "open"),          array( "name" => "Headline  Categories",     "desc" => "Choose a category from which featured posts are drawn",     "id" => $shortname."_headline",     "type" => "select",     "options" => $wp_getcat,     "std" => "Select a category"),          array( "type" => "close"),      Now, how to show posts from category select on `page.php` or page template?


Theme calling page.php instead of home.php

I'm trying to help someone troublesheet a custom theme they made. The blog is set to display posts on the homepage, but the homepage should be custom from the rest of the site. The theme has a home.php set up with the customization. When we change to the theme, home.php isn't loaded. I printed a debug_backtrace() and see that it's actually calling page.php instead of home.php. According to the template hierarchy, page.php should be being called since I've not set a static page as the homepage. What else can I check to see why it's calling page.php instead of home.php?


Edit the markup of categories list

I want to list x number of categories. I'm using `wp_list_categories` function, it generates the following markup
Uncategorized

Category 2

Category 3

Category 4

Category 5
      However I need to wrap every two li items inside a div, For example:

Uncategorized

Category 2

Category 3

Category 4

Category 5

      How I can do that? Thanks.


Display navigation for the category I just came from when a post is in multiple categories

This is a problem that has plagued me for a while, and I've used various methods to try to get around it. The typical Scenario where I get this problem is: I have a bunch of posts in the standard 'Posts' Post Type. I've organised my posts into categories and am using these categories to display as sub menu - so, all posts in the current category are displayed in the side nav. The problem: If I have a post that exists in 2 different categories and I click into that post, then Wordpress gets confused as to what category to display in my side nav - so, it doesn't know what posts to display in the side nav. It needs to know what category I just came from so it can display the relevant side nav. Is this a common problem in Wordpress. I can't seem to find an answer to it.


Link to full size post thumbnail

I´m using this code:               <?php     // get portfolio     $args = array( 'post_type' => 'portfolio', 'posts_per_page' => 100, 'orderby' => 'title', 'order' => 'asc' );     $loop = new WP_Query( $args );         $port = array();     while ( $loop->have_posts() ) : $loop->the_post();                   $idx = get_the_ID();             $year_completed = get_post_meta($idx, 'year_completed', true);             $website_addr = get_post_meta($idx, 'website_address', true);             $thumb = get_the_post_thumbnail($idx, 'thumbnail'); //250x200 - featured image             $title = get_the_title();             $excerpt = get_the_excerpt();             $content = get_the_content();                  //get 'Solutions' terms             $terms = get_the_terms($idx, 'Solutions');             $terms_string = '';                  //build up comma delimited string             foreach($terms as $t){                 $terms_string .= $t->slug . ' ';             }             $port[] = array(                 'id' => $idx,                 'year_completed' => $year_completed,                 'website' => $website_addr,                 'thumb' => $thumb,                 'title' => $title,                 'content' => $content,                 'excerpt' => $excerpt,                 'terms' => $terms,                 'terms_string' =>$terms_string, //classifications (comma delimited slugs)                 'permalink' => get_permalink(),             );     endwhile;          $terms = get_terms('Solutions');              $filters = '

show all
';                                                foreach($terms as $t){                             $filters .= '
slug . '">' . $t->name . '
';// $t->count                 }                 $filters .= '

';     ?>        and:                    <?php echo $filters; ?>

         <?php foreach($port as $p){ ?>             <li class="span3 element <?php echo $p['terms_string']; ?>">
                     <?php echo $p['thumb']; ?>

<a href="<?php echo $p['permalink']; ?>"><?php echo $p['title']; ?>

         <?  } //end foreach ?>

      ### I´d like to link this to the fullsize image               <?php echo $p['thumb']; ?>


Storing post meta values in an array

I want to create multiple metaboxes to store some values (for example 10 values). Currently I store them with different keys (val_1, val_2..). How can I store all of the values in a single meta key (for example, "values"). This is how I add the post meta boxes:               <input name="val_1" type="text" id="val_1" value="<?php echo get_post_meta( $post->ID, 'val_1', true ); ?>" />     <input name="val_2" type="text" id="val_2" value="<?php echo get_post_meta( $post->ID, 'val_1', true ); ?>" />      This is how I save the meta boxes:               if ( isset( $_POST['val_1'] )){             update_post_meta( $post->ID, 'val_1', $_POST['val_1'] );         }          if ( isset( $_POST['val_2'] )){             update_post_meta( $post->ID, 'val_2', $_POST['val_2'] );         }


How to cdv from a custom CMS to WP

I'm working with a client to move their content from a custom CMS to WP. They've sent me this csv to work from. https://dl.dropboxusercontent.com/u/54924720/TOTD_SCRAPE_TAKE1_.csv The only csv to WP imports I've done in the past have come from other WP installs. I have several questions.   1. Can I use the content of these fields in the shape they're in now? Will I need to have them resend with the content as text in the fields without the HTML? Much of the HTML is formatting - it would seem like we wouldn't to import that formatting in the post, but instead handle that formatting within the theme now. And, for example, the date is not in a format that I think WP will understannd.   2. The comments - They have a comments column, but they also have comments showing in their "fullarticle" column. It's like the comments were scraped/exported with the content of the article. In order to import the commennts, won't I need fields for comment id, comment author, author link, etc... individually for each comment per post? Will importing the comments be part of the same CSV?   3. Assuming that I can get the content IN the fields in a form that will work for the actual import, would I then take the csv they send and rename/map their existing fields to the appropriate WordPress fields, creating my custom post types and custom fields ahead of time so that I have all of those ids to use in the csv? Seems like it would be better to send them an example csv file of what I'll need and let them figure out an export or scrape to match.


How do I replace "Username" in the Wordpress login form?

![enter image description here](http://i.stack.imgur.com/1HYXu.jpg) I would like to replace "Username" in the Wordpress login form with another word. How do I go about doing that?


Get an archive of a specific category

I have created a widget to get an archive with the post count. The issue is, I want to display the monthly archive of the specific category blog. Here is the code I've tried to display the archieve. How can I display the archive of the specific category with post count.                      wp_get_archives( apply_filters( 'widget_archives_args', array(             'type'            => 'monthly',             'show_post_count' => 6                  ) ) );      Any suggestions would be greatly appreciated.


Displaying Event within two given time frames

I'm trying to display two different posts from my CPT named Events. One is going to be the next event the other is going to be previous event. I've got a metabox called 'Event date' The client at the moment places the date of the event in here. I'm thinking of somehow using this date as a "breaker" if its written in D.M.Y format and that date has past then that event won't be displayed in next event, kind of like an expiration date. So I would need to query the posts to the nearest date displayed in the metabox and display that post as the Next Event. This is how the logic would work in my head, however I can't seem to find the correct stepping stone to start. Sorry if this isn't very clear.


WP_Query: Posts within category OR custom post type

I don't like to bother you guys, but this is already driving me nuts. I have a legacy post model within a specific category called 'listas-2' that used shortcodes to show some fancy things. Now I have created a custom post type named 'lista' that does the same thing but way better, using post_metas. The issue now is that I have to make an archive of both at the same time with pagination, which contains the legacy and new posts. I can't manage to show both at the same time, already tried to add a tax_query but I can't because the custom post type doesn't use it, only the common post. I also tried to merge the queries but I got lots of pagination issues. The goal: A WP_Query that requests posts within the category 'listas-2' and custom posts named 'lista', that does not have categories. What can I do? Thanks in advance and sorry for my bad English, Vinicius


How-to implement admin Ajax inside an admin WP_List_Table?

I am new to WordPress if someone will help me I will be very appreciate. There is parameter ajax "true" but in docs. wasn't said how to implement Ajax using WP_List_Table Class?               parent::__construct( array(                 'singular'  => 'user',     //singular name of the listed records                 'plural'    => 'users',    //plural name of the listed records                 'ajax'      => true        //does this table support ajax?             ) );


query_post while (have post) get_template_part()?

My goal: Is to give the user the ability, if they so choose, to create a new category. I have the current categories saved in a separate php file and call them in using `get_template_part()`, there are currently 4 categories. If the user wants to create a 5th category, I want them to be able to choose the name and then create it using the same template as the previous categories. Example Template.

Main

something

box

box
box
box

      This should then appear on the home page along with the other 4 categories.


improve my array to display the_title, category, excerpt for homepage

Im trying to create an array for my bespoke homepage template which gets the title, category, featured thumbnail and excerpt from the last 3 blog posts and puts them into the correct divs for styling. So far i have managed to come up with the following:
           <?php     $args = array( 'numberposts' => 3, 'order'=> 'DSC', 'orderby' => 'date' );     $postslist = get_posts( $args );     foreach ($postslist as $post) :  setup_postdata($post); ?>

<?php echo substr(get_the_title(),0,58); ?>

<?php echo substr(the_category(),0,70); ?>

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

<?php the_post_thumbnail(220,120,true); ?>

      But as you can see this displays 3 posts order by date, but the substr code is cutting the ends of words off & also the images are not displaying at the 220*120 resolution. here is an image of what i am trying to acheive http://s16.postimg.org/eqqsent91/screen2.png My code knowledge is rusty so any help to improve this code would be really helpful.


Plugins upload to wordpress in wampserver via filezilla

I am new to Wordpress. I just downloaded a plugin. I am trying to upload plugins the normal way but they are unable. So my quiz is, can you upload plugins in Wordpress to wampserver via filezilla? If so, how should I go about it.


I installed the Deprecated Calls plugin and it's telling me to change `register_sidebar_widget()` and `register_widget_control()`, essentially add `wp_` first. I did but I'm getting `Missing argument 3 for wp_register_sidebar_widget()` and `wp_register_widget_control()` Is it ok if I put the default `none` for the 3rd arg?


Best Practices for Regression Testing WordPress Websites?

**Hi all,** I'd like to hear what others who are delivering complex non-blog solutions to clients with WordPress as a platform what they are using for automated **Regression Testing**? For those not familiar with the term _"regression testing"_ Wikipedia defines it as: > _Regression testing is any type of software testing that seeks to uncover > software errors after changes to the program (e.g. bugfixes or new > functionality) have been made, by retesting the program. The intent of > regression testing is to assure that a change, such as a bugfix, did not > introduce new bugs._ More telling Wikipedia says the following which is exactly what I'm experiencing on a project right now: > _Experience has shown that as software is fixed, emergence of new and/or > reemergence of old faults is quite common. Sometimes reemergence occurs > because a fix gets lost through poor revision control practices (or simple > human error in revision control). Often, a fix for a problem will be > "fragile" in that it fixes the problem in the narrow case where it was first > observed but not in more general cases which may arise over the lifetime of > the software. Frequently, a fix for a problem in one area inadvertently > causes a software bug in another area. Finally, it is often the case that > when some feature is redesigned, some of the same mistakes that were made in > the original implementation of the feature were made in the redesign._ With the global nature of actions and filters I'm finding that complexity starts ramping as I add more client-requested functionality and it becomes hard to get a complex plugin stable, especially if it uses a lot of calls to `WP_Query` and updates the database a lot. The solution in my mind would be to set up regression testing with a series of _"test cases"_ to comprise a _"test suite."_ In concept it's not that hard when you are testing the HTML output of HTTP GET requests. But it gets a little more complicated when you have to test things when logged in via the admin console and/or to test jQuery interactions. I'm setting this up as a community wiki in hopes we can gather best practices here but I'm really anxious to hear processes if any other WordPress professionals are using.


Showing sidebar-2 on custom template page

Environment: WP 3.5, Twenty Twelve child theme. I created a custom template. Now, I'd like to display the built-in sidebar-2 in this custom template page (instead of the default sidebar-1). sidebar-2 is already registered by twenty twelve functions.php. I read a bit about get_sidebar and how to activate other sidebars, but I'm still a bit confused. To activate sidebar-2 on this custom template I created a file sidebar-customtemplate.php in my child theme directory with this content:               <?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>         <div id="secondary" class="widget-area" role="complementary">                            <?php dynamic_sidebar( 'sidebar-2' ); ?>         </div><!-- #secondary -->     <?php endif; ?>      Then in my custom template file I replaced `get_sidebar();` with `<?php get_sidebar( $customtemplate ); ?>`. Then I added some widgets to the sidebar-2 (from Appearance - Widget), but in the home page still sidebar-1 is displayed! Why? :(


Print out one of 2 post category

I've been trying for quite a few hours to get something to print out in loop: post has 2 categories, one of them is `prace` (slug) and I need the other one printed. If it isn't too much to ask. Tried just about everything with categories I could but can't get any further due my lack of knowledge of working with arrays in PHP. Thanks in advance.


how do i in ignore/disable/delete a javascript call from parent in child theme?

I am working on a child theme and I want to disable a JavaScript file from the parent folder instead of deleting it. I have a `functions.php` file in my child theme folder but don't know how to do it. In my parent folder I have this file in my js folder: `jquery.tipsy.js` and I want to ignore it in my child theme. What is the best way to do this?


Infinite Scroll Masonry triggered by pagination not working

I'm triggering more posts in my Masonry layout when a user hits the bottom of the page. The JS sends a count each time this happens and I'm using that as my 'paged' argument. However I'm getting repeated posts each call. Can someone help me to trigger the pagination correctly to get the next set of posts to loop?               function wp_infinitepaginate(){      $paged = $_POST['page_no'];          # Load the posts with a loop         $args = array(           'posts_per_page'  => 5,           'paged'           => $paged,            'orderby'         => 'post_date',           'order'           => 'DESC',           'exclude'         => 'none',           'post_status'     => 'publish'         );               $posts = get_posts($args);            foreach ($posts as $post) : setup_postdata($post); ?>
              <a href="<?php the_permalink() ?>">               <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); }?>
<?php the_title(); echo $counts; ?>

By <a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"><?php the_author_meta('display_name'); ?> on <?php the_time(get_option('date_format'));?>

               <?php the_excerpt(); ?>
       endforeach;             exit;     }


Redirect 301 www.my-site.com/page/n to www.my-site.com/

How to make redirection on WordPress site with .htaccess to redirect this: http://www.my-site.com/page/n to home page: http://www.my-site.com/ I do not wish to list previous post on site on first page of site, I removed paginated links from bottom of index.php but it is possible to open those pages typing address in browser location bar, or to find already indexed links by search engines...


Non page link in wp_list_pages

I would like a navigation something like this. Home - People - About - Services - Contact Home, About, Services and Contact are all pages. People DOES NOT have a page, I would like to use this link to open a second Navigation. Is it possible to add a link in wp_list_pages that doesn't link to a page. Is it also possible to add a id to this link that doesn't have a page. I would like the code to look something like this.

Home

People

About

Services

Contact


WPAlchemy output all metabox data for a certain field on one page

I was tasked with rebuilding works website as my first project for the job, and decided to go down the wpalchemy class route to help make meta boxes for my custom post type (I'm not going to use plugins). I'm currently using (inside my theme page)                   $sidebar_excerpt = $sidebar_excerpt_meta->the_meta();      to make a variable for the meta data and then using                   if ($sidebar_excerpt) {             echo '';             echo '
'.$sidebar_excerpt['description'].'
';         }      To check that the data exists before displaying it, although I have a dilemma! I want to actually display not just meta data from this particular page, but loop over all the database data for this particular metabox, does that make sense? So each of my custom post type pages has 1 excerpt description and text, then overall on the actual template page I want to grab ALL the excerpt data from all pages from the content post type with this metabox data, then I'll limit the output to 3 or so. I really want to achieve this although I'm scared I'll go over my deadline without working this one out? could any kind person please advise me or point me on the right track? Many thanks Phil


Correct way to use get_template_part() and get_post_format() with custom post types?

I have a custom post type of 'competitions'. In order to customise the display for this CPT in, for example, category listings I am doing the following:   * Create a `category-competitions.php` file   * Create a `content-competitions.php` file   * Within the loop in that file, call `get_template_part('content-competitions', get_post_format() )'` This works, but I'm not sure this is the correct method. Is it necessary to include the whole `category-competitions.php` file to change that one line, or is there a built in way to achieve this that I am missing?


dynamically limit depth of wp_list_pages

I guess that this should be an easy one but I haven't yet find the proper solution. I want to limit the depth of wp_list_pages so as not to display the pages of the last level. So supposing that parent page A has 3 levels of pages I only want to list first 2 levels. I was looking for a function to count the maximum depth of children for a page but no success. Till now my code is               $parents = get_post_ancestors($post->ID);     if (count($parents)>1) {         $parent = $parents[count($parents)-2];     } else  {         $parent = $post->ID;     }          $args = array(             'depth'        => 0,  // this should be set dynamically             'child_of'     => $parent,             'sort_column'  => 'menu_order, post_title',             'post_type'    => 'page',             'post_status'  => 'publish'         );           wp_list_pages( $args );      Any help is greatly appreciated


How do I tell how popular a theme is?

Guessing the answer is no, but just wondering if there's a way to tell how popular a theme is.


Where do I find (free) fully-internationalized themes?

I'm trying to find a theme which is fully internationalized. I've perused the list of translation-ready themes in the theme gallery, but each one seems to be missing some little detail here and there. The only really, really fully translated theme seems to be Twenty Ten. Not that I dislike it too much, but there's a lot of redundancy and duplication in the CSS, so even simple customization is a great pain. I've already been there, and I'm not very eager to go back. So, are there any other options available? Where do I find fully- internationalized themes? EDIT: More specifically, I need themes with a full French translation already available.


Remove "Posted on" and "Posted in" from the Twenty Ten Theme

I just upgraded to the latest Wordpress and activated this theme. It displays the following * * * ## Hello world! Posted on May 27, 2010 by admin Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! Posted in Uncategorized | 1 Comment | Edit * * * Is there an option to remove the Posted on and Posted in ?


How to set up Wordpress in the intranet?

I have been looking for an answer for long time now and have tried on a few alternatives too, but still I am unable to do it. What? : I want to set up Wordpress on the intranet in my workplace most likely using buddypress to set up a community. I just don't know how. What are the restrictions at my workplace? : We don't have any access to the internet. Nothing. Its a super secure workplace (or so they want to make it). So I want a method to set up the whole thing using offline executables, preferably using open source frameworks/tools. What have I tried doing till now? : I have tried using bitnami wordpress multisite. But I still fail to host the website for the public. Locally, it works fine. I am also acquainted with WAMP, but not sure how to host a website so that everyone can see it in the intranet using WAMP. I tried using IIS and found it supremely confusing. I found Windows platform installer that, as I read, does the work, but as I said, I have no internet connectivity at my workplace. Can anyone suggest a way out to host a multisite Wordpress buddypress website on the intranet and help me move on from the stagnancy I have been for months now. Thanks


How to use AJAX to check if user is still logged-in?

I am working with Wordpress 3.8 I have an app that I would like to use AJAX to check with Wordpress to determine if their idle time has expired. In my functions.php, I have the following hook that checks when someone requests a page:               function cookie_expiration( $expiration, $user_id, $remember ) { echo 'ck time';         return $remember ? $expiration : 600;// 10 minutes     }     add_filter( 'auth_cookie_expiration', 'cookie_expiration', 99, 3 );      This works fine when someone requests a page. Here is the function that is called by the AJAX:               wp_validate_auth_cookie();                 exit(json_encode(array('result' => is_user_logged_in())));      I'm guessing the problem is that the AJAX call does not have the accompanying cookie with it. So how can I check to see if an idle user has been idle too long using an AJAX call?


Random post order and taxonomy filter

I have category page where I display articles in a random way. There's a taxonomy by city in my articles. So at the top of my page, there are some links in order to display the category with taxonomy filter. At the beginning, my links looked like :               <a href="<?php     $category_id = get_query_var('cat');     echo get_category_link( $category_id );     ?>?tag=paris">Paris          <a href="<?php     $category_id = get_query_var('cat');     echo get_category_link( $category_id );     ?>?tag=london">London          etc ..      So I could stay in the same category, and apply my filter. With the random behaviour, I had to add this to call my articles :               <? query_posts(array(     'orderby' => 'rand'     ));     if (have_posts()) : while (have_posts()) : the_post();     ?>      But now my filters don't work anymore. I'd like to avoid to call a specific category because I have very much categories. And every time I need to have my cities-links at the top. So if I could use the same template, it would be more handy. I'm not very good with php.... Does someone has an idea ? I thank you in advance for your help


Change default ordering of display name

WordPress dashboard offers user the opportunity to choose whether their name is output as Firstname Lastname or several other options with Firstname Lastname order the default. I would like that default changed to Lastname Firstname. Can anyone suggest how it can be done?


Archive filtering

I was wondering if I can filter archive posts that are in a specific category, then apply another filter. For example, I have a featured category (where I display featured posts) and then I have my usual categories (like Personal, Blog, Fun). If i`m on /category/fun can I display all my posts from Fun category that are also in featured? I tried something, but this kinda shows me all posts from both categories...               <?php global $cat;             $curr_cat = get_category( $cat );             $cat_name = ( $curr_cat ) ? $curr_cat->cat_name : 'No Category Found!!';             ?>             <?php             $my_query = new WP_Query('category_name=featured,'.$cat_name.'&showposts=8');             while...     ?>      Any thoughts?


How can Custom Post Type and a page have the same slug?

I have a page called "Art" that can be viewed at `/art`. I also have a custom post type called "samples" with a post called "Art" inside of it. It SHOULD be viewed at `/samples/art`. For some reason, instead of having `/samples/art` as the URL, WordPress is forcing `/samples/art-2`. The Art page and the Art post are two completely irrelevant pieces of data. Is there any way to let both of these entities exist with a clean URL?


How to get category pages to look like a certain archive page?

I'm not sure if this question has been answered, I'm not sure of how i should have even worded this question but... I have a custom post type called videos and the style of the archive is different from the category archive. For this post type i have the category Video and with sub/sub categories; for example: Video   -Music Video   --The Artist Group   --The Artist as Solo   -Interviews   -Performances   --The Artist Group   --The Artist as Solo   -Other   Now how do I get those categories to have the same style as the Video Post Type Archive without having to create a different php file for each category. Or would I have to create a php file for the video category? but if I had to do that then how would i get those categories to take the style of that archive?


Author Page List - change to show authors instead of not subscribers

I am trying to change this code in my Authors List page template               $all_users = get_users();         $allowed_users = array();         foreach ( $all_users as $user ):             $wp_user = new WP_User($user->ID);             if ( !in_array( 'subscriber', $wp_user->roles ) ):                 array_push($allowed_users, $user);             endif;         endforeach;      to show only authors instead of "everyone except subscribers". I tried this:               if ( in_array( 'author', $wp_user->roles ) ):      and it does not work. How can I change this code to show only users defined as 'author'?


Custom Post Type - Archive page title

I'm wondering if I could make a custom Page title for my Custom post type Archive page? Today i'm using: `<title><?php wp_title( '|', true, 'right' ); ?></title>` For my regular pages it display what i want i to, but on my Custom Post Type archive page it Displays: "'Custom Post Type Name' Archive". Is it possible to add a custom page title for just that page?


Multisite - Echo admins profile meta

I'm having a problem with echoing the admin's profile meta in a custom post type template. It used to work, but for some reason it's not working anymore. I'm not aware of any changes made that would cause such behavior. This is the code I'm using in the loop:               <p>     <?php     $thisblog = $current_blog->blog_id;     $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, 'admin_email'));     $phone_number = get_user_meta($user_id_from_email, 'phone', true);     if($phone_number!='') { ?>     <?php echo $phone_number; ?>     <?php } else { ?>     <?php } ?></p>      I've also tried this:               <?php     global $current_blog;     $thisblog = $current_blog->blog_id;     $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, 'admin_email'));     $details = get_userdata($user_id_from_email);     if ($details->nickname) echo $details->nickname;     ?>      And this:               <?php     global $current_blog;     $thisblog = $current_blog->blog_id;     $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, 'admin_email'));     $firm_name = get_user_meta($user_id_from_email, 'nickname', true);     if($firm_name!='') { ?>     <?php echo $firm_name; ?>     <?php } else { ?>     <?php } ?>      That echoes nothing. The following code echoes _some_ data, but it seems to be doing so for the super admin:               <?php $user_info = get_userdata(1);           echo $user_info->last_name .  ", " . $user_info->first_name . "\n";     ?>      Any ideas as to what's wrong?


Filter or action hook to insert content on admin pages before </body> tag

I am developing an administrator plugin and want to be able to write some HTML content just before the last body tag . This content will initially be hidden then displayed with javascript when a user clicks on a button. Can anybody advise if there are any action or filter hooks that I can leverage to insert this? Remember this is for admin pages not theme pages.


Compare WP Custom Field date

I had create a custom field "date" with this format 16/09/2013 (d/m/Y). How can i compare date and show only post with date from today ? This is my query that don't work !!               $args = array(       'posts_per_page' => 100,             'meta_key' => 'date',         'orderby' => 'meta_value',         'order' => 'ASC',            'meta_query' => array(         array(             'key' => 'city',             'value' => 'London',             'compare' => 'LIKE'         ),         array(             'key' => 'date',             'value' => date("Y/m/d"),     'compare' => '>=',         'type' => 'DATE'         ),     )     );


Date in the URL with The Events Calendar

I am somewhat of a Wordpress beginner so please excuse any ignorance. I have installed the plugin The Events Calendar (http://tri.be/wordpress- events-calendar/) and it works pretty much perfectly. One issue I have is the URL format for an event, which based on the URL slug is `/upcoming- event/[event title]/`. If I have multiple events of the same name, the URL looks like `/upcoming-event/[event title]-2/`. This is undesirable, I would prefer to have URLs more like that possible with posts `/upcoming-event/[year]/[month]/[event title]`. On a whim, I attempted to copy in the format used for posts `/%year%/%monthnum%/%postname%/` but alas, no luck. I had a quick check to make sure it wasn't a PRO feature but it doesn't appear to be. So does anyone know if this is possible somehow?


Automatically add child pages to menu

I've been reading through some of the questions and solutions people have already asked to no avail. I have 4 menus on my WP Site, each of which will have children. What I would like the menu to do is automatically add children to it and display it without me/someone else having to manage the menu pane. For example:   * About us      * Child 1     * Child 2     * Child 3     * Child 4 Where all the children pages are added as new pages, and set to have About Us as the parent. As far as I understand now the only way is to use the menu pane. I've looked at Auto Submenu, Gecka Submenu and others, but they don't seem to help at all. Any suggestions?


get data from wp-query, outside the loop & without url change

I am working on an advanced search on wordpress based on custom taxonomies. I've been stuck for 72h so I was hoping to have some help or thought... **Step 1** --- in the js file the query strings are created like that:               if (jQuery('#s').val() == ''){     URL = "/?genre=" + genre + '...other Stuff' #content';     }else{     URL = "/?s="+searchQueryString+"&genre=" + genre +'...other stuff' #content';     }      It nicelly load my custom loop in my #content div without changing the browser url or reloading the header, which is pretty good...so far. :-) **Step 2** --- then I wrote 2 functions in my function.php , one to load the loop with the GET[] elements on main page, using `new WP_Query` and one that does the same thing for search queries but only filter with:               add_action('pre_get_posts','SearchFilter');      Which is compiling my GET[] filters with the GET[s] in the content.php, Still all good.... **Step 3** --- (problem^^)--- I want to add a css class to desactivate the radio buttons located in my header.php, depending on the results in the loop. **Try-1** I thought I could create a php array to compile the terms found while the loop is happening, and then compare it with my buttons value.like that:               $args = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'slugs');     $results = wp_get_post_terms(get_the_ID(),'category',$args);       foreach ($results as $result){         array_push($stack, $result);          }      But there is no way to retrieve the data from that array in the header afterwhile, or to create it from the header using things like `global $post;`since my url doesn't change. it just shows the homepage query. **Try-2** I also thought I could encode it to json and then put some action in my js file. but so far it just return json unexpected character, and I got the feeling that even if I crack it, its not going to be the right way since its going to make the js file heavier. May be I'm just missing something about the Global wp_query and I don't need to charge my script? Excuse my english and the long question, thanks a lot in advance if you have an idea, DACO


Which settings/options are saved on a theme-basis and how does this affect theme-switching?

I realized that when switching the theme (in my case to a child theme) some things don't stay the same:   * Widgets   * Menus At least this is what I found out so far: ## Widgets Don't lose widgets when switching themes Avoid losing widgets when switching themes ## Menus Switching to child theme breaks menu names My question is if there is anything else that is stored on the basis of active themes and where I can find more information on this whole behaviour.


How to add a post class on every post. (on homepage)

I have this code in my home.php, the very first post class does not get the class while the others do. Same thing when i move this code to functions.php. I get php errors when i remove the hook around it and just add the filter.               add_action('pre_get_posts', 'theme_add_post_class');          function theme_add_post_class() {              /** Add custom post class */         add_filter( 'post_class', function( $classes ) {             $classes[] = 'span4';             return $classes;         } );          }          }


Change post thumbnail using front end post edit form

I'm trying to get the post thumbnail to change if a user selects a new file on a front end post edit screen. This is similar to the code I use to upload data and set the post thumbnail on a front end add new post form:               <?php     $query = new WP_Query( array( 'post_type' => 'properties', 'posts_per_page' => '-1' ) );          if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();       if( isset($_GET['post']) && $_GET['post'] == $post->ID) {                  $current_post = $post->ID;         $content = get_the_content();         $price = get_post_meta($post->ID, 'shru_price', true);         $address = get_post_meta($post->ID, 'shru_address', true);         $thumbid = get_post_thumbnail_id( $post->ID );         $thumbnail = wp_get_attachment_image_src( $thumbid, 'single-image' );       }     endwhile; endif;     wp_reset_query();          global $current_post;          $postContentError = '';          if (       isset( $_POST['submitted'] )       && isset( $_POST['post_nonce_field'] )       && wp_verify_nonce( $_POST['post_nonce_field'], 'post_nonce' )     ) {       if ( trim( $_POST['postContent'] ) === '' ) {         $postContentError = 'Please enter a description of this property.';         $hasError = true;       }       $post_information = array(         'ID' => $current_post,         'post_content' => $_POST['postContent'],         'post_type' => 'properties',         'post_status' => 'publish'       );       $post_id = wp_update_post( $post_information );            function upload_user_file( $file = array() ) {         global $post_id;                 require_once( ABSPATH . 'wp-admin/includes/admin.php' );         $file_return = wp_handle_upload( $file, array('test_form' => false ) );         if( isset($file_return['error']) || isset($file_return['upload_error_handler']) ) {           return false;         } else {           $filename = $file_return['file'];           $attachment = array(             'post_mime_type' => $file_return['type'],             'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),             'post_content' => '',             'post_status' => 'inherit',             'guid' => $file_return['url']           );           $attachment_id = wp_insert_attachment($attachment, $file_return['url'], $post_id );           require_once(ABSPATH . 'wp-admin/includes/image.php');           $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );           wp_update_attachment_metadata( $attachment_id, $attachment_data );           if( 0 < intval( $attachment_id ) ) {             return $attachment_id;           }         }         return false;       }            if( ! empty( $_FILES ) ) {         foreach( $_FILES as $file ) {           if( is_array( $file ) ) {             $attachment_id = upload_user_file( $file );           }         }       }            $propertyfor = $_POST['propertyfor'];       $propertytype = $_POST['propertytype'];       $bedrooms = $_POST['bedrooms'];            if( $post_id ) {              // Update Custom Meta         $price = esc_attr( strip_tags( $_POST['shru_price'] ) );         update_post_meta( $post_id, 'shru_price', $price);         $address = esc_attr( strip_tags( $_POST['shru_address'] ) );          update_post_meta( $post_id, 'shru_address', $address );         update_post_meta ($post_id, '_thumbnail_id', $attachment_id );              // Update taxonomies                 wp_set_object_terms( $post_id, $propertyfor, 'propertyfor' );         wp_set_object_terms( $post_id, $propertytype, 'propertytype' );         wp_set_object_terms( $post_id, $bedrooms, 'bedrooms' );              // Redirect         wp_redirect(home_url('/listings'));         exit;       }      }     ?>      The only difference is that in the code above I am trying to use:               update_post_meta( $post_id, '_thumbnail_id', $attachment_id );      instead of:               set_post_thumbnail( $post_id, $attachment_id );      For some reason, on the post edit screen the image file does not even upload. When I use update post meta, it removes the old thumbnail, so I guess it's doing it's job there, but since the file isn't uploading it cannot replace it with a new one. The confusion is why the file uploads using the `upload_user_file` function on the add new post screen but not the edit post screen. Any ideas?


Using wp_schedule_event to send emails including links

I'm trying to write a simple plugin using wp_schedule_event to send emails. The first example below works fine, but in the second (where I try to include a url within the email) nothing happens. Why? And how can I include a link within the email? EXAMPLE 1               add_action('init', function() {         if ( !wp_next_scheduled('my_email') ) {         wp_schedule_event(time(), 'hourly', 'my_email' );         }     });          add_action('my_email', function() {     $body = "A text message including a link.";         wp_mail('myaddress@gmail.com', 'Email Subject', $body );     });       * * * EXAMPLE 2               add_action('init', function() {         if ( !wp_next_scheduled('my_email') ) {         wp_schedule_event(time(), 'hourly', 'my_email' );         }     });          add_action('my_email', function() {     $my_url = site_url('/resources/links/', 'http');     $link ="link";     $body = "A text message including a $link.";         wp_mail('myaddress@gmail.com', 'Email Subject', $body );     });


Can I create accounts with different permissions and make private posts in WordPress?

I haven't worked with WordPress at all. I have a project on a website that is WordPress-based. I have some experience with PHP, JavaScript, HTML, and CSS. My project is as follows:   1. give the ability for _any_ user to create an account.   2. users who have accounts should write private posts (only the admin and the user and those who have permission can view those posts and reply).   3. the admin can write private posts to any user (with any permission)   4. when any user writes a post or comments on his post the admin shall be notified. Can this be done by WordPress easily? Or I should build a new website from scratch? How much time and effort would it take me to do all this? (I have never worked with WordPress before) Finally, any suggestions, hints, or guidelines that could help me do the task?


How to add featured thumbnail into import XML?

This is a sample item I am trying to insert into WordPress as post.               <item>         <title>XXXXXX</title>         <link>xxxx/xxxxx</link>         <pubDate>2012-05-23 19:31:00</pubDate>         <dc:creator><![CDATA[admin]]></dc:creator>         <guid isPermaLink="false">http://wordpress/?p=xxxx</guid>         <description></description>         <content:encoded><![CDATA[Sample]]></content:encoded>         <excerpt:encoded><![CDATA[]]></excerpt:encoded>         <wp:post_id>27505</wp:post_id>         <wp:post_date>2014-04-05 10:01:11</wp:post_date>         <wp:post_date_gmt>2014-04-05 10:01:11</wp:post_date_gmt>         <wp:comment_status>open</wp:comment_status>         <wp:ping_status>open</wp:ping_status>         <wp:post_name>xxxxxx</wp:post_name>         <wp:status>publish</wp:status>         <wp:post_parent>0</wp:post_parent>         <wp:menu_order>0</wp:menu_order>         <wp:post_type>post</wp:post_type>         <wp:post_password></wp:post_password>         <wp:is_sticky>0</wp:is_sticky>         <category domain="category" nicename="blog"><![CDATA[blog]]></category>     </item>      How to inlcude a featured image into this XML, is there a way to do that?


Custom shortcode being executed when saving page in wp-admin

I'm working on a custom shortcode: `[abuzz-store slug="woolworths" fields="description,level,phone" more="true"]` The shortcode is working correctly on the website frontend. However, I can no longer save edits to pages in wp-admin. Various PHP errors are thrown from trying to execute the shortcode outside of the proper template. Here is the shortcode functionality:               /**      * [indo_store_details_shortcode description]      *      * @param  [type] $atts [description]      * @return [type]       [description]      */     function indo_store_details_shortcode($atts)     {         $options = shortcode_atts(array(             // Abuzz Store slug             'slug'      => '',                  // Abuzz Store fields to display (title, description, level, phone)             'fields'    => '',                  // Display a link to further store details (store page)             'more'      => false,         ), $atts);              // sanity checks         if (!$options['slug']) return '';         // if (is_admin()) return '';              $output = '';              // retrieve store information         $store = get_posts(array(             'name' => $options['slug'],             'post_type' => 'store',         ))[0];              // determine fields to display         $fields = explode(',', $options['fields']);              $output .= '
';              // title field         if (in_array('title', $fields)) {             $output .= sprintf('
%s
', $post->post_title);         }              // "metadata" .options-list         if (in_array('level', $fields) ||             in_array('phone', $fields)) {                  $output .= '
';                  // level field             if (in_array('level', $fields)) {                 $levels = get_group('Level', $store->ID);                      $output .= sprintf('
 %s
', indo_combine_levels($levels));             }                  // phone field             if (in_array('phone', $fields)) {                 $output .= sprintf('
 %s
', get('phone_number', 1, 1, $store->ID));             }                  $output .= '
';              }              // description field         if (in_array('description', $fields)) {             $output .= get('information_text', 1, 1, $store->ID);         }              // "More details" link         if ($options['more']) {             $output .= sprintf('
More details
', get_permalink($store->ID));         }              $output .= "
\n";              return $output;     }     add_shortcode('abuzz-store', 'indo_store_details_shortcode');      Error: **Fatal error: Call to undefined function get_group() in D:\xampp\htdocs\126-indooroopilly-shopping-centre\www\public_html\wp- content\themes\indooroopilly\include\shortcodes.php on line 90** `get_group` is a function added by a 3rd party plugin (Magic Fields), which isn't loaded in wp-admin. Which is what I'd expect. Why is this being executed when the page is saved?


Post Thumbnails on Sidebar Widgets

How do I get my post thumbnails to show up on the recent post widget or a commenter's avatar to show up on the recent comments widget?


Using Postmash plugin in Wordpress 3.3.1

I want to be able to reorder posts and have them listed in this custom order from the category page. I've downloaded and activated the Postmash plugin but am having problems with installation. I've copied this text               <?php           $wp_query->set('orderby', 'menu_order');           $wp_query->set('order', 'ASC');           $wp_query->get_posts();       ?>       into index.php as instructed, but I don't understand where I need to use this line of code               <?php get_posts('orderby=menu_order&order=ASC'); ?>      to reorder my posts on the category page. Assistance would be much appreciated! TIA.


Sidebar random author spotlight

I'm trying to utilize the authors from wordpress to create a spotlight block in the sidebar that selects 1 random author from multiple users and only displays that 1 users information. I want to include the author's display name, a thumbnail, snippet of their bio and a link to the full author page. I haven't found any plugins that support this. I'm not a PHP/MySQL wiz so custom writing a function is a bit outside my abilities however I can read it and follow the code. What I have so far is:               <?php          global $wpdb;         $ids = $wpdb->get_results( "SELECT {$wpdb->usermeta}.user_id from {$wpdb->usermeta} where ({$wpdb->usermeta}.meta_key='wp_capabilities') and ({$wpdb->usermeta}.meta_value >0 )" );         $user_id = rand(1,count($ids));         $wpdb->show_errors();      ?>
<?php get_the_author_meta( 'display_name', $user_id ); ?>
     <img class="left" src="" alt="<?php print $selected_user; ?>" />
<?php get_the_author_meta( 'user_description', $user_id ); ?> <a href="<?php get_the_author_meta( 'user_url', $user_id ); ?>">read more      This returns an array but I am unsure of what to do to get the output I need. Thanks in advance.


How to make posts being uncategorized

I have some posts which do not have any category, by default, wordpress shows them under "Un categorized". Is there any way to stop this? I want those posts under the categories I have in **metabox title** (list of categories for meta tag, if I select some category, from metabox title, it should come under the selected categories from metabox title). But it saves the posts under "Un categorized"


Make videos output as iframes not links

is there any way to change the default output when inserting a video into tinyMCE with Wordpress' default media manager. Currently it inserts it as a link, would it be possible to input it into the editor as an iFrame with all attributes intact. Thanks in advance!


WP MU: Using pages from main site in other sites’ menus

Is it possible to use pages created on the main site in other sites’ menus? For example it would be excellent if all pages from the main page not only appear in the Custom menu section of the main page but also on all other sites’ menu pages.


meta query not showing any results?

I'm trying to show result for a custom field that is not empty on a custom post type but getting no results?                                   <?php                                  if (have_posts()) :                                 $args = array(                                     'post_type' => 'programmes',                                     'meta_query' => array(                                             'key' => 'linktovideocatchup',                                             'value' => '',                                             'compare' => 'NOT LIKE'),                                     //'caller_get_posts' => 1,                                                                   );                             ?>                                  <?php query_posts( $args ); ?>                                       <?php while (have_posts()) : the_post(); ?> `enter code here`


How to display a page?

I'm creating new pages under Pages > Add new. And creating my own page.php file from the ground up, what's the best way of displaying pages contents? I guess not get_template_part( 'loop'), since there will be no posts, just static pages?


how is it possible that using wp_insert_category throw a fatal error?

how is it possible that using wp_insert_category throw a fatal error ? I am using it as explained : http://codex.wordpress.org/Function_Reference/wp_insert_category with no change except:               $cat_defaults = array(         'cat_name' => 'some_name',         'category_description' => 'as asdfasdf sdf adfa fas f',         'category_nicename' => '',         'category_parent' => '',         'taxonomy' => 'category'      );     $someSome = wp_insert_category($cat_defaults);      i dont know if its relevant however i execute it on `add_action( 'init', array($this, 'registerCustoms') );` And i get the following error : `Fatal error: Call to undefined function wp_insert_category() in /home1/stodeckc/public_html/podio-wp-sync/wp- content/plugins/podio_management/libs/appSync/appSync_custom.php on line 61` Any ideas?


Difference between get_category, get_term_by and get_categories

`get_category` is returning **null** but using `get term_by` or `get_categories()` is not. Why? I have created term called categorycourses. I have a post related to coursecategory Lidköping (vardump1), **vardump1**               object(stdClass)[2525]       public 'term_id' => &int 5       public 'name' => &string 'Lidköping' (length=10)       public 'slug' => &string 'kurser_lidkoping' (length=16)       public 'term_group' => int 0       public 'term_taxonomy_id' => int 105       public 'taxonomy' => string 'category' (length=8)       public 'description' => &string '' (length=0)       public 'parent' => &int 0       public 'count' => &int 1       public 'filter' => string 'raw' (length=3)       public 'cat_ID' => &int 5       public 'category_count' => &int 1       public 'category_description' => &string '' (length=0)       public 'cat_name' => &string 'Lidköping' (length=10)       public 'category_nicename' => &string 'kurser_lidkoping' (length=16)       public 'category_parent' => &int 0      **vardump2**               null      **vardump3**               object(stdClass)[2525]       public 'term_id' => int 105       public 'name' => string 'Skara' (length=5)       public 'slug' => string 'kurser_skara' (length=12)       public 'term_group' => int 0       public 'term_taxonomy_id' => int 108       public 'taxonomy' => string 'categorycourses' (length=15)       public 'description' => string 'skara' (length=5)       public 'parent' => int 0       public 'count' => int 1       public 'filter' => string 'raw' (length=3)      I see that taxonomy returned by `get_category` is 'category', while taxonomy returned by `get_category` is 'categorycourses'. Here's the code I'm using:               //Vardump1     $location = get_category(skovdeLocationId); //another location id     var_dump($location);               //Vardump2     $location = get_category(skaraLocationId, 'categorycourses');     var_dump($location); //returns null (with or without taxonomy defined)          //Vardump3     $location = get_term_by( 'id', skovdeLocationId, 'categorycourses' );     var_dump($location);      But               get_categories(array(             'taxonomy'  =>'categorycourses',             'include'   => skaraLocationId             ));      is returning term correctly (as vardump1 but where location = skaraLocationId) **Why?** Shouldn't get_categories and get_category be the same? (or get_termby)


Trouble running local WordPress in Google App Engine

Following these instructions. Installed MySQL, Python and Google App Engine PHP SDK on a Windows 8 PC. Perfect! Created an app for WordPress, created database and user on localhost and edited WordPress config accordingly. Started the app in the Google App Engine Launcher. Clicking Browse leads to blank page at `http://localhost:8080/` Hmmm... Checked logs, found               2013-11-26 17:56:18 Running command: "['C:\\Python27\\python.exe',      'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py',      '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000',     'C:\\Users\\CsillamVilag\\Documents\\development-appengine\\arcfestesmintak']"      INFO     2013-11-26 17:56:19,805 devappserver2.py:660]      Skipping SDK update check.      WARNING  2013-11-26 17:56:19,813 api_server.py:331]      Could not initialize images API; you are likely missing the Python "PIL" module.      INFO     2013-11-26 17:56:19,822 api_server.py:138]      Starting API server at: http://localhost:53853      INFO     2013-11-26 17:56:19,826 dispatcher.py:171]      Starting module "default" running at: http://localhost:8080      INFO     2013-11-26 17:56:19,828 admin_server.py:117]      Starting admin server at: http://localhost:8000      INFO     2013-11-26 17:56:21,828 module.py:617] default: "GET / HTTP/1.1" 302 -      Pretty certain the Python for Windows package I used included PIL. Not sure where to go from here... If I go to `http://localhost:8080/wp-admin` though, I get               Warning: chdir(): Invalid argument (errno 22) in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 42          Warning: require(wordpress/wp-admin/wp-admin/install.php): failed to open stream: No such file or directory in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 103          Fatal error: require(): Failed opening required 'wordpress/wp-admin/wp-admin/install.php' (include_path='C:\Users\CsillamVilag\Documents\development-appengine\arcfestesmintak;C:\Program Files (x86)\Google\google_appengine\php\sdk') in C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\php\setup.php on line 103      In the error returned at `http://localhost:8080/wp-admin/` I see `/wp- admin/wp-admin/install.php` Obviously `install.php` cant be found. It is in `/wp-admin/` not in `/wp- admin/wp-admin/` Not sure how to fix that.


How do I use wp_get_recent_posts?

I'm trying to display the title and excerpt of the most recent 8 posts on the sidebar. I'm getting a list where:   * All items link to the oldest post   * All titles are "id number of a post that should be displayed"+"oldest post title"   * All excerpts are from the oldest post * * *               <?php             $args = array( 'numberposts' => '8' );             $recent_posts = wp_get_recent_posts( $args );             $noticias_highlight = true;                  foreach( $recent_posts as $recent ){      ?>                         <div class="entry <?php if ($noticias_highlight) echo 'highlight'; $noticias_highlight = !$noticias_highlight; ?>">

<a href="<?php the_permalink($recent["ID"]); ?>"><?php the_title($recent["ID"]); ?>

<?php the_excerpt($recent["ID"]); ?>

     <?php             }      ?>


All links to images are broken in a subdomain multi site environment

I've just installed a fresh copy of Wordpress 3.8.1, and then enabled the network feature using sub-domains. In cPanel, I have the wildcard sub-domain pointing to the Wordpress folder, and Wordpress admin is working fine in the sub-domain. When I am in a sub-domain's admin area, and I try to add an image to a page, the image displays as a broken placeholder. However, I can see it has been uploaded to /wp- content/uploads/sites/2/2014/03/*.jpg Here is my .htaccess:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]     RewriteRule ^.*/files/(.+) wp-includes/ms-files.php?file=$1 [L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) $1 [L]     RewriteRule ^(.*\.php)$ $1 [L]     RewriteRule . index.php [L]       Can you see what is wrong? Here are some example images that will not display in the browser, even though they are in the file system:   * http://nsw.findrhinoplasty.com.au/wp-content/uploads/sites/2/2014/03/find-best-rhinoplasty-surgeon-nsw.jpg Here are some that _do_ work:   * http://findrhinoplasty.com.au/wp-content/uploads/2014/04/logo-Aust.png


How to place plugin hook in a wordpress template

In many WordPress plugins, there are installation directions to add `<?php do_action('plugin_name_hook'); ?>` in your theme's templates. Where exactly do I need to place this code and what should be the `plugin_name_hook`?


Return vs Echo Shortcode

Ok, so I've created a short code which echo's some of the output; the problem I discovered is that the values must be returned instead of echo'd. I'm having problems converting the shortcode to return the date instead.. I've tried and it breaks my shortcode.. What would this shortcode code look like if it returned the code correctly instead of echo'ing it?               // [service slug="foobar"]     function services_shortcode( $atts ) {              // Attributes         extract( shortcode_atts(             array(                 'slug' => '',             ), $atts )         );          if ( isset( $slug ) ) {         $args = array( 'post_type' => 'cbd_services', 'name' => $slug ); // -1 Shows ALL Posts         $loop = new WP_Query( $args );         while ( $loop->have_posts() ) : $loop->the_post();         $custom = get_post_custom($post->ID);         $galleryPhotos = unserialize($custom["gallery_photos"][0]);      ?>

<?php the_title(); ?>+

                 <?php the_content(); ?>                 <?php if(!empty($galleryPhotos)){                     foreach($galleryPhotos as $photo){ ?>
                             <a class="fresco" data-fresco-group="<?php echo $slug; ?>" href="<?php echo $photo['gallery_imagesrc']; ?>">
#makeitbigger
<img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo urlencode($photo['gallery_imagesrc']); ?>&w=452&h=275&zc=1" />                                 <?php echo $photo['gallery_title']; ?>
                 <?php   }                 } ?>

     <?php  endwhile; wp_reset_query();          }}     add_shortcode( 'service', 'services_shortcode' );


Upgraded to 3.8.1 on wp-admin but unable to upgrade in godaddy cpanel

Godaddy is unable to help me with this one as it is a wp related issue. Basically, I've been upgrading WP through the wp-amdin panel. And in the meantime, the WP Application on godaddy has stayed at 3.7. And now I am for some reason unable to upgrade it in godaddy. I can revert it to 3.6.1 and then it gives a message to upgrade to 3.8.1 and when I attempt to do that, it doesn't upgrade all the way, just up to 3.7 and then it stalls.   * Any thoughts what might be going on here?   * Does this mean that WP is actually not upgraded, even though on the wp-admin side it's upgraded.   * I have tried removing all the plugins and doing the same process and it still it didn't work.   * The theme is twenty-twelve, the child files were edited a lot before I joined the project, could it be that these might be causing the problem. The website is overall super slow and some plugins are very slow and slowing the site down. So I'd like to make sure it's not because WP is not up to date. I hope I provided enough info, let me know if you'd like any more specifics and thanks for any feedback


Adding option to existing menu, like infinite SEO does

i have tried to google docs, but i cannot seem to find what i need to hook in to, to: a) Display another option on the comments page b) Make sure it gets in to POST, when "Save Changes" is fired c) Hook in to Comment options/settings updated and do something there Here is an example of what i want to do: ![enter image description here](http://i.stack.imgur.com/g9gTy.png) I want to do this, with comments, instead of posts **I solved a)** with the help of http://stv.whtly.com/2011/07/27/adding- custom-columns-to-the-wordpress-comments-admin-page/


Custom Archive with Content for Custom Post Type

I'm doing a corporate site migration into Wordpress, and need an extremely custom archive page for a custom post type. I know all about the `archive-{post type}.php` thing, but it needs to be more custom than that. The page should have a little intro content (subtitle, 1-2 paragraphs) above a listing of the `events` post-type. In keeping in spirit with using a CMS, it's my goal to not hard code the content so it can easily be changed, and also to make it fairly simple for the end users. My best idea right now is a page template with a query hard coded in to display the other posts, something like:               <?php     /*      Template Name: Events Page      */          while (have_posts()) : the post ();         the_title();         the_field('subtitle');  // Advanced Custom Fields function              the_content();              $events_list = new WP_Query(array(             'post_type' => 'events',             'meta_key' => 'start_date',             'meta_value' => date('Y-m-d'),             'meta_compare' => '>=',         ));         while ($events_list->have_posts()) : $events_list->the_post();             /*              Custom post content here              */         endwhile;         wp_reset_postdata();          endwhile;      While this would fulfill my basic need, the real goal is to have a _paginated_ archive, and it doesn't seem that I can get that functionality doing this. Does anyone have any ideas for how to get a paginated archive with the ability to add content above the listings?


How to provide support for [gallery] shortcode?

I'm developing a new custom theme - and noticed that if a post contains the shortcode [gallery] it gets ignored ( _edit_ : I mean that the HTML delivered to the browser does not include [gallery], nor anything in its place... I think there's a blank line or two) My Theme is   1. grabbing post contents via `the_content('→')`;   2. also removing the standard `<p></p>` wrapper via `remove_filter('the_content', 'wpautop');` The Codex does not list this as one of the features you explicitly have to add support for - but we know the codex can be outdated/incomplete at times. Anyways, what is it needed for a theme to recognize [gallery] (and/or other such standard shortcodes) ?


Confused about Custom Post Types

Am a little new to custom post types, and maybe it's not the right solution to what I am trying to accomplish. What I am trying to accomplish:   1. User "Add New Property". This will have option to add image and 15 custom info fields.    2. All the properties that are added are displayed on a certain page.  I've tried using Advanced Custom Fields, and it works great for ONE page, but is not repeatable. I've used custom post types to add Property to admin area on the left but am not sure how to add it to one page. Here is what I have so far:               function create_post_type() {           register_post_type( 'my_properties',               array(                   'labels' => array(                       'name' => __( 'Commercial Properties' ),                       'singular_name' => __( 'My Property' )                   ),               'public' => true,               'menu_position' => 5,               'rewrite' => array('slug' => 'properties')               )           );       }            add_action( 'init', 'create_post_type' );           function property_taxonomy() {          register_taxonomy(           'properties',           'my_properties',           array(               'hierarchical' => true,               'label' => 'Category',               'query_var' => true,               'rewrite' => array('slug' => 'MyProperties')           )       );       }            add_action( 'init', 'property_taxonomy' );       I have the custom fields showing up on the custom post types, but am not sure how to display them all on one page?


A spam bot loves me, what can I do?

I'm receiving many many spam comments using the same username and I guess it is a bot that keeps on submitting comments. In one week I get around 100 such comments (which is quite a lot for my small blog). I want to have a look at all comments that are marked as spam (just in case Akismet is too strict on a certain legit comment), but this is really annoying. Therefore I have two small questions:   * How can I tell WP to trash all comments that come from a certain username?   * What do you generally do in situations like this?


Ajax, Permalinks and post_thumbnail

As i'm new to AJAX, i'm still learning a lot and have learned a lot over the past weeks. I do need some more assistance on an AJAX issue though: I'm using the following code to display post_thumbnails in a slider which when clicked go to the specific portfolio piece:
          <?php query_posts('cat=16&post_type=portfolio'); ?>             <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                 <li class="<?php foreach((get_the_category()) as $category ) { echo $category->slug . ' '; } ?>all">                         <?php if ( has_post_thumbnail() ) { ?>                     <a id="caseStudy" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?>                     <?php } else { ?>                     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/post-thumb.jpg" width="141" height="73" alt="<?php the_title_attribute(); ?>" />                         <?php } ?>
             <?php endwhile; endif ?>             <?php wp_reset_query(); ?>
      What i'm looking to do is to have the portfolio piece content load on the same page. I'm using this code:               var ajax_load = "<img style='margin-top: 150px;' src='<?php bloginfo("template_url"); ?>/images/loader.gif' alt='Loading...' />";                           var loadUrl = "http://localhost:8888/cnNew/?page_id=4";                          $("#ourTeam").live('click', function(){                             $("#teamLoad")                                 .html(ajax_load)                                 .load(loadUrl + " #innerTeam")                         });      to load other items onto the page but can't seem to get this way of calling it to work with the dynamically listed content. Can someone provide some assistance on the best way to achieve what i'm looking to do or at least a direction? Thanks!


Include taxonomy slug in url?

I have the following custom post-type and custom taxonomy setup:               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'system',             array(                 'labels' => array(                     'name' => __( 'Systems' ),                     'singular_name' => __( 'System' )                 ),             'capability_type' => 'post',             'supports' => array('title','editor','comments'),                'public' => true,             'has_archive' => true,             'rewrite' => array( 'slug' => 'system' ),             )         );     }          function news_init() {         register_taxonomy(             'system',             'system',             array(                 'label' => __( 'Product Category' ),                 'sort' => true,                 'hierarchical' => true,                 'args' => array( 'orderby' => 'term_order' ),                 'rewrite' => array( 'slug' => 'product-category' )             )         );       }     add_action( 'init', 'news_init' );      Is it possible to include the custom taxonomy name in the URL? At present when I goto a custom post the URL looks like this: > http://www.domain/product-category/(post-name)/ How can I make it look like the following? > http://www.domain/(category-slug)/(post-name)/


What is the constant WP_USE_THEMES for?

Regarding the `WP_USE_THEMES` constant, the Codex states: > If you are using The Loop inside your own design (and your own design is not > a template), set WP_USE_THEMES to false. But what is the actual effect on WordPress from `WP_USE_THEMES` being set to true or false? I would like to know how it's used by WP.


Restrict category choice in dropdown menu?

**Hmmm... maybe trickier than I hoped? If this is simply impossible then please do let me know :-)** Question Refinement:How can I adapt the include section of this code to use category names instead of id's? Thanks               $dropdown = wp_dropdown_categories( array(     'include' => '58, 3',         'name' => 'category_id[]',         'hide_empty' => false,         'echo' => false,     ) );      * * * I recently started using this code to force users of a multisite to select a category from a dropdown menu before creating a new post. Can anyone help me restrict the category options to just a few specific categories eg. news / products? Even just not displaying sub-categories would be helpful. Thanks UPDATE: I found adding this line I was able to restrict the choice to just 2 categories:                'include' => '58, 3',      But how can I make this work with cat names / text instead of id numbers as it's for a multisite & I don't have control over cat id's when new sites are created???? CODE:               add_filter( 'load-post-new.php', 'wpse14403_load_post_new' );     function wpse14403_load_post_new()     {     $post_type = 'post';     if ( isset( $_REQUEST['post_type'] ) ) {         $post_type = $_REQUEST['post_type'];     }          // Only do this for posts     if ( 'post' != $post_type ) {         return;     }          if ( array_key_exists( 'category_id', $_REQUEST ) ) {         add_action( 'wp_insert_post', 'wpse14403_wp_insert_post' );         return;     }          // Show intermediate screen     extract( $GLOBALS );     $post_type_object = get_post_type_object( $post_type );     $title = $post_type_object->labels->add_new_item;          include( ABSPATH . 'wp-admin/admin-header.php' );          $dropdown = wp_dropdown_categories( array(         'name' => 'category_id[]',         'hide_empty' => false,         'echo' => false,     ) );          $category_label = __( 'Category:' );     $continue_label = __( 'Continue' );     echo <<<HTML

{$title}
          <form method="get">

                     {$category_label}	                     {$dropdown}

                     	                     <input name="continue" type="submit" class="button-primary" value="{$continue_label}" />

         <input type="hidden" name="post_type" value="{$post_type}" />     </form>
     HTML;     include( ABSPATH . 'wp-admin/admin-footer.php' );     exit();     }          // This function will only be called when creating an empty post,     // via `get_default_post_to_edit()`, called in post-new.php     function wpse14403_wp_insert_post( $post_id )     {     wp_set_post_categories( $post_id, $_REQUEST['category_id'] );     }


Pull posts from another wordpress install on same server

I've searched already and couldn't find anything tailored to my specific problem, apologies if it has already been asked though. I have a public Wordpress install and a members only one on a subdomain. The reason for this is that they are both very different sites in terms of functionality so creating members only posts in the main site is not an option. On the subdomain new premium content will be added, but I also need to pull in the posts from the public site. I've looked into feed urls but because I've implemented quite a specific search customisation on the subdomain I need these posts to be searchable. For example I have an additional posts plugin 'post countries' showing a country associated with the post. Is this still something the feed url would be able to handle, or are there any other alternatives? Thanks **EDIT** This is the way my current private search is setup, I've just pasted in the relevant code.               $args = array(     'post_type' => 'post',      'show_posts' => '10',      'paged' => $paged     );          $the_query = new WP_Query($args);           <?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); ?>         // The output      In my own sites private db results are stored in `$the_query` and public site results are stored in `$allsearch`, which would mean I should add the following and make my loop vanilla.               $the_query->posts=array_merge($the_query->posts,$allsearch);     $the_query->post_count=count($the_query->posts);      Does that sound right, it's not pulling in any posts from public site?