How can integrate zend module with wordpress admin dashbord

I want to add zend application into wordpress admin dashbord with a menu link.I have copy all the application folder files from zend application and create a plugin in wordpress,its working when we will access index page,but when we will access other link like add/edit of index page of zend plugin,its not working.


Using database in new instalation

I have a Wordpress instance in my production environment. I have created a new raw instalation in my development machine, and I have imported the database from production. I have changed the wp_options table to make sure that the site_url and home are actually pointing to the named url I have in my local machine. However, when I access the site, it doesn't show up anything. What am I missing or need to do?


Taxonomy.php how to show post only in current taxonomy with wp_query?

Having troubles to get my taxonomy.php working good. I use a taxonomy.php to list all my posts in a specific category but it shows every post I have in all categories. Here is my code:
          <?php          $args1 = array(       'post_type'=>'artistes',       'orderby' => 'menu_order',       'order' => 'ASC',       'meta_query' => array(             array(                 'key' => 'date_de_lartiste',                 'value' => '',                 'compare' => 'LIKE'             ),             array(                 'key' => 'heure_de_lartiste',                 'value' => '',                 'compare' => 'LIKE'             )         )     );          add_filter('posts_orderby','orderbyreplace');     $loop = new WP_Query( $args1 );     remove_filter('posts_orderby','orderbyreplace');     ?>     <?php $todaysDate = date('Y/m/d'); ?>     <?php if ($loop->have_posts() ) { while ( $loop->have_posts() ) { $loop->the_post(); ?>     <?php          $date = get_field('date_de_lartiste');          $newDate = date("d/m/Y", strtotime($date));     ?>

             <?php the_post_thumbnail( 'artists_list' )?>
<?php the_title(); ?>

<?php echo $newDate ?> - <?php the_field('heure_de_lartiste'); ?>

         <a href="<?php the_permalink(); ?>" class="read_more"><?php _e('Read More'); ?>
     <?php         }             } else {                 ?>

No posts

                 <?php         }             /* Restore original Post Data */             wp_reset_postdata();     ?>
      Does anyone may help me to figure it out? How to display only the post in the current taxonomy? Thanks a lot, Jhon **EDIT:** Well I know it's now the best way to do that, but I just fixed it with this code:               $category = get_query_var( 'term' );      And in my $args I added:               'tax_query' => array(              array(                  'taxonomy' => 'scenes',                  'field' => 'slug',                  'terms' => "$category"                  )              ),


What is right way to go about adding functionality to a published WordPress plugin?

So I looked all over to try and find some kind of rules, or at least some common-courtesy guidelines, concerning this issue and couldn't find anything. Essentially I'm wondering what I should do when I find a WordPress plugin (free, listed within wordpress.org/plugins/, and includes the GNU GP License) that I think could seriously benefit by adding a given amount of functionality to it. After altering the code and including the new functionality, do I: 1) Submit it to the current author of the plugin and hope that he/she adds it in? 2) Submit the "new" plugin to the WordPress plugin listings as one of my own? 3) Avoid either of these options. Just change the plugin and only use it for myself. 4) Do something else that isn't listed here? (Implies that suggestions be made in the comments section.) From a licensing perspective, I can't see any prohibitions against making any of these choices. I don't know how moral it'd be to take the code, alter it, and then sell it as a premium plugin, but that doesn't seem to be prohibited by the GP License either. What's the best practice for this situation? Obviously I don't want to offend the original author of the plugin or do something that'd make me look bad in the WordPress coding community. Still, in this case that I'm up against, I think the plugin would seriously benefit from this added functionality. What say ye?


how to upload and allow downloads of .mobi and .epub formats

I have downloadable products for sale. I have created custom meta boxes to hold the file data I need, it allows me to upload fine to the custom meta the .doc and the .pdf files... However when I try and upload a .mobi and a .epub - it doesn't upload the files... I suspect I will also hit issues when I try and follow the download link to download the files also - but I will cross that bridge when I come to it. Any help on this would be fantastic.


Wp theme Jquery conflict with plugins that use jquery

I have a jquery conflict with one of the websites I administrate. reffering to this link:( http://www.terraworldltd.com/pc/business/2056.html ), the product page consist of fancy zoom that when the picture is clicked on, the picture zooms out. The calling for the jquery is done on the single.php for the product. This is the code:               <?php get_header(); ?>                                        <link href="<?php bloginfo('template_directory'); ?>/library/css/thickbox.css" rel="stylesheet" type="text/css" />                          I recently installed couple of plugins that use jquery, but it does not work on the product page. When I remove:                     from the code above, the plugins start to wok but the fancyzoom stops working. I have tried every solution I found on google, but none of them worked. Including the no conflict and changing '$' to 'j' in the jquery. I really appreciate if if someone can help me.


What's the recommended process for organising collaborative posting?

The users over at the scifi/fantasy SE site are getting our blog organised. We definitely need:   * To know who is writing (or planning to write) about what.   * What stage (planning, writing, needs-editing, needs-scheduling, scheduled, posted) each post is in.   * Who is currently working on the post (writing, editing). We started out with a Google Docs spreadsheet, but although this was very free-form, it (a) didn't get well used, (b) doesn't have any integration with WordPress, and (c) doesn't have any notification system. We recently switched to Trello (our board is here). There are a lot of features we like here:   * Transparency. Anyone (even people that aren't writing for the blog) can see what posts there are, and where everything fits in the schedule. This is particularly important.   * It's quite flexible (a lot of different metadata can be attached to a post).   * It's easy to use and looks nice (which helps encourage people to use it).   * There's no real-name requirement. If parts of the system are totally public (which we prefer) then this is a requirement. If the system is only visible to writers/editors then we can live with real names, although we'd prefer not to.   * Email addresses aren't exposed. Email addresses _are_ exposed in WordPress (unfortunately), so this also isn't an issue for writers/editors, but we can't have email addresses exposed to the general public. However, there are things that aren't so great:   * It's yet-another-account. There's a StackExchange account, a WordPress account, and a Trello account to manage. (This impacts on the real-name/email address issues from above, because an existing account may not be able to be used, and an email address is required to add an account).   * There are notifications, but there's no documentation for them, so it's not obvious how to use them or exactly what you get notified about.   * There's no way to integrate with WordPress. This means that whenever a post changes status, it has to be updated in WordPress _and_ Trello. This is made worse because as far as I can tell, WordPress doesn't notify anyone when a post moves to "Pending" (so if the change is made only in WordPress, no-one notices). We're all new to collaborative blogging, but we know that other people have been doing this for ages. What's the standard / best way of doing this sort of organisation? If there's a WordPress plug-in that we can use to do everything inside of WordPress itself, we can probably get the StackExchange staff to install that. Alternatively, is there a third-party site that offers much/all of what Trello does, but integrates better with WordPress?


Post Title displaying but not in the wrapped HTML I need

I have a custom query to get the post title, permalink, and featured image. However the Post title is displaying but not in the container I want it in. here is the query
                         <?php                              $portquery = new WP_Query();                             $portquery->query(array('cat' => 3, 'posts_per_page' => 2));                             while ($portquery->have_posts()) : $portquery->the_post();                                  echo "
";                             ?>                                 <?php                                       echo ''.the_title().'';                                 ?>                                 <?php if (has_post_thumbnail( $post->ID ) ): ?>                                     <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>                                     <?php                                          echo "
";                                      ?>                                 <?php endif;                                       echo "
";                                 ?>                              <?php endwhile; ?>
                             More Blog Updates

      and here is the output I get

                                     Another Portfolio Post

                                 Portfolio Post


Images not working using Featured post

I have recently moved a wordpress website `abc.com` to `xyz.com`, And `xyz.com` functionality is good and working well. And i have created a `post` with a image in it using `Featured Image`, and when i `publish` this post, its not displaying images in it. And when i check the `URL` of image using `Inspect Element`, i see the location as `http://www.abc.com/wp-content/uploads/2012/11/ACFA7.jpg` instead of `http://www.xyz.com/wp-content/uploads/2012/11/ACFA7.jpg` . And when i changed this to correct url.. then images are working good using inspect element. And i have changed the `permalinks` and `wp-options` in database for `siteurl` to `xyz.com` , is there any thing more i need to configure or update into site or database anywhere.


Call javascript functions from each page

Is there a plugin that supports calling custom functions that you've created? Like, page A -- I want to call function x               $(document).ready(function(){         call_function_x()     });      page B -- I want to call function y               $(document).ready(function(){         call_function_y()     });      I don't want to write the calls in the main input because of others editing and might delete them by misstake... This is my current solution but not optimal in my eyes :)               footer.php:              <?php             /* Always have wp_footer() just before the closing </body>              * tag of your theme, or you will break many plugins, which              * generally use this hook to reference JavaScript files.              */                  wp_footer();             $js =  get_post_meta($post->ID, 'javascript', true);                 if ( $js != "" ) {         ?>               <script type="text/javascript">         $(document).ready(function(){         <?php echo $js; ?>     });     <?php } ?>      then I added custom field "javascript" on the pages with their custom functions like this.               function_x(some_variable); function_y(some_var); function_foo(bar);


WP-Ecommerce Track and Trace

Ecommerce with Wordpress for an online store. There appears to be a track and trace feature where in the store logs you can add a tracking ID then send an email to the customer. When they recieve the email it says 'just login to our website and enter the following Tracking ID to view the status of your order.' When you login there is nowhere to put the code. I am missing something? Cheers Paul


Setting up menus before making a template live

I'm currently creating a new template for a client. Their current template does not implement menus at all. They are all hard coded links in the template. The new template I making them will implement the menu functionality. Their menus are fairly extensive (around 50 links). Since the menu option does not currently show up on the existing theme, how can I go about adding all the menus before I make the new template live for all visitors? I really want to minimize downtime. I know I could just take the site offline, but that's not really an option for me.


How to querry for an item that saved in an array?

I know how to write querry args for WP_Query if it's a single key : for example, if query posts with the metakey of 'type'--               $query_args['type'] = (array)$type;      Now, the problem is-- the item I want to querry is saved inside an array, this array is saved as a postmeta. This is my array:               $details = array(     'user_id' => 0,     'type'   => '',     'amount' => 0,     );      I saved this array in wordpress postmeta:               update_post_meta($post_id, 'details', $details );      Now I want to query for posts that have the same metakey of 'type'. How?


WordPress opens js files as a catalog. Path is right

When I import external js file everything is okay.. no matter if I import it by `<script>` tag or by wp_register_script function but when i try to import local file everything crashes. Firstly I had doubts about path I entered so I've opened Web Inspector in Opera and compare path I've entered with real path. The same. Unfortunately WordPress doesn't load script and what is really weird when I try to open given path in Web Inspector... It opens main site with given file address.. for example... first-base address:               localhost/wordpress      adress of js file:               localhost/wordpress/htdocs/wp-includes/js/my-file.js      result of entering above link:               localhost/wordpress/htdocs/wp-includes/js/my-file.js/        and main site... If I attach custom code trough plugin all code is visible on the top of the site as a plain text. Any ideas? I've read many of articles on attaching javascript files and finally .. I gave up.


Auto Add Image Title,Caption,Alt Text,Description while uploading Images in WordPress

Can anyone tell me how to auto fill/add same image title in title, caption, alt text and description while uploading any image in my WordPress Posts. ![desired screenshot](http://i.stack.imgur.com/fdkIb.jpg)


Backup wordpress installation on shared hosting

I have a wordpress website on a shared hosting. For redundancy reasons, I want to have a copy of the site on another shared hosting, so that if the first one is down, the traffic can be redirected to the other one. Asking this question in wordpress section because most of the challenges are wordpress specific than server specific. Those are:   * Wordpress works only on one domain name, so how can I access the 2nd installation when DNS is pointing to the first one? I don't want to load balance but more of a fallover.   * What's the best way to sync files and DB across shared hosting? Any wordpress plugins that can do this seamlessly every time a new post is published?


How to turn custom-post archive into an overview page, listing the metadata of the posts?

The background: I am new new new to Wordpress, to CMS's in general. I have been trying for 2 days to get this to work but I am not succeeding. I about 20 different custom post types. Each post type will have between 5 and 50 posts in it, the posts listing products my company is selling. We are not using an e-shop or anything for various reasons. I used MoreFields to define metadata on each product, and now I would like to format my archive page to automatically list the products on the archive page when I post one. I would like it to display a thumbnail of the product, the name, price, etc in a list view. How do I do this? Am I going about it all wrong and backwards? Explain it to me like I'm five, please. Thank you very much for any help you can give.


get_the_content("more...") returns full text

I'm creating shortcode [latest_post] and want to show post date, title and short content. (content has "more" separator). Here is code:               function shortcode_latest_post() {         global $post, $more;         $tmp_post = $post;         $tmp_more = $more;              $posts = get_posts(array('numberposts' => 1, 'post_status' => 'publish'));              $output = "";         foreach($posts as $post) {             setup_postdata($post);             $more = 0;             $output .= '
';             $output .= ''. get_the_date() . '';             $output .= '
'. get_the_title() .'
';             $output .= get_the_content("Read more...");             $output .= "
";         }         $post = $tmp_post;         $more = $tmp_more;         return $output;     }     add_shortcode("latest_post", "shortcode_latest_post");      But I have problem with "get_the_content" function. It returns full content text instead of short text and more link. Can anybody help me, please? **Update:** I'm found solution. Code above is updated. - http://codex.wordpress.org/Customizing_the_Read_More#How_to_use_Read_More_in_Pages


Is it possible to allow BP Group Admins to Set which Menu Tab they would like to have as their Default landing page?

Is it possible to allow BP Group Admins to Set which Menu Tab they would like to have as their Default landing page when people enter their Group like Activity Stream or Documents etc?


What does exactly GPL license mean for my WordPress theme?

To put it like this: I have created a WordPress theme for myself which consists of the following:   * PHP code - GPL v2 licensed like WordPress   * CSS files - All rights reserved   * JS files - All rights reserved   * image files required for the theme - All rights reserved As far as I understand I can copyright all non PHP files in the theme, so my question is:   1. Does this licensing scheme (for file groups) violates the WordPress license?   2. Do I have to publish the PHP code of the theme so it is available to everyone?   3. If I were to make a WordPress powered website with my theme (with the same licenses as above) for someone else (who pays for the service), do I have to publish the PHP code of the theme so it is available to everyone, just the buyer, or anything else?


"Revision" records in wp_posts have original post type instead of "revision"

After seeing some weird hits in my Relevanssi search results I found the following: http://wordpress.org/support/topic/searching-with-relevanssi-shows-all- revisions I ran the following on my WordPress database:               SELECT * FROM  `wp_posts`        WHERE (`post_name` LIKE "%revision%" OR `post_name` LIKE "%autosave%")       AND `post_status` = "inherit"       AND `post_parent` !=0       AND `post_type` !=  "revision"      It returned almost 2,000 rows. This means that many of the "revision" records in my wp_posts table are ending up with the wrong post type. http://codex.wordpress.org/Revision_Management currently states the following: > Revisions are stored as children of their associated post (the same thing we > do for attachments). They are given a post_status of 'inherit', a post_type > of 'revision', and a post_name of {parent ID}- revision(-#) for regular > revisions and {parent ID}-autosave for autosaves. In my case these revision records are maintaining the original post type such as "page" or "my-custom-post-type" instead of being changed to "revision." Any ideas why these records have the wrong post type? I read it may have to do with my custom post type definitions, but if so, why is it happening with "page" records as well?


How to change url's in Wordpress when changing domain

Is there any plugin that can update the wordpress database, specifically the wp_posts table or any other custom table in the database created by other plugins which has absolute url's of images and other assets? So for example I have an image in a post:               <img src="http://old-domain.com/wp-content/uploads/images/img.png" />      How do I update it when moving to new-domain.com? And also I have created a plugin that does save absolute URL's on a custom table. Should I also provide the functionality to update those URL's? I'm currently using the `content_url()` method which returns an absolute URL for the assets that the plugin is saving. Is there any way of modifying this so it uses relative paths so there will be no need for a migrate functionality if ever? Thanks in advance!


WordPress dummy data for theme design

I know there are a lot of options (exported files, plugins) but I am looking for a specific one that I used to use but now I have misplaced a local copy of it and can't seem to find it on Google. It was related to Gorilla themes, I guess. It has meaningful content and not just `lorem ipsum`. If anybody can point me to it, then that would be great. Thanks in advance.


How to work with Syntax Highlighter Evolved?

I have installed Syntax Highlighter Evolved to simplify code snippets writting and highlighting. I know that it is quite popular and used by many bloggers so I must be doing something wrong because it drives me mad. I'm writting my first blog post and I want to include several C# and XML code snippets. I can include one snippet format it as I need but when I continue with second snippet (switching between HTML and Wysiwyg editor and saving draft several times) it sometimes lost formatting of my former snippet (in case of XML it deletes whole snippet). What I'm doing wrong? I'm using version 3.1.1 of syntax highlighter and WordPress 3.1. I'm writting my post directly in WordPress admin interface.


IOS home screen icons: where put and what size?

I've read several articles about customizing the home screen icon used by IOS (and some Android) phones/tablets for the "add to homescreen" option. I'm seeing different recommendations re: sizes of the pngs, number of pngs, and am not clear where I should upload it/them. Here's a sample of articles; some WP specific, some not: http://www.bryanhauer.com/2012/06/25/how-to-easily-create-iphone-ipad-home- screen-retina-icons-for-your-website/ http://webdesign.tutsplus.com/tutorials/site-elements/quick-tip-custom-ios- home-screen-icons-for-your-website/ http://wpdaily.co/icon-ios-homescreen/ I like the idea of using one "large" icon and having the devices scale it, but does that work? If so, does it really need to be 512 x 512? That seems pretty big and large pngs are large files. And where do I place the pngs? In the theme root? In the media library? In the images folder in the theme root? Do I need to add anything to the code like <* _img src="/_ *images/apple- touch-icon.png"> Has anyone done this for a Wordpress theme? Thanks!


How to save a multiple checkbox array into a non-hierarchical taxonomy

I'm using apptheme jobroller theme and trying to manipulate its Edit Resume page. I want to show a specific taxonomy ( **resume_specialities** ) as a set of multiple checkboxes and enable users to check multiple selections. I just don't know how to save these multiple selections. There are 3 pieces of related code in three different php files. The codes below are the relative parts of them: **File 1** (tpl-edit-resume.php):               <?php     if ($resume_id>0) :              // Get job details         $resume_details = get_post($resume_id);              if (!isset($_POST['save_resume'])) :             // Set post data             $terms = wp_get_post_terms($resume_id, 'resume_specialities');             $terms_array = array();             foreach ($terms as $t) $terms_array[] = $t->name;             $posted['specialities'] = implode(',', $terms_array);          endif;     ?>      **File 2** (submit-resume-form.php):               <?php     $specs_array = explode(',', $posted['specialities']);
<?php _e('Specialties', APP_TD); ?>
     <?php $all_specialities = get_terms( 'resume_specialities', array( 'hide_empty' => false ) ); ?>          <?php foreach ($all_specialities as $single_speciality) : ?>                  <input type="checkbox" name="specialities[]"             id="speciality-<?php echo $single_speciality->term_id; ?>"               value="<?php echo $single_speciality->name; ?>"         <?php if ( in_array( $single_speciality->name, $specs_array ) ) echo ' checked="checked"'; ?> />         <?php echo $single_speciality->name; ?>
     <?php endforeach; ?>      **File 3** (submit-resume-process.php):               if (isset($posted['specialities'])) :         $thetags = explode(',', $posted['specialities']);         $thetags = array_map('trim', $thetags);              if (sizeof($thetags)>0) wp_set_object_terms($resume_id, $thetags, 'resume_specialities');                endif;      What am I doing wrong? It doesn't save the selections! Thanks in advance.


What's the best way to split admin-only functionality in the theme's functions.php file?

I am customising a Wordpress admin area and so far so good with a number of add_filter and add_action calls in my theme's functions.php file. But I'm a bit worried because all this code will be executed on all pages, not just the admin area. I therefore went ahead with the below approach:               if (is_admin())         require_once('admin-functions.php');      It works but is this the cleanest way of doing it?


How can a guest view the "Pending Review" Post?

1. When a user creates a new post it will have "pending" status. So I want the **visitor (guest - not logged user)** to be able to view "Pending" posts and vote it to "Publish" if enough "X Votes". Google bot can also crawl "Pending" Posts.   2. I want to use permalink for "Pending" Post. How can I do this? Please help me! Thanks all friends!


meta_query compare not working

I'm trying to run this WP_Query on tag.php, and it doesn't seem to work.                           $tag = get_query_var('tag');                  $args = array (                 'tag'                    => $tag,                 'meta_query'             => array(                     array(                         'key'       => 'post_tagorder_broj_sastojaka',                         'value'     => '5',                         'compare'   => '<=',                         'type'      => 'NUMERIC',                     ),                 ),             );                  $sastojci_query = new WP_Query( $args );      I created custom meta_key (NUMBER) and I store number of tags in it. I'm trying to return posts with selected tags (mysite/?tag=tag1,tag2,tag3) with <= 5 (number of tags). I also tried:                   'value'     => array(2,7),         'compare'   => 'BETWEEN'      But also no luck. Any suggestions? I'm reading Otto's blog on advanced queries but I'm stuck.


Run two wordpress on the same domain

**Edit** I have a productive wordpress site (example.com) and a test wordpress site (test.example.com).   For the two sites, I've a productive and a test DB. Everytime when I'll access the settings for the test site (test.example.com/wp-admin), I'll be redirected to the productive site (the URL looks then like this: `http://example.com/wp- login.php?redirect_to=http%3A%2F%2Ftest.example.com%2Fwp-admin%2F&reauth=1`). I already changed the DB of the test site in the `wp-config.php` file, but nothing changed. How can I change the test site to the test DB and making it independent from the productive one?


Execution of JavaScript on save post

I got stuck with one problem, can somebody please help.. :)      I would like to execute custom JavaScript function before post is saved, and i can't find how to do that.   Something like JavaScript version of save_post action hook :)      Thank you!


Non latin post slug truncate

I created a custom post type and set its permalink structure to 'category/postname'. I found that sometimes, when i create a post in a non latin characters, the post slug is getting cut. I googled and found that the post guid field and post_name field are limited to 255 and 200 characters. and also noticed that the value in these fields (for the non latin slugs) is encoded (like %85%e0%e0%b2%b2%b5%e0%b2%b0%e0%b2) which takes a lot more space. my database is utf8 encoded and collate is utf8_general_ci. i tried other collations but with no success. is there any way to fix that so my slug will remain complete no matter what permalink structure is or title length? Thanks.


using comments_template() in custom single-portfolio.php

I am wanting my users to be able to post comments on my portfolio page. Ive created a portfolio page using custom posts. On my blog i am using the comments_template(); and then on the comments.php i have the code. On the blog side it works 100% But when I add the comments_template(); on the portfolio single page it does nothing. I get no errors or anything. How do people implement comments within the portfolio pages? Can you not use the same comment.php file for all comments, b Thanks


Why I can't change the permalink of this page?

I have the following problem with a permalink: if I open this page (it is implemented as a static page) on my local website: `localhost/wordpressAsper/archivio` it automatically change it into `http://localhost/wordpressAsper/archivio-2/` Going into the administration panel ---> pages ---> All pages ---> **Archivio** and editing it I can see that the related permalink is `http://localhost/wordpressAsper/archivio-2/` So I tried to change it in from **archivio-2** to **archivio** but I can't because when I confirm the change it return to **archivio-2** (but I can change it any other values) I think that this could depend by an old **Archivio** page (that I have delete) that had **archivio** as permalink. So I think that WP have registered the old permalink of the old page (that not exist yet) or something like this. How can I fix it and have **archivio** as permalink instead **archivio-2**. Can I reset the old permalinks in some way?


Using multiple instances of wp_editor in Custom Post Type admin area

I've written a custom plugin for my fishkeeping website which allows users to enter information about a species of tropical fish (i.e. "habitat", "distribution", "locality", etc). Each of these are `meta` fields. They're currently drag/drop collapsible meta fields, using cleditor as the rich text editor of choice. I opted for cleditor because back in WP 2.8 or whatever it was that I started the development of this plugin on, I couldn't work out a way of getting multiple instances of TinyMCE on to the same page. By "multiple instances", I primarily mean editors with different `heights` and `buttons`. Since then, I believe `wp_editor` command has come in to play, which might assist me somewhat. **My question is this:** is it possible to have multiple, different instances of TinyMCE on the same page in the admin area of WP? Here's my written version of a use case diagram!   * User clicks into "Species" menu, clicks "Add new species"   * User sees a number of meta boxes. I'm not too fussed if these are drag/droppable, but it'd be useful if they could be collapsed and if they could be removed from the screen entirely.   * Certain fields like "genus" and "species" are less than 25 characters each. Can TinyMCE be reduced to a single row? Not a huge problem if it can't.   * Certain fields will need a row of custom buttons - I know I can create these in TinyMCE, but can I have my `genus` field with 3 buttons on, my `habitat` field with the normal set of buttons on and my `water_chemistry` field with a row of 8 custom buttons?   * Certain fields will need to be different sizes - `genus` as I mentioned earlier will need to be as small as possible in both dimensions; `max_size_notes` will need to be 8 rows and `misc_notes` will need to be 16.   * I'd prefer to use `wp_editor()` if at all possible as it's clean and easy..! A detailed, insightful answer would be hugely appreciated here. I've spent a great deal of time getting cleditor working and writing buttons for it, only to find that it has a number of formatting bugs :( Thanks in advance,


How to add custom field to wordpress page everytime user uploads new image in WP visual editor?

I have been hunting in GOOGLE for a long time. I want to add custom field whenever user uploads new image in page or post. Is there any hooks or filters that can be used to detect new image upload in WordPress. I am new to WP and I want to have this done. Thanks in advance.


How to build a PDF repository in WordPress

I'm seeking advice on the best way to construct a PDF repository. Basically, there will be an uploader in the administrator section and in the front end. The user should be allowed to add tags to the files. So I guess I need:   * Front-end uploader   * Backend-uploader   * Custom-post type?   * Security to check the PDF files and not just upload anything.  What else am I missing?


Wordpress Page doesn't load the template selected

I've created a new page called `Work` and I've added it on the navigation bar; after that I've created a file called `work.php` in which I want to style the page mentioned above. The problem is that the page doesn't show the new template created in `work.php` even if I selected it on the Wordpress graphic interface, but instead it shows the template of `index.php`. Does anyone know where the problem is? Thanks!


CSS not being applied

I am pretty new to web design, so this is a perplexing problem to me. I am creating a floating social media share button to the left of my content that scrolls with the blog content. Here is the code I am using:

     <iframe src="http://platform.twitter.com/widgets/tweet_button.html?url=<?php echo      rawurlencode(get_permalink()) ?>&text=<?php echo  rawurlencode(strip_tags(get_the_title())) ?>&count=vertical" style="width:55px;  height:62px;" frameborder="0" scrolling="no">

                And here is what is in my css file:               /*float social media buttons*/     #floating-menu-blog {background-color:#fff;border:1px solid #ccc;position: fixed; left: 50%; top: 342px; margin-left:-554px; z-index:100;}     #floating-menu .float-title{padding:1px 3px;}     #floating-menu .float-title a{color:#000;text-decoration:none}      However, on the site, the css is not being applied at all. I cleared all caches and disabled w3total cache to make sure that wasn't the issue. I have no clue what the issue is as it was working a week ago and I really haven't changed anything in relation to this code. Please let me know if I can provide more info. Thanks!


Plugins not showing in dashboard->plugins section

About 60% of plugins that I install don't show up in my plugins section. When I install them it says they're installed, and when I click "activate plugin" it says theres no valid header for the plugin. Navigating to the main plugin section in the dashboard the plugin doesn't show up at all, so I can't activate it from the main plugin page either. What's wrong here. I'm not using the multi-site wordpress, just a standard wordpress installation with buddypress on top. Thanks Tom


Quest and filter posts by author ID on author page

I'm building a custom author.php template. I use this to get the author by slug               $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));      Now my loop uses the author's ID like this

     <?php     $args = array( 'post_type' => 'product', 'author_id'=> $curauth->ID );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post(); ?>

<a href="<?php echo get_permalink( $loop->post->ID ) ?>">             <?php the_title(); ?>
              <?php if ( has_post_thumbnail()) : ?>                 <a class="author-product-thumb" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >                 <?php the_post_thumbnail('thumbnail'); ?>                              <?php endif; ?>
     <?php endwhile; wp_reset_query();?>

      The loop is displaying all the posts and not filtering, is it a problem in the arguments?


Display latest posts of author in a custom post type

Is there a plugin or code of sort that can display the last posts in a custom post type of a blog author? I know there are plugins/codes to display the last posts of the author, but I want to display only their posts in a particular post type I created. For example, the author posted in the Posts section a blog post. Underneath the blog post, I want to show his last five posts not in the Posts section, but in the Books section, which is a custom post type I made.


WordPress check if value equals and echo "checked"

Having some trouble with checking a query against another and outputting a value of checked if it matches. Have tried placing the get_post_meta in a foreach loop and it didn't work, It needs to pull in multiple "checked" boxes. Currently it's only checking one checkbox rather than multiple. The data is inside the database and the query pulls in the values in an array. I need a way to check if the meta_value of $locat matches the value of $area->id if it does echo checked in the checkbox. Code in its current state:               <?php     $locat = $wpdb->get_results("SELECT * FROM location_postmeta WHERE meta_key = 'locationAssigned' AND post_id = ". $post->ID);                                      $areas = $wpdb->get_results("SELECT * FROM location_locations ORDER BY locationName ASC");                                      if( count($areas) ) :                                     ?>                                         <?php                                         foreach($areas as $area) :                                             ?>                                             <input type="checkbox" id="locationAssigned" name="locationAssigned[]" value="<?php echo $area->id; ?>"                                             <?php                                                  //Check if $locat->meta_value matches $area->id echo out checked else nothing                                                                   if(get_post_meta($post->ID, 'locationAssigned', true) == $area->id) { ?>                                                  checked="checked"                                                  <? } ?>                                                            /> <?php echo $area->locationName; ?><br>                                                    <?php                                         endforeach;                                         ?>                                     <?php                                 endif;      Thanks in advance.


Some Themes do not have a header.php and footer.php how are they doing it?

Some themes that I have seen such as the (famous) thesis or even a few other not so famous themes have just an index.php (which has nothing in it), functions.php (call's their framework) and a style.css - and of course the comments.php. These themes don't exactly show you where they are storing their css - obviously in the header with the enqueue. But if I do something like enqueue my scripts and then call `get_header()` and `get_footer()` I get the obvious notices about how not having a header.php and footer.php is wrong. So can some one tell me how themes get away with just index.php? I have read the template hierarchy and while yes everything faults back to index.php - how is it that these people are getting way with this stuff? It should be notes that these types of themes do not have things like: header- custom.php or things like that.


How to generate/update a XML sitemap without plugins?

I like to hardcode everything on my WordPress websites, without using any plugins. Is there any way to generate or update my sitemap everytime I publish/update a post on one of my Multisite blogs, without using plugins?


how to add 'post_type' => 'wpbdp_listing' this with default post_type

hrere i added business-directory-plugin http://wordpress.org/extend/plugins/business-directory-plugin/ in my site here my site permalink are postname so i can not able to see my business-directory Directory Categories and post how to add filter the                'post_type' => 'wpbdp_listing'      in word press


Correct htaccess to display page while also passing in GET parameters

I have a wordpress page named: directory (it uses a custom template). When I call the page with:               http://localhost:8888/wordpress/directory/?segments=listings/list      It gives me the results I need. Now I need to make the url cleaner so that it will look like:               http://localhost:8888/wordpress/directory/listings/list      I tried this .htaccess with no luck (I get an internal server error):               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wordpress/     RewriteRule ^index\.php$ - [L]     RewriteRule ^directory/?(.*) /wordpress/directory/?segments=$1 [QSA, L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress/index.php [L]     </IfModule>     # END WordPress      Any ideas how I could get this to work? EDIT: Oops, looking more closely at the WP Rewrite Class page noted by Dwayne, I see that the specific example they provided was exactly what I needed. The code was provided on that page after: A Quick and dirty example for rewriting...               add_filter( 'rewrite_rules_array','my_insert_rewrite_rules' );     add_filter( 'query_vars','my_insert_query_vars' );     add_action( 'wp_loaded','my_flush_rules' );          // flush_rules() if our rules are not yet included     function my_flush_rules(){         $rules = get_option( 'rewrite_rules' );              if ( ! isset( $rules['(project)/(\d*)$'] ) ) {             global $wp_rewrite;             $wp_rewrite->flush_rules();         }     }          // Adding a new rule     function my_insert_rewrite_rules( $rules )     {         $newrules = array();         $newrules['(project)/(\d*)$'] = 'index.php?pagename=$matches[1]&id=$matches[2]';         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 just substituted 'directory' for 'project' and 'segments' for 'id' in the example code , and used '(directory)/(.*)$' for the rule to match. I put that in my plugin and it worked just fine. Thanks for the help.


Archive permalinks

This site has been very helpful for me in learning how to rewrite permalinks using add_filters to solve issues we were having when we merged two blogs into one. But, I do have one item I have been unable to find any tips for: On the date based archives links, i.e. www.domain.com/2011/12/ I simply want to translate them to: www.domain.com/news/2011/12/ Thanks in advance for any assistance.


Same footer on all multisites blogs

There is any way of using the main site footer (blog id =1) on all the network sites. I want to have the same footer in all the network. On the main site i got a theme and the child sites created by users got another theme. **Basically i want to use the same footer on both themes but manage all the widgets from just the main site.** Its possible to do this using switch_to_blog or something similar? UPDATE: I tried but no luck:               <?php         global $switched;         switch_to_blog(1);               get_footer();           restore_current_blog();     ?>


Can I use $query->set() (in a pre_get_posts() hook) with a custom taxonomy in WP 3?

I can do something like the following with a standard category:               $query->set('category__not_in', $term_id);      But how do I do the same with a custom taxonomy term? I'm using Wordpress 3.3.1 if it is relevant. Thank you. :)


featured images twenty eleven theme

Iv'e implemented the theme to have the featured post at the top display as a full post and the rest of the posts below display as excerpts but now my featured images aren't showing up. Im new to PHP (learning by books)... can someone show me the code for this? thanks in adavance JIM


Create API in wordpress as plugin?

I want to create an API plugin that will send json response to client which calls it via POST request.... say I have example.com and want to have api accessible through url example.com/api how can I implement it in wordpress as plugin? I want requests to be sent to url example.com/api but handle them in plugin... how can I achieve it?


"Request has expired" with "Make your site social" (Gigya) plugin

I am using WordPress 3.0.5 and am trying to integrate the Gigya API for user registration and login. I get _"Error: Request has expired"_ every time I try to register. With LinkedIn: ![Error message with LinkedIn](http://i.stack.imgur.com/QdlKX.png) With Yahoo!: ![Error message with Yahoo!](http://i.stack.imgur.com/fRY9q.png)


Post-Registration, post-meta hook?

Is there a hook in WP to access meta data of a user JUST after they have registered and meta data has been added to the database? I was reading to use `profile_update`, but wouldn't that be invoked every time they update their profile? I just want something to occur the moment that they have registered, and the users meta has been entered in to the database. Please let me know, Thanks! Tre


Intercept comment form submit/list by hook/filter

I am writing a media plugin that uses custom tables to store its contents. (eg not the post tables where wordpress stores it attachment data). Now i'm looking for a way to use the default wordpress comment system to add comments to it. (These comments will not be in the regular comment table but also a custom table. I need two things:   1. A hook that allows me to intercept the comment submit and process it with my own code if criteria are met. The criteria itself is arbitrary and not important, just need a way to get to the post data before Wordpress processes it.   2. A filter that allows me to replace the wp_list_comments() data with my own tabledata. It's a hacky idea, I know, but the post/attachment table is too limiting for what I need. Any ideas?


Wordpress Plugin Development - Headers Already Sent Message

I'm developing Wordpress plugins. When i activate my plugin, i'm getting a message > The plugin generated 293 characters of unexpected output during activation. > If you notice “headers already sent” messages, problems with syndication > feeds or other issues, try deactivating or removing this plugin. Plugin working very well but i don't know why i'm getting this message. My plugin is : http://wordpress.org/extend/plugins/facebook-send-like-button/


Why are my styles being applied to the admin area?

All my enqueued styles are applied to the back-end as well. I have never encountered this behavior before. Here's my code:               wp_register_style( 'main-styles', get_stylesheet_directory_uri() . '/css/styles.css', false, '1.0.0', 'all');          wp_enqueue_style('main-styles');


Let user edit his own comment

can I allow user to edit his own comment (without, username, url, or mail) on front-end. For example simple form on custom worpdress page with his comment and submit button. Thank you all in advance!


Turning a WP Site Into an iPhone/iPad App

With the advent of responsive design, it's beginning to simply make sense that we could make a site into an app. The concept is simple:   * When the user is on the site, remove the browser around the site so that it appears to be like any other app   * Provide the appropriately-sized icons for devices (tablets, smartphones, etc.)   * Meet all criteria necessary to distribute the app via the Apple app store I'm curious if anybody has the hacks, tutorial, or information necessary to achieve this.


Sort get_children by menu_order

I'm using the jQuery Carousel Gallery and unfortunately it's not working with WP's new v3.5 gallery ordering. When the client drags to rearrange images, those changes are not reflected in the front-end gallery. The plugin is no longer maintained, sadly. So I dove in and can see it's using `get_children`. I see this:               $attachments = get_children(         array(             'post_parent' => $id,             'post_status' => 'inherit',             'post_type' => 'attachment',             'post_mime_type' => 'image',             'orderby' => 'menu_order'         )     );      And this:               $js = array();     foreach ( $attachments as $id => $attachment ) {         $image = wp_get_attachment_image_src($id, "full");         // $image = the_attachment_link( $attachment->ID , false );         $js[] = "{url: '" . $image[0] . "', title: '".addslashes($attachment->post_title)."', caption: '".addslashes(remove_brs($attachment->post_excerpt))."', description: '".addslashes(remove_brs($attachment->post_content))."'}";     }     $output .= join(",\n", $js);     $output .= "];\n";`      I've seen here and elsewhere that get_posts will adhere to the menu_order `orderby` parameter, so to try it out I gave this attempt:               $post_img_args = array(         'post_type' => 'attachment',         'numberposts' => -1,         'post_status' =>'any',         'post_parent' => $post->ID,         'orderby' => 'menu_order',         'post_mime_type' => 'image'     );     $attachments = get_posts($post_img_args);      And in the `foreach` statement above, I replaced the `$image` variable with               $image = the_attachment_link( $attachment->ID , false );      This destroyed the gallery on the front end. (A quick note that disabling the plugin and viewing on the front shows the image-ordering just fine, so I do believe it rests with the above code and what it outputs). Any insight or guidance is appreciated. Thanks.


Any guides on using WP SVN with IDE clients?

The documentation for dealing with official WP repository is exclusively about using command line. While I have no bias against that, I do have little experience with VCS and two (or three) different ones I will have to figure out and use in nearest future. So for now I wing it with VCS integration features in IDEs (NetBeans, PHPStorm). Which often leaves me confused on specifics and ways of doing things properly. Are there any good articles/posts/guides on using official SVN repository (or at least SVN in general) with IDEs or other GUI-based tools? Something that focuses on concepts and workflow, rather than typing in arcane lines in console.


How to change user role setting in members plugin so that user can only edit his own post?

I want enable a user to only edit specific post. I am using the members plugin. I do not see a way to achieve this. Do I need to do some code for that post? Thank you!


How does Wordpress resolve permalinks internally?

I am doing some deep modding of the rewrite system and custom post_types but before I can continue I must find out how WordPress handles the rewrites. I found the function url_to_postid() but WordPress it self doesn't seam to use it to resolve permalinks into queries? For example: If I hook into the pre_get_post functions, and browse a page or a custom post_type the provided query now include "is_page" or "attachment" etc but if i where to type a URL at random, this data will not show. Where does WordPress figure out if the URL is a page|posttype|attachment or not? And how can I hook into this?


WP_Query Variable inside Array

The array below with "'taxonomy' => 'age'" isn't working, if I copy and paste the array "array( '19', '20' )" in place of the variable it works fine. I just started picking up PHP so go easy on me :)                               if($_REQUEST["price"] == 19){$price = "'19'";}                     elseif($_REQUEST["price"] == 20){$price = "array( '19', '20' )";}                     elseif($_REQUEST["price"] == 21){$price = "array( '19', '20', '21' )";}                     elseif($_REQUEST["price"] == 22){$price = "array( '19', '20', '21', '22' )";}                     elseif($_REQUEST["price"] == 23){$price = "array( '19', '20', '21', '22', '23' )";}                     echo $price;                     $my_query = new WP_Query( array(                                 'post_status' => 'publish',                                 'post_type' => 'post',                                  'cat' => '' . $_REQUEST["category"] . '',                                 'tax_query' => array(                                         'relation' => 'OR',                                         array(                                             'taxonomy' => 'age',                                             'field' => 'id',                                             'terms' => '' . $_REQUEST["age"] . ''                                         ),                                         array(                                             'taxonomy' => 'price',                                             'field' => 'id',                                             'terms' => $price,                                             'operator' => 'IN'                                         ),                                         array(                                             'taxonomy' => 'group',                                             'field' => 'id',                                             'terms' => '' . $_REQUEST["group"] . ''                                         )                                     ),                                 'posts_per_page' => '-1'                                 ) );


Display only one result from "get_the_category_list"

I'd like `get_the_category_list` to only display one or two categories instead of **all** the categories associated with the post. Haven't been able to find any results.               <?php echo get_the_category_list(); ?>      Any help would be appreciated


Can I use an array to create multiple tables?

I followed the codex page on how to make tables in the wordpress database with a plugin and was able to understand and get it to work However, the plugin I'm developing has the need for many tables along with joining tables and to code each table individually would be time consuming to say the least. Is there a way to create a batch of tables using an array() and loop function?


Upload Image to desired directory through plugin

I am creating a plugin that will allow the admin to manually input users. One of the options is including an image. I am unable to get the image to transfer from the computer into the directory. Here is what I have The form looks like this                  <form action="" method="post" enctype="multipart/form-data" >                 First name: <input type="text" name="firstname">
                 Last name: <input type="text" name="lastname">
                 Picture:<input type="file" name="picture">
                 <input type="submit" name="adminsubmit" value="Submit"/>     </form>      I have this at the top to be called once the submit button is clicked               if(isset($_POST['adminsubmit']))       {         include ('adminInsert.php');       }      My adminInsert.php file looks like this               $target_path="http://www....";     $target_path = $target_path . basename( $_FILES['picture']['name']);      if(move_uploaded_file($_FILES['picture']['temp_name'], $target_path)) {       echo "The file ".  basename( $_FILES['picture']['name']).      " has been uploaded";     } else{     echo "There was an error uploading". ( $_FILES['picture']['name']).", please try again!";     }      Here is what I get when I print the $_FILES               Array ( [picture] => Array ( [name] => morningGloryForSite.png [type] => image/png [tmp_name] => /tmp/php3j4sls [error] => 0 [size] => 119880 ) )      I just keep returning the ELSE portion of the IF statement. I can not get the file to transfer into the desired directory. Can someone just look at this and suggest any answers? Thank you in advance!


CPT: if more than X images are in post, use pagination

On my website, I have a custom post type ("foto's"). It contains photo albums which are fetched from Facebook with Facebook Photo Fetcher (plugin). This works great. Unfortunately, this plugin does not allow for pagination. On pages that contain a lot of images this can cause problems (verrrrryyy long load times), such as here. Because I am using a CPT it seems possible to me to use pagination. Unfortunately I have never used pagination before and I have no idea how to implement it. Is it in the declaration of the cpt, or is it a different function? And how could I make it work only when posts have more than X images? My guess would be to create a template `single-fotos.php` which differs from the default one in that it uses pagination. I do not know how to display pagination when there is more than X images though. ## EDIT 1 Building on Matthew's answer, I tried a couple of things. It seems better to edit the plugin, rather than trying building a custom post type. I added the following lines:               // Look for Next page tag in starttag             if( preg_match('/next=(\d+)/', $retVal['startTag'], $matches) )      $retVal['next']      =$matches[1];          ...          // Add default value of next to defaults array                 $defaults = array('cols'    => 6,               //Number of columns of images (aka Number of images per row)                                   ...                                   'next'    => 42);               // Can be any number, but preferably a multitude of 'more'          ...          // Output photos AND other tags such as more tag and next page         foreach($photos as $photo)             {                 //Output this photo (must get rid of [], or WP will try to run it as shortcode)                 ...                 $link = 'source . '" title="'.$caption_with_br.' " >picture . '" alt="" />';                 $retVal['content'] .= "
";                 $retVal['content'] .= "
$link
";                 ...                 $retVal['content'] .= "
\n";                      //Move on to the next row?                 if( $params['cols'] > 0 && ++$i % $params['cols'] == 0 ) $retVal['content'] .= "
\n\n";                 //Insert a more tag?                 if( $params['more'] > 0 && $i == $params['more'] ) $retVal['content'] .= "\n\n";                 //Insert a next page tag?                 if( $params['next'] > 0 && $i == $params['next'] ) $retVal['content'] .= "\n\n";             }             if( $i%$params['cols'] != 0 ) $retVal['content'] .= "
\n\n";             $retVal['content'] .= "
\n";      The problem with this is, that the nextpage-tag is only rendered once! After 42 photos (default) the next-tag is inserted, but after the following 42 photos it isn't rendered again. I suppose that is quite normal, but I am not familiar enough with PHP to accomplish that it is rendered every multiplication of the value given (or if not, default value) starting from n=1. How can this be done? ## EDIT 2 Note that this should work in combination with a `more` tag and that pagination oughtn't show in the snippet. So I do **not** want ![this](http://i.stack.imgur.com/ikwHe.png) in a snippet. Also comments and the respond field should only be placed on the last page.


Do we have to use ftp to recover from a bad functions.php edit?

Just tried to make an edit to the functions.php on my site. As is often the case, wp didn't like it and threw a fit, locking me out of making any further changes. So now I have to use ftp to edit out the offending code. You could argue I should be more careful / expert at coding, but the question is: Isn't there an easier way to recover from messing up with a functions.php edit than having to ftp?


Saved custom post type entry doesn't appear on custom post type table

I've registered several custom post type using a custom plugin. All of them seems to work fine. All are listed under the Post Menu. The problem occurs when I saved a custom post entry. The custom post type is saved on the database, and the permalink works fine from the front end. But strangely, the custom post type table is empty. The post status filter, shows ' All (1) | Published (1) '. Screenshot After some investigation, I found out that this happens after the second `register_post_type()` is called in my custom plugin. How can i fix this problem? Thank you. **Added** Here is 2 of the register_post_type code. Each of them are called from a different file using `include_once ('product/product.php');` and `include_once ('order/order.php');`               add_action('init', 'product_post_type', 0 );          function product_post_type() {          $product_labels = array(         'name' => _x('Product', 'post type general name'),         'singular_name' => _x('Product', 'post type singular name'),         'add_new' => _x('Add New', 'investment'),         'add_new_item' => __('Add New Product'),         'edit_item' => __('Edit Product'),         'new_item' => __('New Product'),         'view_item' => __('View Product'),         'search_items' => __('Search Product'),         'not_found' =>  __('No product found'),         'not_found_in_trash' => __('No product found in Trash'),          'parent_item_colon' => '',         'menu_name' => 'Product'     );     $product_args = array(         'labels' => $product_labels,         'public' => true,         'can_export' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => array( 'slug' => 'product' ),         'capability_type' => 'post',         'map_meta_cap' => true,         'has_archive' => true,          'hierarchical' => true,         'menu_position' => 6,         'show_in_nav_menus' => false,         'supports' => array('title','editor','thumbnail','comments')     );           register_post_type('product',$product_args);          }               add_action('init', 'order_post_type', 0 );          function order_post_type() {          $order_labels = array(         'name' => _x('Order', 'post type general name'),         'singular_name' => _x('Order', 'post type singular name'),         'add_new' => _x('Add New', 'investment'),         'add_new_item' => __('Add New Order'),         'edit_item' => __('Edit Order'),         'new_item' => __('New Order'),         'view_item' => __('View Order'),         'search_items' => __('Search Order'),         'not_found' =>  __('No order found'),         'not_found_in_trash' => __('No order found in Trash'),          'parent_item_colon' => '',         'menu_name' => 'Order'     );     $order_args = array(         'labels' => $order_labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => true,         'capability_type' => 'post',         'has_archive' => true,          'hierarchical' => true,         'menu_position' => 8,         'supports' => array('title')               );           register_post_type('order',$order_args);          }


How to import only certain comments from post[s]

> **NOTICE:** This is solely NOT a WordPress.com Question, but related to > WordPress Migration and Export-Import. I started blogging in WordPress.com and then shifted my blog to a self-hosted site. But even after that, I din't shut down my **.com** blog for some internal reasons. Though I stopped updating the **.com** blog, users are still commenting there. But after a long time, I now determined to shut down the **.com** site. But before that, I want to import some of the new comments, those posted after the migration. Suppose, post#5 had 3 comments, when I migrated, now it has 5 comments -- so, 2 new comments are in post#5. As because I have to Export `.xml` data from the **.com** site, and the `.xml` contains all the post comments etc. in it. So, I've to find out a way that only import and add, but doesn't duplicate and/or delete and/or overwrite any of my site's present post content or comments or any other settings. Is that really possible? ### EDIT What I got so far is the `.xml`, and I got that the comment resides under `<wp:comment>` under each `<item>` with the `$post_id` and others:               <item>      <wp:post_id>$post_id</wp:post_id>      <wp:comment>$comment</wp:comment>     </item>      I've actually no idea about how to proceed with WordPress `.xml` data file.


Widget queries even when there are no sidebars?

I'm trying to reduce my database queries. I don't have any sidebars or widgets set but I noticed the following query               SELECT option_value FROM wp_options WHERE option_name = 'widget_pages' LIMIT 1      Similar queries happen for widget_calendar, widget_links, widget_tag_cloud, and widget_nav_menu. 5 database queries for no reason. How do I disable this? remove_action('widgets_init') doesn't do anything.


Wordpress Custom Taxonomy - Volume / Issue - Unique Slug Issue

I have a site that I'm making for a quarterly print magazine. I'm making all of the articles from all issues into Wordpress posts. Every Article/Post belongs to an Issue and every Issue belongs to a Volume (Standard magazine stuff). Instead of using Categories to represent a hierarchical relationship between Volume --> Issue I thought it would be better to use a Custom Taxonomy. So I made a Custom Taxonomy of "Volume". This is how I registered it in functions.php               function add_custom_taxonomies() {     // Add new "Locations" taxonomy to Posts     register_taxonomy('volume', 'post', array(         // Hierarchical taxonomy (like categories)         'hierarchical' => true,         // This array of options controls the labels displayed in the WordPress Admin UI         'labels' => array(             'name' => _x( 'Volumes', 'taxonomy general name' ),             'singular_name' => _x( 'Volume', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Issues' ),             'all_items' => __( 'All Issues' ),             'parent_item' => __( 'Parent Volume' ),             'parent_item_colon' => __( 'Parent Volume:' ),             'edit_item' => __( 'Edit Volume' ),             'update_item' => __( 'Update Volume' ),             'add_new_item' => __( 'Add New Volume' ),             'new_item_name' => __( 'New Volume Name' ),             'menu_name' => __( 'Volume-Issue' ),         ),         // Control the slugs used for this taxonomy         'rewrite' => array(             'slug' => 'volume', // This controls the base slug that will display before each term             'with_front' => true, // Don't display the category base before "/volume/"             'hierarchical' => true // "         ),     ));      } add_action( 'init', 'add_custom_taxonomies', 0 ); The issue is now that the slug for Taxonomies need to be unique so instead of the urls being very pretty like: example.com/volume/volume1/issue-2/ i get example.com/volume/volume-11/ **issue-1-volume-11** / This seems to be because the slugs "issue-1", "issue-2", "issue-3" and "issue-4" were taken up in the first volume and slugs need to be unique? It's not the worst problem in the world but I though that since the Taxonomy for Issue is under a Volume which is unique I wouldn't have this problem. However, I do.... Anyway, can anyone suggest a better way to do this? Custom post Types possibly? Though I thought this was the perfect answer, just can't seem to get the URL's and slugs to cooperate. I'd like to just come out with very pretty and predictable URLS like: example.com/volume-1/issue-1/ example.com/volume-1/issue-2/ example.com/volume-9/issue-3/ I'd really appreciate the communities insight on this. Thanks Mike


Cannot update user display_name field

I'm trying to update user display name when posted through a form. Here's what I'm trying:               if ( !empty( $_POST['display_name'] ) ){             //var_dump($_POST['display_name'] );         wp_update_user( array ( 'ID' => $current_user->ID, 'display_name' => esc_attr( $_POST['display_name'] ) ) );     }      I can see that the display name is posted correctly, but it just does not update it. I can update the user url successfully but not the **display_name** and **first_name** / **last_name**. Is there any other way to update these fields?


how to save multiple custom fields for a post in one go?

I want to save multiple custom fields for a custom post in one go. Something like get_post_custom() except for that I need to set it this time.


Force all users in MU to change their passwords

I'm looking for a solution to notify/force all users in an MU network to change their passwords. Any ideas of a solution out there as a plug-in?


Call External Object in Class Function During Callback

I've a class which has a function that check and creates table in database. In order to do so i need to use WordPress $wpdb object. I need the function to run only on first plugin activation, so i use the function:               register_activation_hook  ( __FILE__, array( 'MemorialCandles', 'dbInstall'   ) );      The problem is that i get always this error: > Fatal error: Using $this when not in object context in > /home/xxx/xxx/wordpress/wp-content/plugins/MemorialCandles/memorial- > candles.class.php on line 77 **the class code:**               <?php          // Global Variables:     global $wpdb;     register_activation_hook  ( __FILE__, array( 'MemorialCandles', 'dbInstall'   ) );          /**      * Class: MemorialCandles      *       * Provides skeleton to the plugin and handles queries and action.      *       * @author Dor Zuberi <dor@zubri.me>      * @copyright 2011 Dor Zuberi      * @license http://www.php.net/license/3_01.txt      */     class MemorialCandles     {         // Variables             /**          * @var string stores plugin direction - RTL or LTR.          */         private $pluginDirection;              /**          * @var string stores the plugin database table name.          */         private $tableName;              // Constructor         /**          * Initiates the plugin, stores and configure the basic setup procedures.          *           * @return void          */         function __construct()         {             global $wpdb;                  $this->tableName = $wpdb->prefix . 'memorialcandles';         }              // Getters              // Setters              // Methods         /**          * Handles the database table creation.          *           * @return void          */         function dbInstall()         {             global $wpdb;                  if( $wpdb->get_var( "SHOW TABLES LIKE `{$this->tableName}`" ) != $this->tableName )             {                 $sql = "CREATE TABLE `{$this->tableName}` (                             id        int(8) NOT NULL AUTO_INCREMENT,                             fullName  text   NOT NULL,                             message   text   NOT NULL,                             postDate  text   NOT NULL,                             galleryID int(8) NOT NULL,                                  UNIQUE KEY id(id)                         );";                      require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );                 dbDelta( $sql );             }         }              /**          * Handles the database table drop procedure.          *           * @return void          */         function dbUninstall()         {             global $wpdb;                  $sql = "DROP TABLE IF EXISTS `{$this->tableName}`;";                  $wpdb->query( $sql );         }         }          ?>      Thanks in advance! :D


Detect session/cookie variable in wordpress to prevent access to documents

<?php     @session_start();          If (!array_key_exists(‘authed’, $_SESSION))     {          include ‘not_authed.inc’;          exit();     }          // go about your business.          ?>      and i'm trying to add that to this:               <?php          function checkValues($value)     {          // Use this function on all those values where you want to check for both sql injection and cross site scripting          //Trim the value          $value = trim($value);              // Stripslashes         if (get_magic_quotes_gpc()) {             $value = stripslashes($value);         }               // Convert all <, > etc. to normal html and then strip these          $value = strtr($value,array_flip(get_html_translation_table(HTML_ENTITIES)));               // Strip HTML Tags          $value = strip_tags($value);              // Quote the value         $value = mysql_real_escape_string($value);         return $value;          }        mysql_connect ("mysql.*****.com", "****","$*****")  or die (mysql_error());     mysql_select_db ("***********");          $term = checkValues($_REQUEST['val']);     $term = mysql_real_escape_string($term);          $sql = mysql_query("select * FROM patient_db WHERE id_number = '$term'");               if($row = mysql_fetch_array($sql)) {         echo "";         echo '
';         echo '
 ID Number: '   .$row['id_number'];         echo '
 Name: '        .$row['Name'];         echo '
 Exp. Date: '   .$row['exp_date'];         echo '
 DOB: '         .$row['dob'];         echo '
';         //echo "";     } else {         echo "";         print "
USER ID
NOT FOUND

";         print "OOPS!! THIS COULD BE AN ERROR
";         print "
";         print "
*****
";     }          ?>


Creating an Archive using a Custom Taxonomy

I recently adjusted the twentyten theme to display archives in a three column grid. In doing so, it seems that the archive has lost the ability to display posts from the specified taxonomy. For instance, a taxonomy type is 'Flowers', with a specific flower being 'Rose'. When the 'Rose' archive is displayed, it simply lists all posts. I believe I have narrowed the problem to this line: `query_posts('cat=0&posts_per_page=12&paged='.$paged);` I understand that it is just listing all 'uncategorized' posts, but I am at a loss with how to have display a specific taxonomy archive as would normally be done for a category archive. Any ideas? I am guessing it isn't as hard as I am making it, but I have searched for hours with no luck. Thanks in advance!


Query between two meta keys

I feel like I'm extremely close on this one but the query keeps on showing up empty. Basically, I'm trying to query the custom values between two dates. Records should be returned if the start date is less than the current date _and_ the end date is greater than or equal to the current date:               $args = array(         'taxonomy' => 'exhibition_type',          'term' => 'faculty',         'numberposts' => 10,         'post_type' => 'exhibitions',         'meta_key' => 'start_date_of_event',         'meta_query' => array(             'relation' => 'AND',                 array(                     'key' => 'start_date_of_event',                     'value' => $current,                     'compare' => '<'                 ),                 array(                     'key' => 'end_event_date',                     'value' => $current,                     'compare' => '>='                 )             ),         'order_by' => 'meta_value_num',         'order' => 'ASC',         'paged' =>  $paged     );      The code I'm using now keeps on turning up 0 results and I'm stuck at the moment. Any help would be much appreciated.


Custom Post Type Pagination on Single.php?

The same old problem and not sure if its even possible. Pagination on a single.php custom post type, is it possible? This works fine until i turn permalinks to /%postname%/ then it just reloads the same page when click on the previous/next links,               <?php        $temp = $wp_query;        $wp_query = null;        $wp_query = new WP_Query();        $wp_query->query('showposts=1&orderby&menu_order&post_type=press-round'.'&paged='.$paged);             while ($wp_query->have_posts()) : $wp_query->the_post();      ?>                 <?php the_title(); ?>          <?php endwhile; ?>          <nav>     <?php previous_posts_link('« Newer') ?>     <?php next_posts_link('Older »') ?>     </nav>          <?php $wp_query = null;  $wp_query = $temp;?>      I've refreshed the permalinks, removed the htaccess, made sure a page is not the same name everything that you'd usually do. Is it just not possible to have permalinks on for pagination on a single custom post type page?


Trouble passing attribute into shortcode function

For some reason the WP_Query instance in my shortcode function won't take the query attribute sent from the shortcode. The shortcode is like this: [postlist query="post_type=any&posts_per_page=5" style="list"] Here's the code.               function hey_query_shortcode( $atts ) {         extract( shortcode_atts( array(             'query' => '',             'style' => ''         ), $atts ) );                  ob_start();              $the_query = new WP_Query( $query );             while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php the_title(); ?>
         <?php the_excerpt(); ?>
I know $style is set bc it shows up here: <?php echo $style; ?>

I know $query is set bc it shows up here: <?php echo $query; ?>
          <?php         endwhile;          echo '
';         wp_reset_postdata();              $list = ob_get_clean();         return $list;          }          add_shortcode( 'postlist', 'hey_query_shortcode' );      Any idea what is going on here? $query echoes out fine but for some reason it doesn't affect the WP_Query query.


I'm trying to find a basic plugin for displaying images in a widget

I've tried and installed loads of free WP plugins that can't do what I would like them to do. I write a fictional news blog and I'd like to be able to display about a dozen or so adverts that I've made myself. They are each going to be 250x250px and need to be in the sidebar of my site. I figured it would be easier if it was in a widget. I'm not using a external service like Adsense. It's not necessary that my adverts keep record of impressions and they don't have a hyperlink.


Get post and all posts after it by ID?

Maybe this is super obvious and staring me in the face, but I'm stumped. Is there a way to pull and sort posts by ID? I'd like to grab an arbitrary post, and then x number of posts after it. Specifically what I'm trying to do is a build a carousel of posts, and I'd like the first item on every individual post to be the current post, and then everything following it. I'd also like to be able to scroll the carousel backwards. I'm using the JSON API plugin to make AJAX calls to pull the posts. Basically I just want to add a "WHERE post.id >= currentPost" to the query, but I can't figure out where to implement this. I tried using the posts_where hook but I always get zero results.


Limit number of posts a user can make per minute?

So I found the solution to limiting a number of posts a user can make per day but not per minute. Here's an excerpt from the code I found on http://wordpress.org/support/topic/limit-the-number-of-posts-a-user-can- make?replies=18                   //limit the quantity to N posts         $N = 20; max 20 posts por usuario         $count_posts = count(get_posts(array('author'=>$user_ID)));// returns the quantity of written posts by current user to $user_ID         if ($count_posts >= N){         Header("Location: index.php");//redirects to dashboard, where it should point the user that he cannot create a new post         }         //end of modification      How can I modify the $count_posts var so that it counts time? I want to make it so that users can only submit one post every 2 minutes. If they submit a post in the server, they have to wait 2 more minutes before submitting another post.


get_template_directory() still returning path to previous theme

In WordPress, I've been installing and using various themes, including 2013, Roots, and now BlankSlate. I noticed that now that I've activated BlankSlate, the function `get_template_directory()` used in front-page.php is still returning the path to the Roots theme directory. My current front-page.php looks like this.               <?php get_header(); ?>
            <img class="frontpageimg" src="<?php get_template_directory(); ?>/images/slogan-2.png">
In the Los Angeles area?

Ask about free demo loaners!

We also take mail orders.
 On all orders, there is a 30-day return policy!
                            <img src = "<?php get_template_directory(); ?>/assets/img/cables-ers-absorber-700.jpg"/>            <img src = "<?php get_template_directory(); ?>/assets/img/blueprint-silencers-v2-700.jpg"/>            <img src = "<?php get_template_directory(); ?>/assets/img/brav-front-page-700.jpg"/>                  Contact Us
     <?php get_sidebar(); ?>     <?php get_footer(); ?>      EDIT UPDATE: Did some some debugging as follows: Deactivated all plugins. Logged out, cleared cache. The problem persisted. Switched from BlankSlate (in which the problem was evident) to 2013 theme. Similar behavior, although I now can say more specifically what that behavior is. While in the 2013 theme, apparently the PHP construct `<?php echo get_template_directory(); ?>/path-in-2013-theme/file.jpg` works, but `<?php get_template_directory(); ?>` returns the path to the Roots theme. The same is true of `<?php echo get_template_directory_uri(); ?>` (works correctly with the `echo` but not without). However, the behavior is somewhat different in BlankSlate. Without the `echo` both `get_template_directory()` and `get_template_directory_uri()` return the path to Roots theme, while with the `echo` they do something else (but I'm not sure what that something else is.. how do I dump these values for debugging?) FURTHER DEBUGGING: I was able to inspect the page source with Firebug. Sure enough, the functions had no output without echo. So the image source was `src="/assets/img/brav- banner-3.jpg` and so forth. And that worked in some themes. I mean I could see the image. So maybe it's a caching problem? When I added the echo and changed the path to the jpg, I was able to get it to work in the BlankSlate theme. So I am going to mark this solved, as a caching issue.


Wordpress White Screen Error

So I have encountered the white screen error of Wordpress. I enabled the WP_DEBUG in the wp_config.php and found no errors. I also tried `error_reporting(E_ALL);` and `ini_set('display_errors', 1);` and it still didn't display any errors. I have also tried increasing the memory limit of Wordpress, still no luck. I read an article stating that a white screen error will appear if there are spaces before `<?php` and after `?>`. So I opened my files in my FTP and I found out that all the code in the files have double space in them. Even code from plugins have double space added to them. What causes this? Is this because of my FTP and editor? I doubt because I have not encountered this yet.


pingback returns faultCode 0, no message

I have implemented my own pingback client and sent out pingbacks to different hosts. Some wordpress instances responded to the XML-RPC pingback request with a `faultCode` of `0` and an empty `faultMessage`. What can be the cause for that?


Disable Override in WooCommerce

In my WP theme i've created a folder called " **woocommerce** " and inside that i put all file with my custom code, based on WooCommerce guidelines: template structure All work fine, but is possible to **disable** that override? Many thanks!


Where can I find a 'server subfolder path' for my plugin-Better Backgrounds and what is it?

I'm using a plugin, Better Backgrounds for my website, obviously and I don't know what a 'server sub-folder path' is, which, to my knowledge, is linked to changing the background of my website to whatever pattern or image I enter into the image location box, I think that's what it's called? Furthermore or where I to find it? Can someone please help me?


What, specifically, should be included in theme_name_setup()?

I’ve “inherited” the development of an old theme that I’m now bringing up to speed for WP 3.9. The theme code comes with a `functions.php` that has a function theme_name_setup() that hooks into after_theme_setup. So far, so good. However, it appears that just about everything under the sun has been thrown into the theme_name_setup() function, and all the other theme files for admin pages, templating functions, styling functions, custom headers, widgets, etc — all this is called (via `require_once`) from within this theme_name_setup(), and is thus all loaded, willy-nilly, on the after_theme_setup hook. I’ve looked at other themes (the default 2012, -13, -14 and underscores) which have a much cleaner theme_setup() function, and I know enough to know that hooking absolutely everything — functions within functions — on the same hook is a train wreck waiting to happen (though the theme does seem to operate alright this way for now). I have the examples of the default themes to go by, but what I want to know (and can't seem to find via almighty Google) is specifically: Beyond add_theme_support(), textdomain/localization considerations, register_nav_menus(), and thumbnail support, what if anything, should be specifically included into the theme_name_setup() function, hooked as described above? (And, by extension, everything else should be defined/hooked somewhere else.)


User meta conventions / name registry, for social media links

The Yoast WordPress-SEO plugin adds some social media links to user_meta:               function update_contactmethods( $contactmethods ) {         // Add Google+         $contactmethods['googleplus'] = __( 'Google+', 'wordpress-seo' );         // Add Twitter         $contactmethods['twitter'] = __( 'Twitter username (without @)', 'wordpress-seo' );         // Add Facebook         $contactmethods['facebook'] = __( 'Facebook profile URL', 'wordpress-seo' );              return $contactmethods;     }      using bare, namespace-less identifiers for the user_meta keys. I'd like to use these in my about-author box, and add some more (LinkedIn, StackOverflow, GitHub, etc.), and it'd make sense to share the fields and values with any other plugins or widgets that want these too. Short of better ideas, I was planning to just add keys `'linkedin'`, `'stackoverflow'`, `'github'`, etc.   * Is there a central registry of common user_meta keys, so I can make sure I'm using the same as everyone else? I can't find one from a quick search.   * Yoast specifies 'Twitter username without @', whereas the others are profile URLs. Is that a common convention for user_meta `twitter`, and is that documented anywhere? Arguably Twitter is the only one here where it makes sense to use username not URL, but that'd apply for at least GitHub in my new list too - so I'd like to do the same as everyone else if possible. (I've written my code to cope with URL or username, with or without the '@'.) Thanks!


Wordpress theme options vs custom post types

For dynamic content across a wordpress website, is it a better practice to create new post types for updating content or using theme options? I personally find theme options a little more time consuming to code than registering a new post type in functions.php


Run WordPress frontend and backend in different domains

I want to run my WP frontend as `www.example.com` and my backend (i.e. wp- admin) as `user1.example.org`, is it possible? The reason is I want to host lot of sites in a single server which has only 1 IP and I need SSL support for wp-admin (i.e. *.example.org)


How to achieve a clean custom permalink solution?

I am working on the design of a blog with the below(just a sample) category hierarchy.                                                              PARENT                                                  |                          |------------------------------------------------|                        Food                                           Fashion                          |                                                |               |---------------------|                       |---------------------|           European                Asian                  European               Asian               |                     |                       |                     |         |---------|           |-----------|             |--------|           |--------|     Italian    French      Chinese    Japanese       Italian  French     Chinese   Japanese         The client will blog on Food and Fashion with posts categorised by country. Meaning that a post about Italian Pizza will go under PARENT > Food > European > Italian My problem is with permalinks as the client wants the below structure for categories:   1. http://www.mydomain.com = the homepage of the blog, bits and pieces from ALL categories   2. http://www.mydomain.com/food = the food sub homepage, bits and pieces from all sub-categories under Food   3. http://www.mydomain.com/fashion = the fashion sub homepage, bits and pieces from all sub-categories under Fashion   4. http://www.mydomain.com/european = the european sub homepage, bits and pieces from all European sub-categories under both Food and Fashion   5. http://www.mydomain.com/european/food = the european food sub homepage, bits and pieces from the Food>European sub category   6. http://www.mydomain.com/european/italian/food = the italian food sub homepage, bits and pieces from the Food>European>Italian sub category etc. And this structure for posts:   1. http://www.mydomain.com/european/italian/food/25115886/how-to-bake-the-right-pizza   2. http://www.mydomain.com/european/italian/fashion/25175191/milan-fashion-show-in-june My main problem with Wordpress' native way of managing permalinks is course the category base /category/ added by Wordpress. Also a headache is the fact that /european/italian/food is NOT in the order the category is saved, which is /food/european/italian. I therefore tried testing around with the below code in my template's functions.php file:               add_filter( 'category_link', 'bloglinks', 10, 2 );          function bloglinks( $catlink, $category_id )     {     }      I was thinking of carrying out a check against the category IDs(which will never change) inside the function and build the permalink I want. But is that the right place to do all the coding? Will I break anything, like plugins, etc.?


using custom taxonomies with custom post types: display list of posts by 'category'

I still don't quite understand when it's best to use custom post types vs custom taxonomies.. or both together at once. I have Menus as my custom post type. There's nothing about it that needs to look different from any other post on the site though. What I need to do is display a list of Types of menus (traditional, Indian, Kosher etc), and then below each type, a list of each post(menu) of that type. How is the best way to do this? I'd like to keep it in a separate section from the blog, and I love the custom menu item in the admin, so it's ideal that way. I'm just stuck on how to get essentially a "category" page (menus) that would list all the subcategories (types of menus) and all posts in those subcategories.


Display a post's publish date from 2112

So I am making a news website about the future, 2112 to be specific (hello, critics). I wanted to display a post's date to be from 2112. But when I try to do this from the admin panel, it 'schedules' the post. I really want to publish the post in this century. Any help, people?


get the avatar url instead of an html img tag when using get_avatar?

i want to get the user avatar URL to use it as background URL style for a div. i tried to use the following but it does not return anything when i view the code it appears like that.               background: url()      i used this function.               function get_avatar_url($get_avatar){     preg_match("/src='(.*?)'/i", $get_avatar, $matches);     return $matches[1];     }      any help please??


How To Remove The "Delete" Theme Option In Dashboard

How do I remove the option to "delete" a theme in the admin dashboard? I built a site for clients with several themes they can choose from and i don't want them to accidentally delete a theme. Thanks!


New Wordpress Error Message - Not seen this before

I've just seen a new error message on one of my Wordpress sites that I've not come across before. _**"This request has been denied for security reasons. If you believe this was in error, please contact support."_** As usual, I hopped onto Google to see why this was coming up, but short of a few others also finding this message there's very little out there on this. Does anyone know what it is? Is it new? A part of Wordpress? It doesn't really offer much in the way of explanation. I'm guessing it's an IP ban of some sort, but I'm not sure where... ![Boring error message](http://i.stack.imgur.com/Phe7Q.png)


Include PHP file in Content using [shortcode]

Here is what I have I am not having any lucking finding how to simply include a file in the content editor using a shortcode. For Example if I wanted to include form.php inside my Contact Page how would I make this happen using a shortcode? Below is was attempting to work with to no avail. Any help would be appreciated!               // Shortcode implementation     function magic_stuff($atts) {          // turn on output buffering to capture script output          ob_start();          // include file (contents will get saved in output buffer)          include(TEMPLATEPATH.'/wp-content/themes/grainandmortar/inc_static/test.php');          // save and return the content that has been output          $content = ob_get_clean();     return $content;     }     //register the Shortcode handler     add_shortcode('magic', 'magic_stuff');


How to Change the WordPress Permalinks for some posts

i have this permalinks structure:               /%category%/%postname%/%post_id%/      is it possible to apply `/%category%/%postname%/` for some categories? Thanks


Override the Wordpress core function wp_referer_field

I'd like to override the core Wordpress function wp_referer_field to change the value of $referer_field variable inside of it. I've found that wp_referer_field is not pluggable and that I need to use some other technics for that. Adding some filters or actions. I was trying to use these code:               add_filter( 'wp_referer_field' , 'wp_referer_field_cyrillic' );     function wp_referer_field_cyrillic( $echo = true ) {        $referer_field = '<input type="hidden" name="_my_wp_http_referer" value="'.urldecode(esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) )) . '" />';        if ( $echo )          echo $referer_field;        return $referer_field;     }      But it doesn't work. It seems that I did something wrong.


What's the proper way to find and remove duplicate images from posts and the media library?

I just exported a largish WP blog from MediaTemple to PHPFog. I used the standard WordPress export and import plugins. For some unknown reason all of my media assets have been duplicated. I now have twice as many images per post. If an original file was called "Lot-44-Warrens.jpg" it now has a duplicate called "Lot-44-Warrens1.jpg" Both files are attached to the same post. I now have many duplicate images across about 250+ posts. So my question is how do I remove said duplicates from the media library and from the posts? I tried to search the media library with "*1.jpg", but it didn't work. Looking for a neat solution that doesn't mean removing each dupe manually. Perhaps there is a MySQL query I can run to remove the dupes from the library and the posts? The site in question is: http://igrealty.phpfogapp.com/ .


Submenu in sidebar custom page template

i would like to show the submenu of my page in a custom page template on the left side in a Sidebar-area. Does any know the code for showing the submenu. Wordpress 3.4.1 Thanks a lot!!!


Get the size (size in Kb or MB) of an featured image?

I need to display some featured image info on post page. Among other info I need to display file size of image (featured image of post). I tried this function inside single.php.               <?php     function getSize($file){        $bytes = filesize($file);        $s = array('b', 'Kb', 'Mb', 'Gb');        $e = floor(log($bytes)/log(1024));            return sprintf('%.2f '.$s[$e], ($bytes/pow(1024, floor($e))));     }     ?>      and to echo that:               <?php echo getSize('/wp-content/uploads/2014/06/some-file-name.jpg'); ?>      It works, but I need help to make ti automatically grab featured image url, not to manually enter it in code? For example I use this to echo featured image ("full") url:                <?php      if ( has_post_thumbnail()) {        $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');     echo $thumb_image_url[0];      }     ?>       Could you please help to combine it, or to provide me with another solution?


Orientation of featured image in post?

Is it possible to show orientation of featured image in post on single.php? For example: Orientation of featured image is: portrait / landscape. * * * I have found that this could be done by calculating aspect ratio of image (width / height). For example image with dimensions 1600 x 1200 have aspect ratio 1.33333 (landscape) and 1200 x 1600 have aspect ratio 0.75 (portrait). If you are interested to find more look on: Get total number of pixels, size in megapixels and aspect ratio based on image width and height?