In WordPress how do you create a custom post type with the author's name in the slug?

I'm trying to build a new WordPress theme using register_post_type to create a custom post type called listings. I would like each listing to have the following permalink structure: http://www.mysite.com/%author%/listing-title I'm not quite sure how to achieve this with the CPT controls listed in the Codex. Previously, I have a achieved a similar effect by creating a custom structure in Permalink Settings:               /%author%/%postname%/      It has been suggested on the main forum that I use wp_rewrite, but wp_rewrite only seems to deal with incoming requests and does not change the way CPT posts are created. To illustrate further with an image, I want to change the /listings/ part of the permalink URL to the post author's name. See image below. ![alt text](http://i.stack.imgur.com/KPI3a.gif)


Creating a second menu on Twenty Eleven aligned right from the first

I'm a bit new here. But I did attempt to Google this (etc.), without much luck. Basically, I'm trying to set up a second menu on Twenty Eleven that will line up to the right of the normal one (while keeping the normal one). In other words, something like this: |Home | First_Page | Second_Page | . . . (empty space) . . . | 2nd-to-last- page | Last page Is there a relatively simple way to do that? I've gotten more used to CSS lately (working with Wordpress), so I can handle basic-to-moderate techniques there (and I've been doing PHP for years now, so not too many issues there). I'm just not sure where to begin :). Thanks! \- Alex


How can I alter the display of category listings via sidebar.php?

I would like to alter the default categories widget code so that it does not show any categories which are children of the uncategorized (id=1) category. Can I do this via my sidebar.php or functions.php code?


Best Sitemap Plugin for 1M+ pages

A client of mine has a VERY, VERY, VERY large WordPress site (over 1 million pages). Is there a sitemap plugin that can handle this (would need to create sitemap indexes)? Their site have very shallow crawldepth, so they figure a sitemap would help a lot.


Wordpress / Audio player

I need to build a website with an audio player. This audio player needs to play music without stopping when content is loaded. I know this might be a little complicated but I would like to know if this is possible and how I could implement it.


Are Category or Tag Archive Pages Possible?

Currently /category and /tag 404 if you hit them directly. Is it possible to create a theme template to handle what would display on it? Mark Jaquith - http://twitter.com/#!/markjaquith/status/154324264047218688 \- mentioned it might be possible to do with a custom rewrite rule, but I don't know where to begin to implement such a thing... Any help at all would be greatly appreciated.


Recommended eCommerce Plugin for a T-Shirt Sales Business?

**I want to create a website for my T-Shirt business**. I've tried osCommerce and it's ok for a basic setup but even something simple as installing an addon for SEO turns into a nightmare of database editing and modifying php files. I've used WordPress before and it's an absolute dream to setup and customise. Here are the requirements that my shop would need:   1. **Multiple attibutes** \- e.g. customer should be able to choose things like size, color, garment type etc. Also I need the option of an attibute to be able to change the price. E.g. If I have a base price of $11.99 and the cutomer selects "Kids small" for size then I want to deduct $3 from the base price.   2. **Display multiple pictures** depending on what I choose. E.g. if I choose a woman's tee from the garment type then the picture should update to display the design on a woman's tee.   3. **Bulk import/export** \- I need to be able to mass import or export products, attributes etc. via something like CSV or Excel.   4. **Reporting tools would be nice** , so I can see my shops performance at a glance. I know there are several eCommmerce plugins out there but do any of them do the things I've listed above? Many thanks in advance.


Wp-pagenavi giving page not found on clicking page 2

I'm getting a page not found when I click on page 2 using wp-pagenavi. This is my code, is there anything obvious there that's wrong?
                         <?php $portfolioloop = new WP_Query( array( 'paged' => get_query_var('paged'), 'post_type' => 'news', 'posts_per_page' => 4 ) ); ?>                         <?php while ( $portfolioloop->have_posts() ) : $portfolioloop->the_post(); ?>                         <div class="news-item" onclick="location.href='<?php echo the_permalink(); ?>'">
<a href="<?php echo the_permalink(); ?>"><?php echo the_time('d.m.Y'); ?> / <?php echo the_title(); ?>

                                 <?php if (get_field('description') != "") { ?>                                     <?php echo the_field('description'); ?>                                 <?php } else {                                      $newscontent = get_the_content();                                     $newscontent_str = strip_tags($newscontent, '');                                     echo substr($newscontent_str,0,250) . "…";                                 } ?>

                         <?php endwhile; // end of the loop. ?>
<?php echo wp_count_posts('news')->publish; ?> news items
                         <?php if (function_exists('wp_pagenavi')) {                         wp_pagenavi( array( 'query' => $portfolioloop ) ); } ?>
        UPDATE: I tried the following: I saved the permalinks again as that usually solves any problems like that but that didn't work so I set permalinks to default, saved, that worked for the pagination but now clicking on a post had a 404. So set it to post name then saved again and it was just back to normal where the pagination wasn't working.


Adding Page Ordering to a Custom Page Type

I've created a custom page type (that is, a custom post type converted to a page). This template is used to display profiles of employees. I then use the Simple Page Ordering plugin to order my pages and staff profiles in the custom page template. It works well for my normal pages but isn't working for my custom page template. I'm not sure what I need to do to make the page ordering work. I noticed my custom page template doesn't have ordering on the edit screen and I'm unsure how to add it - perhaps that would do it? Here's my archive template markup for my custom pages: http://snippi.com/s/y8288ky Full functions (in functions.php) for the custom page template: http://snippi.com/s/v0u3h07


Can I flush W3TC's cache in a capistrano deploy?

I'm trying to simplify my deploy process and am making use of the Capistrano tool. Is there a way to have capistrano flush W3TC's cache in a deploy task?


Run JS after widget settings are saved?

I've written a small widget that uses JS for setting up some tabs in the settings panel. Is there a way to re-trigger the tab JS when the widget is done saving? Looking at the WP JS source it doesn't look like it, as it simply blows away the existing HTML & re-renders the entire form. I could potentially overwrite `wpWidgets.save` & do something nutty there but that seems really drastic. **Solution** After some hacking based upon One Trick Pony's idea, here's what I ended up with.               <script>     jQuery(document).ready(function($){         if(parseInt("<?php echo $this->number; ?>", 10)) {             $("[id$='<?php echo $this->id; ?>'] .tabs").tabs();         }     });     </script>      Basically I just send down some JS w/ some Widgets values hardcoded in & do some checks & fun CSS3 selectors to find the right DOM nodes.


Show Custom Taxonomy Categories, Listing of Posts, and Single Post via AJAX

I need to be able to do the following:   * List all terms in a custom taxonomy (categories for custom post type)   * When a user clicks on a category, a listing of all posts in that category appears   * When a user clicks on a post, that individual post content appears This needs to be done via AJAX in order for all of this to happen on one page, I just don't know how to do it. I've searched here and other site but haven't found a solution so any help will be greatly appreciated. Thanks!


disable permalink on custom post type

I have created a custom post type, but I do not want it to have a permalink. By default, after entering post title, it creates a perma link. I do not them to be generated. From my reading, it is said that custom post type, will have a permalink and there is no way of disabling it. Is there a way that I can prevent the ajax call that receives the perma link.


Creating a custom public user page

I'd like to develop a plugin that allows me to have custom user pages. I really like the way the author archive template handles the URL: /author/username. I don't want to rewrite the `author_base` as I'd like to keep that functionality in place untouched. I'd like to replicate that clean URL layout in my plugin, so that when a user goes to /users/username it will go to my custom template. I'd like to know if anyone has examples of how to properly parse the username from the URL so that I can lookup the user's data from the plugin and display my template.


Calling a custom profile field only it it exists

I've used this code to show custom fields if they're filled in a post using Custom Field Suite Plugin               <?php if($cfs->get('whatliked')){?>     <?php echo $cfs->get('whatliked'); ?>     <?php   }?>      Now I need to have the same check for some custom profile fields I've added through functions.php               /* BEGIN Custom User Contact Info */      function extra_contact_info($contactmethods) {          unset($contactmethods['aim']);          unset($contactmethods['yim']);          unset($contactmethods['jabber']);          $contactmethods['facebook'] = 'Facebook';          $contactmethods['twitter'] = 'Twitter';          $contactmethods['google+'] = 'Google+';          $contactmethods['linkedin'] = 'LinkedIn';          return $contactmethods;      }      add_filter('user_contactmethods', 'extra_contact_info');      /* END Custom User Contact Info */      What is the code I need to add to my author.php to check if the facebook field has been filled and if "yes" then show and if "no" then hide... P.s. Is there a way to post the code with linebreaks already in???


Uploading Full Size Image vs Resizing Before Upload

I was wondering what you guys recommend when it comes to uploading photos. I have a bunch of high resolution photos that are being displayed in a slider. I set up the slider to show about 300x200px images for faster loading times. However, I am wondering whether to just to upload a truer dimension to the original size (say, around 1200x800), and then let Wordpress resize it for the sliders. The main benefit I can think of is that my images will be more appealing in Google image searches, since a 1200x800 will be clicked more than a 300x200px. The main downside I can think of would be relying on Wordpress's resizing algorithim, which could be less efficient than resizing it myself. Each page has around 15 images being shown, so if Wordpress does a bad job of resizing the pictures, the load times may suffer badly. What do you do when uploading images?


Use of Bootstrap nav in a page

First, take into consideration that I have limited web development knowledge. I tried to insert into a page, a Bootstrap nav component. I added the bootstrap folder in my theme folder, loaded the scripts and styles with wp_enqueue_script and wp_enqueue_style and added some HTML inside my page.

         Menus

Se connecter

Tableau de bord

      All was fine, it looked good : It looked fine But when I try to add a dropdown menu, there's is weird shift in the nav. Here's the code

Menus

Se connecter

Tableau de bord

         Ajout d'images

Grandes photos

Galeries

Archive de photos

      Doesn't look good There are 20-ish pixels between the line and the tabs. I should tell you that I use a theme named Meola developed by Elmastudio. Maybe that's what messing the nav but I tried to load my page without their CSS and while it seemed less wide, there was still a shift. (Sorry for my english, I'm not an native English speaker. And thanks to the person that can display my images in this post (I don't have the 10 reps to do so).)


Get users from all/specific blog by user_role and current_user role

Something I've needed and think a fair few people might need as well is: getting users from all or a specific blog based on the user_role's of the accounts they wish to see, while also differentiating between the request coming from a super-admin or blog-administrator. How do you go about this?


Custom excerpt_more filter not working when <!--more--> tag is present

I'm doing this inside Thesis 2, in case that matters. I am using `the_excerpt();` on my blog page to get the posts. And I'm using two custom filters:               function custom_excerpt_length( $length ) {         if (is_page(5)){         return 19;         } else{         return 120;          }     }     add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );          function new_excerpt_more($more) {         global $post;         return '... ID) . '">more';     }     add_filter('excerpt_more', 'new_excerpt_more');      The custom excerpt_more runs correctly unless there is a `<!--more-->` tag in the post. In that case, it displays the post up to that point, rather than the 120 word length set above (which is what I like) BUT... it doesn't display the custom excerpt_more and I don't know why. Any help would be much appreciated.


Facebook and Twitter share buttons not working

I have jetpack enabled on wordpress 3.4.2 install. However the Facebook and Twitter share buttons don't work. Whenever one clicks on the Facebook or the Twitter button, a new window pops- up with the same page and the share=facebook at the end of the URL Here is the blog with the issue: http://karba.la


How to include and handle more or less static text blocks/columns in a template

I have a front-page.php template, which contains dynamic content pulled from custom post types (like dates and quotes) but also more or less static text blocks in several sections alongside. The text block sections look roughly like that: ![static text blocks](http://i.stack.imgur.com/0jmxN.png) On mobile viewports the text blocks are stacked beneath each other; on desktop viewports they are next to each other. The text in these parts won't change much over time or probably not at all. Right now i am uncertain how to include those text blocks into the sections. The alternatives which came to my mind:   1. I hardcode the text and its markup directly into the front-page.php   2. I create a page for the text content of each section inside the backend. I copy and paste the text and its markup in the wysiwyg editor and then include each page in the appropriate front-page.php section.   3. I create a custom post type for each section and then create three posts - one for each column/textblock.   4. I create a custom post type for the more or less static content. Each section gets a post. In each post is a single wysiwyg field where i paste text and markup like in alternativ b). Or is there a even more solid and recommendable solution? So far i tend to alternative d. Best regards Ralf


How to create multiple version of single post

I am willing to create 2 pages for selected posts I have written. One in English language and another is in Hindi. **Why not translator ?** Translator translates many words in typical Hindi which makes a topic unclear to understand(even by myself). I want to keep combination of both Hindi & English words.


Submitting post to database then redirecting to paypal

I am trying to submit form data to the database then send the client over to paypal which will use IPN to send a response back. Right now I have the form submitting to the database, I have the IPN working, my problem is the redirecting part. I want it all to be done in with the click of one button... My form just submits back to the current page where it validates data and adds to the database. I can't seem to use header because data is already sent to the header. What are my options/solutions. Simplest solution would be best but I'm open to anything at this point. For such a simple task you would think there would be a simple solution... Here's my code that prints out the form:               function display_form() { ?>
                 <form action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" method="post">
                         <?php                          if ( $_POST['culis_add_listing'] == 'Y' && $this->no_errors()) {                              $this->addto_db();                             ?>
<button type="button" class="close" data-dismiss="alert">x</button> <?php _e('Thank You, your company will be listed as soon as payment is processed.')?>
<?php                          }                              if ( $_POST['culis_add_listing'] == 'Y' && !$this->no_errors()) {                              $this->prepare_fields('saved');                          }                          else {                             $this->prepare_fields();                         }?>

                           <button class="btn btn-primary" type="submit" name="culis_add_listing" value="Y">Submit</button>                         <button class="btn" type="submit" name="form_reset" value="Y">Clear</button>
                 </form>
         <?php          }      Update: Here is an example of what I'm trying to do http://stackoverflow.com/a/6753281/1445460


Text widget form and URL variables

I have an HTML form that I dropped into my Wordpress text widget that connects to a third party service so I need the form variables to be exactly right for it to work. The form is using GET rather than POST. A select box I have is as follows:               <select name="a_mlsAreaMajor[]" id="IDX-a_mlsAreaMajor">         <option value="DALLAS NORTHEAST (18)">Dallas Northeast (18)</option>     </select>      In the URL after submitting the form, it shows something like this > a_mlsAreaMajor%5B%5D=DALLAS+NORTHEAST+%2818%29 I need the URL to read > a_mlsAreaMajor[]=DALLAS+NORTHEAST+(18) instead.. in order for the third party to process the form correctly. What am I doing wrong here?


Although rewrite engine is on, I get 404 not found on every page

My wordpress blog has encountered this issue about a week ago. Before that nothing was wrong with it. I got suspicious on web host provider, but they said many times that rewrite engine is on and it works properly. I ported all source code to my localhost and I have the same issue again. I cannot go to admin section, blogs, etc. I've read many posts here, but unfortunately gained no success! What has happened to my blog?               <IfModule mod_rewrite.c>      RewriteEngine On      .      .      .     </IfModule>        **EDIT 1:** RewriteEngine on RewriteRule ^/vorood/?$ /wp-login.php [QSA,L] Order allow,deny Deny from all Order allow,deny Deny from all Order allow,deny Deny from all Order allow,deny Deny from all Order allow,deny Deny from all               # Rules to disable directory browsing     Options -Indexes          <IfModule mod_rewrite.c>         RewriteEngine On              # Rules to protect wp-includes         RewriteRule ^wp-admin/includes/ - [F]         RewriteRule !^wp-includes/ - [S=3]         RewriteCond %{SCRIPT_FILENAME} !^(.*)wp-includes/ms-files.php         RewriteRule ^wp-includes/[^/]+\.php$ - [F]         RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F]         RewriteRule ^wp-includes/theme-compat/ - [F]              # Rules to prevent php execution in uploads         RewriteRule ^(.*)/uploads/(.*).php(.?) - [F]              # Rules to block unneeded HTTP methods         RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK) [NC]         RewriteRule ^(.*)$ - [F]              # Rules to block suspicious URIs         RewriteCond %{QUERY_STRING} \.\.\/ [NC,OR]         RewriteCond %{QUERY_STRING} ^.*\.(bash|git|hg|log|svn|swp|cvs) [NC,OR]         RewriteCond %{QUERY_STRING} etc/passwd [NC,OR]         RewriteCond %{QUERY_STRING} boot\.ini [NC,OR]         RewriteCond %{QUERY_STRING} ftp\:  [NC,OR]         RewriteCond %{QUERY_STRING} http\:  [NC,OR]         RewriteCond %{QUERY_STRING} https\:  [NC,OR]         RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]         RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [NC,OR]         RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(\[|\]|\(|\)|<|>|ê|"|;|\?|\*|=$).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*("|'|<|>|\|{||).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(%24&x).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(127\.0).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(request|concat|insert|union|declare).* [NC]         RewriteCond %{QUERY_STRING} !^loggedout=true         RewriteCond %{QUERY_STRING} !^action=rp         RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$         RewriteCond %{HTTP_REFERER} !^http://maps\.googleapis\.com(.*)$         RewriteRule ^(.*)$ - [F]              # Rules to help reduce spam         RewriteCond %{REQUEST_METHOD} POST         RewriteCond %{REQUEST_URI} ^(.*)wp-comments-post\.php*         RewriteCond %{HTTP_REFERER} !^(.*)mywebsite.com.*          RewriteCond %{HTTP_REFERER} !^http://jetpack\.wordpress\.com/jetpack-comment/ [OR]         RewriteCond %{HTTP_USER_AGENT} ^$         RewriteRule ^(.*)$ - [F]     </IfModule>        Let's consider that rewrite engine is not enabled in the host provider. I got the same result in my localhost. In localhost I have several other projects that use rewrite rules extensively. In wordpress I get `404 Not Found`


How to change a custom query into a standard loop?

I'm trying to modify how results are displayed in a post list that's currently controlled by the code below. However, it's not built in the WP_Query `while ( $the_query->have_posts() ) : $the_query->the_post();` style I'm accustomed to and have built a lot of shortcodes and loop styles around. How can I change the code below into a "regular" Wordpress loop that will allow me to use template tags like the_title()?                   $totalposts = $wpdb->get_results($querystr, OBJECT);         $wp_query->request = $querystr . " LIMIT " . $ppp . " OFFSET " .$offset;         $results = $wpdb->get_results($wp_query->request, OBJECT);         foreach ($results as $result) {             $offset++;             $output .= 'ID).'">' . $result->post_title . ' (' . $result->post_date . ')
';         }


Optimizing wordpress database calls bloginfo

In my theme I have various calls to the blog properties, like `bloginfo('description')`, `bloginfo('name')`, `bloginfo('charset')` and possibly the same one is called more than once. Does wordpress actually do a database query each time I do `bloginfo()`? Is there a recommended way to optimise these calls so that they are done only once to get the same information (or better still, done once in the beginning with one SQL query)? I am trying to optimise the speed of my wordpress site and one of the reasons I suspect its still a few seconds slow is database queries. I have W3 Total Cache installed with Object Caching enabled and minification etc. but I can't seem to get the site under 5 seconds (I am referring to the HTML only here not the images or JS to load which takes up to 15 seconds)


How to disable pagination (next/previous links) on post type archive?

How can I remove the next and previous links in a custom post type archive page, but only for that post type? I know I could wrap any function in `if ( get_post_type($post) == 'myposttype' ) {}` but I can't find a solid snippet to remove the pagination. I have tried a few solutions, this being one of them, but nothing is working. And yes, I did try removing them from my template. :) ![next page link](http://i.stack.imgur.com/4fbyc.png)


pre_get_posts works in post type archive but not in single post

I have a custom post type "Scholars" that has an archive. I want to sort by a custom meta field called "year", I'm doing this with `pre_get_posts`:               add_action('pre_get_posts', 'my_queries');     function my_queries($query)     {       if (!$query->is_main_query()) return;            if ($query->query['post_type'] == 'scholars') {         $query->set('posts_per_page', -1);         $query->set('meta_key', 'year');         $query->set('orderby', 'meta_value');       }     }      This works fine in the archive page (the main listing), but the `next_post_link` and `previous_post_link` are not in sync in the single post. They are still sorted by date and not by custom "year". I have a custom query on the single page using `WP_Query` to show related posts, but I tried removing it and still does not work. This is the archive page:
       <?php         if (have_posts()) {           while (have_posts()) {             the_post();             // this just loads an
             get_template_part('content', 'scholars');           }         } else {           echo '
Nothing found.
';         }       ?>
      And this is the single page:               <?php the_post() ?>
                <?php previous_post_link() ?>
<?php the_title() ?>
         <?php next_post_link() ?>

       <img src="<?php the_field('photo') ?>" alt="" />
<?php the_field('year') ?> Scholar

      Any ideas why it won't work? **Edit:** After looking at other related answers seems like this is not possible with the built-in function out of the box, found this plugin but I'm open to any solution. **Edit:** Pfff, it doesn't even work with that plugin, don't know what the issue is:               next_post_link_plus('meta_key=year&order_by=numeric')


Is it possible to have screenshots in any other section rather than the screenshots section?

At WordPress.org plugin, is it possible to have screenshots in any other section rather than the screenshots section? For example. Can I create a section called "Manual" and then have some screenshots there?


Create Landing Page With Login or Subscribe Form

I am trying to create a landing page with a subscribe or register/login form that does the following:   * Redirects new users to a different page after registering (or subscribing),   * Redirects returning users to page after login (or after re-entering their email address),   * Automatically subscribes users to my mailchimp rss list. I am using the plugin MailChimp for WP right now and it redirects new subscribers to a new page but not returning ones. Is there a way I can do this with this plugin? If not, what plugin(s) can I use to make all of these things happen? I need to have this landing page finished by Saturday 8/10/13.


how can I change the background color of all posts on my server?

The default for the theme I'm using is to have a white background for any post (the part with the text, not the background that forms the border around it) on my wordpress installation. Is there a way I can set the the background for all pages in one shot. I've tried adding the following css:               p     {         background: #91C3C1;     }      but it only changes the background color for the paragraphs. What element should I be changing? (in this case I'm using the "Responsive" theme from CyberChimps)


If more than 1 image show post link?

I have an image gallery of sorts its displayed on the page using the following template code...                <?php             $featured = get_post_meta($post->ID,'_thumbnail_id',true);             $attachments = get_children( 'post_type=attachment&orderby=menu_order&exclude='.$featured.'&post_mime_type=image&post_parent='.$post->ID ); ?>
            <?php foreach ($attachments as $attachment) {                  $img = wp_get_attachment_image_src($attachment->ID);         $img_large = wp_get_attachment_image_src($attachment->ID, 'full'); ?>
<a rel="example" href="<?php the_permalink() ?>"><img class="fac-img" src="<?php echo $img[0] ?>" width="<?php echo $img[1] ?>" height="<?php echo $img[2] ?>" />
            <?php } ?>
      The image linking to the main single page of the post. Now is there any way that one there is only 1 image attached it doesn't show the link? So you attach one image to the post it shows it on its own. If however, you upload more than one image it adds the link around that image a long with link text 'click to view more images' or whatever. Clicking that takes you to a new single.php page where all the images are there running a gallery js script which is already done. Possible or not? Thank you for any help.


How to remove header image in Twenty Eleven theme?

Please give me details on how to remove the custom header image in the Twenty Eleven theme.


Why is my working Custom Taxonomy not in get_taxonomies array?

I've created a custom taxonomy. It's working just as expected, aside from it is not showing in the `get_taxonomies` array. `get_terms` function returns an `invalid taxonomy` error. I want to use `get_terms` to loop through the Double India Pale Ales and print each name for a select box. Here is the code used to register it.               add_action( 'init', 'double_ipa_init' );          function double_ipa_init()  {         register_taxonomy(             'double-ipa',             array (                 0 => 'post',                 1 => 'page',             ),             array(                 'hierarchical' => true,                 'label' => 'Double IPAs',                 'show_ui' => true,                 'query_var' => true,                 'rewrite' => array(                     'slug' => 'double-ipa'                 ),             'singular_label' => 'Double IPA'             )         );     }      This code is in a plugin, and is on Multisite. Thanks in advance for your help.


404 on pagination but with a strange twist (error 404 only when there is single post on the second page)

I have a weird problem I'm having hard time understanding. Pagination gives me error 404 when I click page #3 when there is only 1 post on that page. If I add 1 more so that on page #3 there are minimum 2 posts error goes away! Any way to diagnose this issue? My code is this:                               //default values                     if ( !isset ($_POST['lolpp']) ) { $listing_order_logic_perpage = 'date'; }                     if ( !isset ($_POST['lopp']) ) { $listing_order_perpage = 'DESC'; }                     if ( !isset ($_POST['lpp']) ) { $listing_per_page = 6; }                 ?>

                          <?php                             //calculating offset depending on number of featured listing, lets create variable first                             $count_featured_offset = 0;                                   //featured listing loop                         query_posts( 'order=DESC&orderby=date&posts_per_page=2&post_type=post&cat='.$current_category_id.'&meta_key=featured&meta_value=yes' );                         if ( have_posts() ) : while ( have_posts() ) : the_post();                         //lets save ID of listing which is featured to later exclude it from normal loop                         $do_not_duplicate[] = $post->ID;                     ?>

                                                        <a href="<?php the_permalink(); ?>">                                                 <?php                                                      if ( has_post_thumbnail() ) {                                                         echo get_the_post_thumbnail($post->ID, 'thumbnail', array('alt' => the_title('','',false), 'title' => get_the_excerpt(), 'class' => 'primarythumb' ));                                                     } else {                                                         echo '';                                                 } ?>
<a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?>
                                              <?php                                           echo "
".__(get_post_meta($post->ID, 'Address', true))."
";                                           echo ''.get_post_meta($post->ID, 'Phone', true).'';                                                  $link = get_post_meta($post->ID, 'url', true);                                                  if ( $link ) {                                               echo ''.__('Official Website','holidayge').'';                                             } else {                                               echo ''.__('Official Website','holidayge').'';                                             }                                         ?>
<?php echo trim(strip_tags($post->post_excerpt)); ?>

                                                                 <?php echo ( wp_gdsr_rating_article()->votes ); ?> <?php _e('users rated','holidayge'); ?>
<?php if(function_exists('wp_gdsr_render_article')){ wp_gdsr_render_article();}?>

                                                                 <?php _e('Number of reviews','holidayge'); ?>                                                                 <a href="<?php echo get_permalink();?>#comments"><?php comments_number( '0', '1', '%' ); ?>

                          <?php                             //increment featured count offset variable                             $count_featured_offset++;                              endwhile;                          endif;                     ?>                          <?php wp_reset_query(); ?>                                         <?php                         //here we calculate correct offset depending on number of featured listings 2 1 0                         $listing_per_page = $listing_per_page - $count_featured_offset;                              //count to insert ads after nth post, 5th place in this example                         $adspostnum = 1;                         $adsshowpos = 1;                              //normal listing loop                         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                         query_posts( array( 'order' => $listing_order_perpage, 'orderby' => $listing_order_logic_perpage, 'posts_per_page' => $listing_per_page, 'post_type' => 'post', 'cat' => $current_category_id, 'post__not_in' => $do_not_duplicate, 'paged' => $paged ) );                         if ( have_posts() ) : while ( have_posts() ) : the_post();                     ?>
                                                  <a href="<?php the_permalink(); ?>">                                                     <?php                                                          if ( has_post_thumbnail() ) {                                                             echo get_the_post_thumbnail($post->ID, 'thumbnail', array('alt' => the_title('','',false), 'title' => get_the_excerpt(), 'class' => 'primarythumb' ));                                                         } else {                                                             echo '';                                                     } ?>
<a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?>
                                                  <?php                                               echo "
".__(get_post_meta($post->ID, 'Address', true))."
";                                               echo ''.get_post_meta($post->ID, 'Phone', true).'';                                                      $link = get_post_meta($post->ID, 'url', true);                                                      if ( $link ) {                                                   echo ''.__('Official Website','holidayge').'';                                                 } else {                                                   echo ''.__('Official Website','holidayge').'';                                                 }                                             ?>
<?php echo trim(strip_tags($post->post_excerpt)); ?>

                                                                     <?php echo ( wp_gdsr_rating_article()->votes ); ?> <?php _e('users rated','holidayge'); ?>
<?php if(function_exists('wp_gdsr_render_article')){ wp_gdsr_render_article();}?>

                                                                     <?php _e('Number of reviews','holidayge'); ?>                                                                     <a href="<?php echo get_permalink();?>#comments"><?php comments_number( '0', '1', '%' ); ?>

                          <?php                         //in betweeen listing advertising goes here                         if ( $adspostnum == $adsshowpos ) {                         ?>

              <?php //echo adrotate_block(2); ?>              <a href="<?php echo get_permalink( 11 ); ?>"><?php echo get_the_title( 11 ); ?>

                         <?php } $adspostnum++;                                        endwhile;                          endif;                     ?>

                <?php wp_pagenavi(); ?>


Pass get_option value to an array

I want to pass get_option value to an array value. This the value that I want to pass to the array.               <?php echo stripslashes(get_option('a')); ?>      and this is what I am trying to do.               <?php $var = array( 'foo' =>'echo stripslashes(get_option('a'));');      Please let me know how can I achieve this.


Sort X categories by last update and show image

I want to display X categories, and sort them by last update. I also want to grab the image of the latest post with the category.               <img src="<?php echo get_image('article_image',1,1,0,NULL,$res75); ?>" />      So, the category list will be displayed by images, with the corresponding category-name underneath. Sorted by last update. How would I go about doing that?


Getting URL of archive (category) page

I'm trying to retrieve the current URL of the page, which works everywhere except for archive pages, for example, a category page. On a category page, it shows as the most recent post in that category.               $this_id = $wp_the_query->get_queried_object_id();     $this_url = get_permalink($this_id);     echo $this_url; // Should show like: http://domain.com/blog/category      How do I retrieve the actual archive page URL?


Getting the ID of any image for use in functions.php

I've added two custom fields to attachments on my site, so the user can add a special image credit. I'm trying to write a function that looks to see if either of the custom fields are populated, and if so echoes the contents. The part I'm struggling with is getting the ID of the image into the function - it's simple enough for featured images using `get_post_thumbnail_id()` \- is there a similar way to get the ID for _any_ attached image? Here's what I have so far:                   function mat_image_credit() {              //this is the bit I'm struggling with:         $mat_image_id = wp_get_attachment_image( $attachment->ID );               //this is collecting the contents of the custom field and works fine         $mat_flickr_credit = slt_cf_field_value('flickr_credit', 'attachment', $mat_image_id);               $mat_custom_credit = slt_cf_field_value('custom_credit', 'attachment', $mat_image_id);              //and then this echoes out the contents depending on what we find...         if (!empty ( $mat_flickr_credit ) ) {              echo '
Image by ' . $mat_flickr_credit . '
';          } elseif ( !empty ( $mat_custom_credit ) ) {              echo '
Image by ' . $mat_custom_credit . '
';          };          }      Thanks!


Add a #hash to the links in my custom menu

I have created a static frontpage where I load in the content of all my pages. Now I have a normal custom menu, but the links refer to the pages, for example: http://mysite.com/about Now the I want to have the link directed to the page itself with http://mysite.com/#about. Now I have a custom walker that I use, and I have tried the following code:               $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( get_bloginfo('url').'#'.$item->title ) .'"' : '';      Now this works ok, except for the home link itself. The home links to http://mysite.com/#home, but that one just needs to link to http://mysite.com/# Is there something different I could use then `$item->title` to append. \-- If you want to know the method that I use to create the single page:   Creating the modern 'single page' html5 css3 layout in wordpress > =============== **_Update_** =================== Just wanted to tell you guys what i did, maybe it helps someone. Pages are structured like this:               Home      (public)  -> cutom menu item -> [link:#][label:home]     portfolio (private) -> cutom menu item -> [link:#portfolio][label:portfolio]     contact   (private) -> cutom menu item -> [link:#contact][label:contact]     blog      (public)  -> page menu item  -> [link:blog][label:blog]      Home and blog will be indexed and visible. portfolio and contact are loaded in home which is a front_page.php. Note that I use _relative links_ , and not absolute, html output will be href="#contact". Now having it like this will conflict on the blog page, the links will become http://mysite.com/blog/#contact. We don't want that, we want just http://mysite.com/#contact In my default walker I am going to edit edit in the absolute path. I do it here just to make the template a little more dynamic.               if($item->object == 'custom'){         $attributes .= ! empty( $item->url ) ? ' href="' .         esc_attr(get_bloginfo('url').'/'.$item->url ) .'"' : '';     }else{         $attributes .= ! empty( $item->url ) ? ' href="' .          esc_attr( $item->url ) .'"' : '';     }      Source to the complete walker can be found here: Menu items description? Now the next thing is 1) to have a nice scroll effect (jquery scrollto) when the links are clicked on the frontpage 2) be redirected to the blog when the blog link is clicked 3) be redirected back to the right section when a hashlink is clicked on the blogpage. Script for jQuery               $(document).ready(function() {       $('.menu-item-object-custom a').bind('click', function(e) {         e.preventDefault();         var parts = ($(this).attr("href")).split("#");         var target = '#' + parts[1];              if($('body.home').length){           var moveto = $(target).length ? $(target).offset().top : 0;           $('html, body').stop().animate({ scrollTop: moveto }, 1500, function() {             location.hash = target;           });           return false;         }else{             window.location = $(this).attr("href");         }       });     });      Note that the url in the browser is also changed, so the back button works also, and there is easy bookmarking. Thanks for all the suggestions and inspiration bellow!! And I hope someone can use this.


trying to list users & display first - last name

For some reason this is not working for me :(               $get_members = array(         'blog_id' => $GLOBALS['blog_id'],         'role' => 'sm_flagar',     );          $blogusers = get_users($get_members);         foreach ($blogusers as $user) {             echo "
user_url."\">". $user->first_name ." ". $user->last_name ."
";         }


Wrap Featured Image in a Link

I want to wrap a link around a featured image (only if the custom meta box has been filled in), the link will come from a custom meta box. Here's my image code: `the_post_thumbnail('screenshot');` Here's my code for displaying the link using text:               <?php //Only if $urllink is filled in, display this link. ?>       <?php $urlbox = get_url_desc_box();         if ( !empty( $urlbox[0] ) ) {           echo sprintf( 'Visit Website »', $urlbox[0] );     } ?>      I've tried a few ways to get this to work but can't figure it out. Any help would be greatly appreciated.


WP MS: How to query over the network

I have a WP 3.8.1 Multisite installation with 3 blogs, they're all in one db, prefixed `wp_`, `wp_2_` and `wp_3_`. In a template in `wp_` I try to to display all posts from `wp_`, `wp_2_` and `wp_3_` which have a category _xxx_ attached. I want to display the posts chronologically. I tried this query:               SELECT *      FROM $wpdb->posts         INNER JOIN $wpdb->term_relationships ON $wpdb->posts.ID= $wpdb->term_relationships.object_id         INNER JOIN $wpdb->term_taxonomy ON $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id         INNER JOIN $wpdb->terms ON $wpdb->term_taxonomy.term_id=$wpdb->terms.term_id WHERE $wpdb->terms.name = 'xxx'     ORDER BY $wpdb->posts.post_date DESC      This works only for the current blog, ie it doesn't include `wp_2_` and `wp_3_`. How do I retrieve all posts with category _xxx_ from `wp_`, `wp_2_`, `wp_3_` (instead of only `wp_`)?


How to display a feature only if custom field value is set?

What i'm trying to do here is to modify the existing wp-postratings plugin. The function to display the ratings is:               <?php if(function_exists('the_ratings')) { the_ratings(); } ?>      However, the above code displays the ratings on every post. What would be the conditional statement to add such that if a post has a custom field with name/value as ratings/yes This way, based on the conditional statement, the ratings would be displayed only on posts where the custom field has the ratings/yes added.


Getting index.php instead single.php for displaying posts

I'm (locally) building a custom theme. So far I have:   * index.php   * single.php   * page.php   * custom page template called about-page.php   * two different headers: one for default use and one for the single.php NO functions.php; NO custom taxonomy; Permalink settings > Common settings : default My index.php has a list of posts (all of those belonging to a specified category), when I click on one of those posts I end to the index.php BUT with the right custom header (header I created for the posts, it's called header- single.php). **So, I'm getting the index.php istead of the single.php** I read around other people had the same problem with the word "year" or some other Reserved Terms. I don't think it's my case. In my home page I have:               <?php     /**      * Template Name: Front Page Template      */     get_header(); ?>
                 <?php                     $lastposts = get_posts('numberposts=20&orderby=date&cat=9');                     foreach($lastposts as $post) :                     setup_postdata($post);                     ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a
                     <?php endforeach; ?>
          <?php get_footer(); ?>      EDIT Here's the structure of my single.php               <?php     /*      Template Name: Single project       */     get_header(); ?>
        //something

         READ

             CLOSE

             <?php the_content(); ?>

     <?php get_footer(); ?>      Looking forward for some clues!   Thank you very much!   Best,   L


Gettind 404 not found wen click the view button for a given category custom post type portfolio

I have created a custom post type portfolio and custom categories. Everything is working fine as expected however when I click into the custom post types categories and click the view button for a given category the page that comes up isn't listing the results eror 404. For example, if the post type is "portfolio" and the category is "web-design" When I click the view button for this category I would suspect to see a page with all the web-design post... Not sure what I am doing wrong here. Code generate with http://generatewp.com/                // Register Custom Post Type      function portfolio_post_type() {               $labels = array(         'name'                => _x( 'Portfolios', 'Post Type General Name', 'owd' ),         'singular_name'       => _x( 'Portfolio', 'Post Type Singular Name', 'owd' ),         'menu_name'           => __( 'Portfolio', 'owd' ),         'parent_item_colon'   => __( 'Parent Portfolio:', 'owd' ),         'all_items'           => __( 'All Portfolios', 'owd' ),         'view_item'           => __( 'View Portfolio', 'owd' ),         'add_new_item'        => __( 'Add New Portfolio', 'owd' ),         'add_new'             => __( 'New Portfolio', 'owd' ),         'edit_item'           => __( 'Edit Portfolio', 'owd' ),         'update_item'         => __( 'Update Portfolio', 'owd' ),         'search_items'        => __( 'Search portfolios', 'owd' ),         'not_found'           => __( 'No portfolios found', 'owd' ),         'not_found_in_trash'  => __( 'No portfolios found in Trash', 'owd' ),     );     $args = array(         'label'               => __( 'portfolio', 'owd' ),         'description'         => __( 'Portfolio information pages', 'owd' ),         'labels'              => $labels,         'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'custom-fields', ),         'hierarchical'        => true,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => get_stylesheet_directory_uri() . '/images/portfolio.png',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'page',     );     register_post_type( 'portfolio', $args );     flush_rewrite_rules();     // http://dreamdare.org/tips-tricks/how-to-fix-wordpress-custom-post-type-permalink-404-error/      } add_action( 'init', 'portfolio_post_type', 0 ); // Register Custom Taxonomy function custom_taxonomy_portfolio() {               $labels = array(         'name'                       => _x( 'Portfolio Categories', 'Taxonomy General Name', 'owd' ),         'singular_name'              => _x( 'Portfolio Category', 'Taxonomy Singular Name', 'owd' ),         'menu_name'                  => __( 'Portfolio Category', 'owd' ),         'all_items'                  => __( 'All Portfolio Category', 'owd' ),         'parent_item'                => __( 'Portfolio Category', 'owd' ),         'parent_item_colon'          => __( 'Parent Portfolio Category:', 'owd' ),         'new_item_name'              => __( 'New Portfolio Category', 'owd' ),         'add_new_item'               => __( 'Add Portfolio Category', 'owd' ),         'edit_item'                  => __( 'Edit Portfolio Category', 'owd' ),         'update_item'                => __( 'Update Portfolio Category', 'owd' ),         'separate_items_with_commas' => __( 'Separate portfolio categories with commas', 'owd' ),         'search_items'               => __( 'Search Portfolio Category', 'owd' ),         'add_or_remove_items'        => __( 'Add or remove Portfolio Category', 'owd' ),         'choose_from_most_used'      => __( 'Choose from the most used portfolio category', 'owd' ),         'not_found'                  => __( 'Not Found Portfolio Category', 'owd' ),     );     $rewrite = array(         'slug'                       => 'portfolio',         'with_front'                 => false,         'hierarchical'               => true,     );     $capabilities = array(         'manage_terms'               => 'manage_categories',         'edit_terms'                 => 'manage_categories',         'delete_terms'               => 'manage_categories',         'assign_terms'               => 'edit_posts',     );     $args = array(         'labels'                     => $labels,         'hierarchical'               => true,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,         'rewrite'                    => $rewrite,         'capabilities'               => $capabilities,     );     register_taxonomy( 'portfolio_category', array( 'portfolio' ), $args );      } // Hook into the 'init' action add_action( 'init', 'custom_taxonomy_portfolio', 0 ); I have archive-portfolio.php and taxonomy-portfolio_category.php


Show Twitter followers count snippets don't work

No matter what I try I can't seem to get the code snippets to work that will display the number of followers of Twitter. I tried various ones as the Plugin I'm using is not showing the Twitter number at all, so I need to look for alternatives. When I tried this snippet, for example, I got the following error message: http://pastebin.com/iif9g35a Anybody any idea what's going wrong here? I think it's strange that the "Suscribers to text" plugin doesn't display the number of followres to begin with - otherwise I wouldn't have to look for alternatives.


Redirect current user to their most recent custom post

Is there a way that, if a user tries to access a particular page, they are redirected to their most recent post (In a custom post type)? Or, if the user has no posts, redirect them to the homepage?


register_post_type not working in wordpress 3.6

I am using WP3.6 and am having trouble adding a new post type. I have put echo statements in the code and know that a) the function calling register_post_type gets called b) the post type name i am using does not exist c) register_post_type returns an object with all the values I specified But at the end of it all, nothing happens. No UI is added. Nothing seems to gets registered. Below is my entire code:               function responsive_custom_init_as() {       $labels = array(         'name' => 'Products',         'singular_name' => 'Product',         'add_new' => 'Add New',         'add_new_item' => 'Add New Product',         'edit_item' => 'Edit Product',         'new_item' => 'New Product',         'all_items' => 'All Products',         'view_item' => 'View Product',         'search_items' => 'Search Products',         'not_found' =>  'No products found',         'not_found_in_trash' => 'No products found in Trash',          'parent_item_colon' => '',         'menu_name' => 'Products'       );            $args = array(         'label' => 'Products',         'labels' => $labels,         'description' => 'Products imported from 1shoppingcart.com',         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => 'product',         'rewrite' => array( 'slug' => 'products', 'with_front' => false ),         'capability_type' => array('onesc_product', 'onesc_products'),         'capabilities' => array('edit_onesc_products' => false, 'publish_onesc_products' => true, 'read_private_onesc_products' => true),         'has_archive' => false,          'hierarchical' => false,         'menu_position' => 5,         'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),         'map_meta_cap' => true,         'register_meta_box_cb' => 'add_onesc_meta_boxes_as'       );             register_post_type('onesc_product', $args);     }          function add_onesc_meta_boxes_as() {       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_id', 'Id'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_visibleid','Visible Id'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_sku', 'SKU'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_price', 'Price'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_isfeatured', 'Is Featured', 'checkbox'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_usesaleprice', 'Use Sale Price', 'checkbox'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_saleprice', 'Sale Price'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_isactive', 'Is Active', 'checkbox'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_hairtype', 'Hair Type'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_length', 'Length'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_style', 'Style'));       add_meta_box('1sc_product_details', 'Product Details', 'responsive_add_field_as', 'onesc_product', 'normal', 'default', array('1sc_color', 'Color'));     }          function responsive_add_field_as($post, $customid, $customlbl, $type='text'){       $value = get_post_meta($post->ID, $customid, true);       echo '<label for="'.$customid.'">'.$customlbl.'</label> ';       echo '<input type="'.$type.'" id="'.$customid.'" name="'.$customid.'" value="'.esc_attr($value).'" size="25" />';     }          add_action( 'init', 'responsive_custom_init_as' );      Any ideas?


Custom field drop down to set the term of the post when published

In my functions.php i'm trying to check if the user has selected a value in a custom field drop down and then set that value as the term of the post when it's published. I'm using the following function but it doesn't seem to work. Although if i select a term from the custom taxonomy check list and publish the post the term doesn't get saved. So i guess i'm close? No?               function artist_term_save( $post_ID ){              // Bail if we're doing an auto save         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;              //check if they selected your state term         $artist = isset($_POST['magicfields[shop_artist][1][1]']) ? $_POST['magicfields[shop_artist][1][1]'] : ''; //make sure of what the input name is here...              //insert post meta         wp_set_object_terms($post_ID, $artist, 'byartist');     }      Note: magicfields[shop_artist][1][1] is the name of the select drop down in the HTML.


Changing the wp-config.php broke the site

I added the lines `define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );` and `define( 'WP_CONTENT_URL', 'example/blog/wp- content';);` in my wp-config.php and then my site broke. Even some of the widgets on the backend do not appear anymore. I immediately removed the above lines from the `wp-config.php` however that did not change anything. PLEASE HELP


Create dropdown list post

I want to create a drop down list that will list all the posts in the category. I want the drop down list to appear on every post. So for example if I view a post that belongs to category Apples it should list all posts in category Apples


What's the proper WordPress URL for the template of my custom taxonomy?

I have a CPT called "books", a custom taxonomy called "book" for this CPT, and a "taxonomy-books.php" template in which I display my "books" terms using get_terms(). I don't understand (yes, I googled the problem) how to visit the page attached to this template. For one, "www.my_site.com/books/" doesn't work (page not found). Here's how I defined my custon taxonomy:               $labels = array(         'name'                          => 'Books',         'singular_name'                 => 'Book',         'search_items'                  => 'Search Books',         'popular_items'                 => 'Popular Books',         'all_items'                     => 'All Books',         'parent_item'                   => 'Parent Book',         'edit_item'                     => 'Edit Book',         'update_item'                   => 'Update Book',         'add_new_item'                  => 'Add New Book',         'new_item_name'                 => 'New Book',         'separate_items_with_commas'    => 'Separate Books with commas',         'add_or_remove_items'           => 'Add or remove Books',         'choose_from_most_used'         => 'Choose from most used Books'         );          $args = array(         'label'                         => 'Books',         'labels'                        => $labels,         'public'                        => true,         'hierarchical'                  => true,         'show_ui'                       => true,         'show_in_nav_menus'             => true,         'args'                          => array( 'orderby' => 'term_order' ),         'rewrite'                       => array( 'slug' => 'books', 'with_front' => false ),         'query_var'                     => true     );          register_taxonomy( 'books', 'book', $args );      So articles online made me think that the "rewrite" line was in cause, I removed it and it's the same.


Cannot display default template after switching to custom

I'm having a strange issue with a page. The site has a Default Template (page.php) and several custom templates. A page was created using a custom template (page-services.php), but then later switched to use the Default Template (all via Admin Page Attributes). However, the page's front end continues to pull the custom template instead of the selected Defaul Template. The back end is correct (there are different custom fields depending on the template). The edit page view shows the correct custom fields for the template selected. I can't think of any other details that might be relevant.


RSS Subscriber count

I'm looking to retrieve an RSS Subscription count. How do I return the number of subscribers without use of Feedburner or use of a plugin?


save_post + insert_post = infinite loop

I'm trying to automatically create a new post when a post containing a certain custom field is saved - hooking an insert_post function into save_post. This generates an infinite loop. I found some answers to this problem, suggesting I should check the post type before inserting. However, the following code still gives an infinite loop, any ideas?               add_action('save_post', 'createGallery');          function createGallery () {         global $post;         if ( $post->post_type == 'activity' ) {             $gallerypost = array(                 'post_content' => 'the text of the post',                 'post_status' => 'publish',                  'post_title' => 'Photo album',                  'post_type' => 'post',                  'post_author' => 1);               wp_insert_post( $gallerypost );         }     }


Storing Dropbox Authentication?

I am trying to create a Wordpress plugin that exports each blog post to my dropbox folder. The code is below but I have a problem. If I run this code outside Wordpress, it works perfectly. The table is created and my token is stored. If I use a different browser it works perfectly...no authentication because it reads from the DB. My problem is that when I put this into my plugin, the table is not created at all. So if I go to a different browser, I have to re-authenticate. Help please. Code:               /*      * Copyright 2012 Erin Dalzell.      *      */          require_once('Dropbox/API.php');     require_once('Dropbox/Exception.php');     require_once('Dropbox/OAuth/Consumer/ConsumerAbstract.php');     require_once('Dropbox/OAuth/Consumer/Curl.php');     require_once('Dropbox/OAuth/Storage/Encrypter.php');     require_once('Dropbox/OAuth/Storage/StorageInterface.php');     require_once('Dropbox/OAuth/Storage/Session.php');     require_once('Dropbox/OAuth/Storage/Filesystem.php');     require_once('Dropbox/OAuth/Storage/PDO.php');          include ABSPATH . '/wp-config.php';          function etd_initialize() {          global $current_user;              // Set your consumer key, secret and callback URL         // should be in the settings         $key      = 'xxxxx';         $secret   = 'yyyyy';         $current_user = wp_get_current_user();              // Check whether to use HTTPS and set the callback URL         $protocol = (!empty($_SERVER['HTTPS'])) ? 'https' : 'http';         $callback = $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];                   // Instantiate the Encrypter and storage objects         $encrypter = new \Dropbox\OAuth\Storage\Encrypter('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');              // Instantiate the database data store and connect         $storage = new \Dropbox\OAuth\Storage\PDO($encrypter, 1);         $storage->connect(DB_HOST, DB_NAME, DB_USER, DB_PASSWORD);              $storage = new \Dropbox\OAuth\Storage\Session($encrypter);              $OAuth = new \Dropbox\OAuth\Consumer\Curl($key, $secret, $storage, $callback);              $dropbox = new \Dropbox\API($OAuth);              return $dropbox;          }          function export_to_dropbox($id) {         $dropbox = etd_initialize();              $post = get_post($id);                   // Create a temporary file and write some data to it         $tmp = tempnam('/tmp','dropbox');         file_put_contents($tmp, $post->post_content);              // Upload the file with an alternative filename         $put = $dropbox->putFile($tmp, $post->post_title . '.md');              // Unlink the temporary file         unlink($tmp);     }          register_activation_hook( __FILE__, 'etd_initialize' );     add_action('publish_post', 'export_to_dropbox');     ?>


I keep getting 404 Error when I attempt to view blog in single view

I'm a newbie to Stack Exchange. Hoping to get some answers now and again and maybe help out as well. My question is, I have (2) blog posts, and for some reason the latest one gives me a 404 Error message when I try to view it. See for your self : http://dstac.headbentdesign.com/in-the-news/ I contacted the theme developer and all he did was select the "default" setting for the permalinks. I don't want the post ID, I want the /%postname%/ I hear it could be an .htacces issue, so I contacted my host, but they basically said it wasn't their problem. Good ol' Bluehost. Any ideas guys? Thank you


Post form as custom post

I'm new to WordPress and need to create a website including a special form, with which I can upload photos, set my position on an OpenStreetMap and choose from several dropdown menus. Here you can find an example of how it should look like: ![enter image description here](http://i.stack.imgur.com/IABAz.png) I already did this:   1. Created a page template with the form `<form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">`   2. Made the form submitable for users who are logged in (is this a secure solution?)                  <?php if ( 0 == $current_user->ID ) {                          wp_loginout();                           echo " to submit a post";                     } else {                       echo '<fieldset class="submit">                                 <input type="submit" value="Los" tabindex="40" id="submit" name="submit" />                             </fieldset>                             <input type="hidden" name="action" value="new_post" />';                             wp_nonce_field( "new-post" ); } ?>        3. When the form is submitted this php code is executed:              if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {             $new_post = array(                 'post_title'    =>  "roadkill entry",                 'post_content'  =>  "testcontent",                 'post_category' =>  array(0),                 'post_status'   =>  'publish',                 'post_type' =>  'roadkills' // this is my custom post   );              $pid = wp_insert_post($new_post);              $link = get_permalink( $pid );         wp_redirect( $link );     }      But I will end in an page not found. http://www.citizen- science.at/wordpress/roadkill/eintrag-hinzufugen/ When I create an entry via the admin GUI I am able to view the single post, but not the archive http://www.citizen-science.at/wordpress/roadkills/dafdf/ Oh yeah, here is how I am registering my post type:               <?php      add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'roadkills',             array(                 'labels' => array(                     'name' => __( 'Roadkills' ),                     'singular_name' => __( 'Roadkill' )                 ),             'public' => true,             'has_archive' => true,             )         );     }      What did I miss here? (I already got it working yesterday, but somehow it broke)


Echo a div to header.php from functions.php

Within the section of header.php I have a div structure

      ... I want to add a div within "branding" - I can do this easily be editing header.php directly. I also think that I can use functions.php to:               add_action('wp_head', 'add_div' );      ... and then echo in the code. Is there any way at all I can define where the code should be echoed though (i.e. tell the add_div function where it should add the code)?


Wordpress within specific sub-directories, implicitly not root

I have an existing application running at my website root now. Using .htaccess, would it be possible for a single Wordpress installation to manage sub-directories? For example, /press/, /careers/, /blog/ would be served by Wordpress. The problem is I don't want Wordpress to get served on the root. I suspect something tricky with permalinks and .htaccess. Option 2 for us here is building a CRUD into our app, but we really wanted to use Wordpress (for certain pages).


Can't seem to get an else statement correct?

I'm learning my ways in PHP lately and play allot with WP and PHP. I've created a some PHP that fetches some posts with the same 1th tag. This with some help with a tutorial here and there. The thing the tutorial is missing is a message when there is no tag attached to the post. Here is the code:               <?php $tags = wp_get_post_tags($post->ID); if ($tags) { ?>
Related
         <?php $first_tag = $tags[0]->term_id; $args=array(             'tag__in' => array($first_tag),             'post__not_in' => array($post->ID),             'posts_per_page'=>10,             'caller_get_posts'=>1         );?>
             <?php $my_query = new WP_Query($args); if($my_query->have_posts() ) {                 while ($my_query->have_posts()) : $my_query->the_post(); ?>

<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

             <?php endwhile; } wp_reset_query();         } ?>
      I thought this would be a solution:               <?php endwhile; else: echo('no tags'); } wp_reset_query(); } ?>      But it's not working, but to be honest... it doesn't seem right at all. I know it's pretty basic, but the if else ifelse while foreach.... sometimes I can't see the wood for the trees. Also I think the:
      is placed wrong. Thanks, /Paul


Publish and save specific postmeta to a filtered post_type

I have multiple plugins with different post_type(s). When I save or publish, all of the `custom_post_meta` that belong to one specific `post_type` are also saving. I'd like to filter by `post_type` so that the `custom_post_meta` will only save in a specific `post_type`. So my question is, if you have multiple plugins: **How do you save a specific postmeta** to a specific `post_type`? Would you just say:               if (post_type=="my_post_type") {       add_action('save_post','save_my_meta_box_to_postmeta');       add_action('publish_post','save_my_meta_box_to_postmeta');     }      And how do you **get** the `post_type` value?


Site does not display translations

I installed clean wordpress multisite. Bought a theme, installed woocommerce. Activated stuff, translated some and voila - everything is working. Translations and all. i then uplodaded all the same stuff to my isp. Did all the same things i did at my own computer - but translations are not displayed there. So i started googling things and Some of the posts mentioned that perhaps gettext is not working in the server. So i asked my isp and they said that they can confirm that php gettext is installed and working properly. So how can i test this though? What could be other problems that translations are not working? Alan


Wordpress class, using add_action to call member function does not work

I'm learning to create a WP plugin as a class. However, it seems the add_action doesn't work when calling my function; it works when using $this->init(). Example:                   class test     {              public $age = NULL;              public function __construct()         {             //register an activation hook             register_activation_hook( __FILE__, array( &$this, 'installplugin' ) );                  add_action('init', array( &$this, 'init' ) ); //this doesn't work             //$this->init(); //This WORKS!              }              function installplugin()         {                  add_option( 'age', 45 );             $this->init();                }              function init()         {                  $age = get_option( 'age' );             $this->age = $age;                        }              function printAge(  )         {             echo "The age is " . $this->age . "<br />";         }          }      So, after running:               $learnObj =  new learnable_test();          $learnObj->printAge();      It only prints: "The age is " But if I were t comment out the add_action('init',...) and use the $this->init(), that seems to work, printing "The age is 45" What am I missing?


Tinymce broken after update

I've found other posts related to this, but none had a answer to my issue. After updating to WP 3.4 my visual editor is broken. Firebug reports this error               Failed to load: http://xxxxxx.com/wp-includes/js/tinymce/langs/pt.js      wp-tin...9-20805 (linha 1) I've tried setting the theme to a default theme and it WORKS. So, is there any way I can determine what's causing this in order to fix it?


Edit the excerpt before it is shown

I'm looking for a way the edit the excerpt before it get's show on the page. The issue is this: We import data (jobs) for a third party provider and the content is divided in sections with each a header (e.g. the first one is "Introduction"). The issue now is that in the overview with the post, each excerpt looks like "Introduction. Lorem Ipsum". So I want to manipulate the data to remove "Introduction." Are there any hooks in WordPress that I can utilize to either edit the data before shown, or is there a function that I can overwrite that display's `the_excerpt()`? I'm using a child theme of a theme we bought and would prefer to not mess with the core files.


Wordpress search same results no matter what i type

I have strange problem with wordpress. No matter what i type in search box result's are always the same. Last published posts. Tried to disable all plugins, no effect. Here's my searchform.php               <form method="get" id="searchform" action="<?php  echo home_url(); ?>/">
         <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" autocomplete="off" />
     <input type="submit" id="searchsubmit" value="" />
      And my search.php               <?php get_header(); ?>     <?php         $sidebar = get_option(THEME_SHORT_NAME.'_search_archive_sidebar','no-sidebar');         $sidebar_class = '';         if( $sidebar == "left-sidebar" || $sidebar == "right-sidebar"){             $sidebar_class = "sidebar-included " . $sidebar;         }else if( $sidebar == "both-sidebar" ){             $sidebar_class = "both-sidebar-included";         }     ?>     <div class="content-wrapper <?php echo $sidebar_class; ?>">

             <?php                 $left_sidebar = "Search/Archive Left Sidebar";                 $right_sidebar = "Search/Archive Right Sidebar";                              $item_type = get_option(THEME_SHORT_NAME.'_search_archive_item_size', '1/1 Full Thumbnail');                 $num_excerpt = get_option(THEME_SHORT_NAME.'_search_archive_num_excerpt', 200);                 $full_content = get_option(THEME_SHORT_NAME.'_search_archive_full_blog_content', 'No');                      global $blog_div_size_num_class;                 $item_class = $blog_div_size_num_class[$item_type]['class'];                 $item_index = $blog_div_size_num_class[$item_type]['index'];                 if( $sidebar == "no-sidebar" ){                     $item_size = $blog_div_size_num_class[$item_type]['size'];                 }else if ( $sidebar == "left-sidebar" || $sidebar == "right-sidebar" ){                     $item_size = $blog_div_size_num_class[$item_type]['size2'];                 }else{                     $item_size = $blog_div_size_num_class[$item_type]['size3'];                 }                         echo "
";                 echo "
";                      if( have_posts() ){                          echo '
';                          if( $item_type == '1/1 Full Thumbnail' ){                            print_blog_full($item_class, $item_size, $item_index, $num_excerpt, $full_content);                     }else if( $item_type == '1/1 Medium Thumbnail' ){                         print_blog_medium($item_class, $item_size, $item_index, $num_excerpt);                     }else{                         print_blog_grid($item_class, $item_size, $item_index, $num_excerpt);                     }                          echo '
'; // blog-item-holder                          echo '

';                          pagination();                      }else{                          global $gdl_admin_translator;                     if( $gdl_admin_translator == 'enable' ){                         $translator_not_found = get_option(THEME_SHORT_NAME.'_search_not_found',                              'Sorry, but nothing matched your search criteria. Please try again with some different keywords.');                     }else{                         $translator_not_found = __('Sorry, but nothing matched your search criteria.' .                              ' Please try again with some different keywords.','gdl_front_end');                          }                                 echo '
';                     echo '
' . __('Search','gdl_front_end') . '
';                     echo '
';                     echo $translator_not_found;                     echo '
';                                       echo '
';                      }                      echo "
"; // gdl-page-item                      get_sidebar('left');                              echo "
"; // gdl-page-float-left                      get_sidebar('right');                ?>

       Please help. I'm trying to fix that all day without result's. Regards.


How to use Shortcode Plugin with AJAX loading?

I'm using Wordpress 3.9.1 and a Theme that utilizes AJAX loading. (the site is here: http://phoenixwave.com/test/ ) I've installed a plugin to add more shortcode abilities. Problem is, once a page loads via the AJAX loading - it doesn't seem to load the shortcodes (especially anything that is animated) unless you do a hard refresh on the page. If you go to: http://phoenixwave.com/test/portfolio and choose the only option on that page you'll see what is happening ... or not happening in this case. I have the ability to add custom Javascript and CSS within the theme that I'm using and wondered if there would be a way to fix this problem. I've noticed other similar problems posted to Stack but they are SO code heavy that I was unsure what to learn from.


Equivalent of admin.php for public pages

I am pretty new to the Wordpress API and can't seem to find what I need. I have been searching for a way to create public pages (accessible to users without admin permission), similar to the method used when creating pages on admin.php. Basically, I have my application for creating surveys in the dashboard, but now I want to display the actual thing to users. I was planning on displaying a custom link using a `shortcode`, which would in-turn open a window containing the requested survey using javascript's `window.open()`. However, I can no longer connect to the database if I call to an empty page in the plugin directory. In admin.php I could also `$.post` to `ajaxurl`, but that is only accessible in the admin headers. What method can I use to display a public page but still have most of the features of admin.php?


get post id in while loops outputting page id

it's been a while since I used wordpress and I am trying to us e advanced custom fields, I am trying to output the post ID inside a loop on a page, so i can use get_field to output the post contents. Ths $post->ID gives me the page id not the post id so thr wrong number is being outputted, how do I get the post ID?               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                              <?php $current_id = $post->ID ?>             <?php echo $current_id ?>
<?php the_field('titleFart', $current_id); ?>
                  <?php endwhile; // end of the loop. ?>          <?php endif; ?>


Create a network of blogs with WordPress 3

I want to create a network of sites on the WordPress platform. Apartment Therapy is a prime example of how I would like to implement the network. They are using unique domains, not subdomains or directories. Click Technology in the top nav for Unplggd, click Children for Ohdeedoh, etc. Can you give me your opinion of how to best do this with WordPress 3.0.x multisite? I've read some posts about WordPress multisite that give me a hint but I want to build the architecture right the first time. Thanks for your input.


Manipulating a query

I'm trying to use my own search form rather than default single-field form. So I made my fields and set the values to the query by using `pre_get_posts` hook. All things are well. Because of searching through multiple `custom fields` I'm using `meta_query` with `relation => 'OR'` as well as using multiple key/value arrays inside it. But there is a problem I've and going to explain. This is the query that will run when submit button is clicked:               SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)     INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)     INNER JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id)     INNER JOIN wp_postmeta AS mt3 ON (wp_posts.ID = mt3.post_id)     INNER JOIN wp_postmeta AS mt4 ON (wp_posts.ID = mt4.post_id)     INNER JOIN wp_postmeta AS mt5 ON (wp_posts.ID = mt5.post_id)     INNER JOIN wp_postmeta AS mt6 ON (wp_posts.ID = mt6.post_id) WHERE 1=1  AND (((wp_posts.post_title LIKE '%test%') OR (wp_posts.post_content LIKE '%test%')))  AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'jz_ftype' AND CAST(wp_postmeta.meta_value AS CHAR) = 'pamphlet')     OR  (mt1.meta_key = 'jz_year' AND CAST(mt1.meta_value AS CHAR) = '')     OR  (mt2.meta_key = 'jz_has-answer' AND CAST(mt2.meta_value AS CHAR) = 'yes')     OR  (mt3.meta_key = 'jz_atc-author' AND CAST(mt3.meta_value AS CHAR) LIKE '%%')     OR  (mt4.meta_key = 'jz_ebook-author' AND CAST(mt4.meta_value AS CHAR) LIKE '%%')     OR  (mt5.meta_key = 'jz_pro-author' AND CAST(mt5.meta_value AS CHAR) LIKE '%%')     OR  (mt6.meta_key = 'jz_level' AND CAST(mt6.meta_value AS CHAR) = 'basic') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10      As you can see (at the end of 7th line) the additional query I set to main query by using `$query->set()` method is being `AND`:               AND ( (wp_postmeta.meta_key = 'jz_ftype' AND CAST(wp_postmeta.meta_value AS CHAR) = 'pamphlet')      But I need to make it `OR`:               OR ( (wp_postmeta.meta_key = 'jz_ftype' AND CAST(wp_postmeta.meta_value AS CHAR) = 'pamphlet')      So how can I achieve that?


How to add a custom button to the tinyMCE toolbar?

I want to add a custom button to the tinyMCE toolbar in the 'Add New Post' screen which when clicked, will insert text into the new post. I have tried using this code (from http://tinymce.moxiecode.com/tryit/custom_toolbar_button.php):               wp_admin_css('thickbox');     wp_print_scripts('jquery-ui-core');     wp_print_scripts('jquery-ui-tabs');     wp_print_scripts('post');     wp_print_scripts('editor');     add_thickbox();     wp_print_scripts('media-upload');     setup : function(ed)     {         // Add a custom button         ed.addButton('mybutton',          {             title : 'My button',             image : 'img/example.gif',             onclick : function()              {             // Add you own code to execute something on click             ed.focus();             ed.selection.setContent('Hello world!');             }         });     }      but it fails to compile. It error's at the line with ' **setup : function(ed)** ' Is it failing because I need to reference tinyMCE.js? I couldn't find that file under my WordPress installation on the server. is there a better way of creating the button?


Order posts by average

I am using advance custom fields and i have used the custom fields to create an average score. Now i want to order the posts by the average score I have tried to do it but it doesnt seem to work here is my code               <?php     $args = array(         'post_type' => 'review',         'meta_key' => $scoreavg,         'orderby' => 'meta_value_num',         'order' => 'DESC'     );     $query = new WP_Query($args);     ?>          <?php if ($query->have_posts()) : ?>              <?php while ($query->have_posts()) : $query->the_post(); ?>             <?php             $totalscore = get_field('features_score') + get_field('price_score') + get_field('service_score') + get_field('matching_score');             $scoreavg = $totalscore / 4;


Admin panel: Javascript not loading properly. Cannot edit pages/posts

I am using the latest Wordpress.org install. None of my back-end javascript is working, none of my navigation drop downs, admin panel areas are not loading as well. **I have not edited any core files.** I have tried to disable all my plugins, even moved them from the plugin directory to see if there is a conflict. No luck. I have tried to use different themes. No Luck. The only way that I can edit posts/pages is if I highlight the text that's in the post (see screenshot). I've added a few jquery scripts to my themes header.php file, tried to take those out as well, didn't work. Tried switching themes, didn't work. The only theme file that I've touched otherwise was functions.php. I'm working on a local machine using WAMP. Any help would be appreciated, THANK YOU! SCREENSHOTS: ![alt text](http://i.stack.imgur.com/30ebS.png) ![alt text](http://i.stack.imgur.com/t6Qvs.png)


Wordpress Permalink

I need to make my wordpress permalink like the following Permalink For Category:                www.mydomain.com/category/%category%      Permalink For Posts:                www.mydomain.com/category/%category%/article/%postname%      Is there any specific code i can use with .htaccess or any plugin that might help


Overwrite CSS of Instaemail plugin popup

I am using instaemail plugin on my wordpress for sending a post by email and I am trying to customize popup window, but seems that I can not overwrite Id or I don't know how to do it. Same popup you can find on link above if you click on email (try it) I had success with changing wraper color and classes by putting in style.css               div#pf-email-wrapper {         background-color: rgba(09, 85, 3, 0.50);     }      but how to change (overwrite URL)               .email-sprite{       background: url('/images/email/email-app-sprite.png') no-repeat;     }      or change color of               .pf-email label {       color:#356da9; }      So the CSS in style.css would overwrite default CSS of Instamail script It is not problem in priority It is in calling the class in style.css probably > P.S. Is there any plugin which for "send to friend" button and to > customization of popup and customization of email template


Automatically add author's name to post_tag

I need to add the author of a post's name to the post's tags whenever the post is published. So for example John Smith wrote a post, the tag 'John Smith' would be added to that post's tags. I've tried a couple of different ways, but I think I'm closest with this:                In functions.php:           add_action( 'save_post', 'add_authors_name');      function add_authors_name( $post_id ) {      $post_author = get_the_author($post_id);      wp_set_post_terms( $post_id, "$post_author", 'post_tag', true );      }      This doesn't work, but I think I'm getting there. Just not sure what I'm missing... Could anyone shed some light on this?


How do I move menu to the bottom in Custom Community theme?

I am new to Wordpress and created the following website: www.sugarhausbyamy.com I would like to move my menu to the bottom of the screen. Is there an easy way to do this? I would also like to change the font in the menu. Thanks!


Can't past image from clipboard into new post

Depending on the computer used, I'm able or not to paste copied images into a new WP post. I've looked at everything and I can't find the culprit. I've tried different browsers, and nothing seems to be working. Any ideas?


How we show pages in dropdown

I show the all `menu` which i have on the top in `dropdown` style when site is open in mobiles. I successfully display them in dropdown style but the problem is that how can i indend my subpages. or make parent pages bolg is any way to do that, my code is               <nav id="nav-mobile" role="navigation">                     <select id="mob_menu" name="page-dropdown">                       <option value="">                     <?php echo esc_attr( __( 'Select page' ) ); ?></option>                       <?php                        $pages = get_pages();                        foreach ( $pages as $page ) {                         $option = '<option value="' . get_page_link( $page->ID ) . '">';                         $option .= $page->post_title;                         $option .= '</option>';                         echo $option;                       }                      ?>                     </select>                          </nav>


How to scale up post thumbnails/featured image?

Is there a way to scale up post thumbnails on Wordpress? On a featured div I want a post thumbnail/featured image with **584×348 px**. When I upload a smaller image as a featured image on a post, it won’t scale up to this size. **If the image is 250×250, it will appear 250×250.** But if I use a larger image as featured image on the post, it will resize normally. The thumbnail in **functions.php** is set this way:               // This theme uses post thumbnails     add_theme_support( 'post-thumbnails' );     set_post_thumbnail_size(150, 150); //size of thumbs     add_image_size( 'post-thumb', 600, 380, true );       The div:
<?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'post-thumb' ); } ?>
      And the class:               .featured_thumb {background:#0C6; width:584px; height:350px; overflow:hidden;}      Can someone help me to figure out how to do it please? I thought of using timthumb but I’ve seen lots of complains about security. Not quite sure about it… Anyway, hoping someone could help me.


error inserting value

Im kinda having some problem in my `query` and looks alright in my side and tested it in a localhost too. `$query = "INSERT INTO`$db_name`(`fname`,`pass`) VALUES('".$_REQUEST['fname']."', '".$_REQUEST['pass']."')";` that query is giving me an error it says in the error that `mysql_query() expects parameter 1 to be string` and im using the plugin `Allow PHP in post and pages`.               [PHP]     if(isset($_REQUEST['fname'])){     require_once('wp-config.php');     $con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);     $db_name = "add_name";     mysql_select_db($db_name);     $query = "INSERT INTO `$db_name`(`fname`, `pass`) VALUES('".$_REQUEST['fname']."', '".$_REQUEST['pass']."')";     $add = mysql_query($con, $query);     if($add){       echo "Added succesfull";     }else{       echo "problem connection!";     }     }     [/PHP]


Get only parent terms from wp_get_post_terms

I've got a custom post type that has hierarchical taxonomies set up. For an example, my post type of "project" has categories of                A        A.1      B      C      I'm trying to get the taxonomies displayed as classes on `<li>` items for each post, but I just want the top level parents shown. For the post I'm looking at, it is categorized as A.1 and C, but I'd like to return A and C. I'm using `'parent' => 0` in the args, however its giving me A.1 and C. I have also tried using `'hide_empty' => 0` but that doesn't seem to help. Here's my code:                function project_get_item_classes($post_id = null) {          if ($post_id === null)              return;          $_terms = wp_get_post_terms($post_id, 'construction_type', array( 'parent' => 0, 'hide_empty' => 0 ));          foreach ($_terms as $_term) {              echo " " . $_term->slug;          }      }


Is there a way to export Advanced Custom Fields data?

I've entered data into ACF using the ACF Options plugin. Is there a way to export all that data I entered? When I use ACF's built in exporter, it only exports the structure. Maybe I'm missing something obvious.


edit posts through front-end

It's possible to insert posts by users through the front-end by using plugins such as gravity forms or by using wp_insert_post. However, how would one handle the editing of those posts? This has to be in a safe/foolproof/secure way for users.


wordpress sanitize array?

I have a custom post form that sends data to a page which uses wp_insert_post to create a post. I can easily sanitize most data, but I have some troubles with my tags, I retrieve in an array:               $tags =  $_POST['tags'];      Before using these tags as tags_input, how can I successfully sanitize all names? Thanks!


Retrieving a JSON feed of my posts and displaying thumbnails

I want to show a feed of my latest posts though json. I seem to be able to do it - up to a point. I am retrieving my feed like so:               var json = <?php echo json_encode($query->get_posts()); ?>;      Problem is, I can't retrieve the post thumbnails, I can just retreive the post title and a bunch of other information, but can't seem to get what I'm looking for. Any idea how I can do that? Thanks a lot!


All of my custom posttypes are 404'ing

All of the posts made within custom posttypes have suddenly become uneditable, and will 404 when you try to view them.![Screenshot](http://i.stack.imgur.com/OpENn.png) The posts in the admin panel are greyed out (posts in the standard post/pages etc are fine). * * * **Things I have Tried**   * I have tried using `GIT BISECT` but problem persists beyong where I know it to be working.   * Tried downgrading wordpress   * Checked various database elements such as post status and post author.   * Tried setting and resetting permalinks.   * Deactivated All plugins * * * New posts seem to be fine, and work normally. But my metaboxes have also vanished!! Again, `GIT` suggests this problem going back beyond where I know them to be working. It seems, as `GIT` is incapable of finding the solution, that it must either be related to the database or the wordpress core itself (as my GIT repo only tracks the theme) Wordpress is up to date. * * * **Edit** This is the function that creates the post types:               register_post_type($object_name,             array(                 'labels' => mf_create_labels($object_name),                 'public' => true,                 'supports' => array('title','editor','thumbnail','page-attributes')                      )         );      using this to create labels:               function mf_create_labels($label){         return array(             'name' => __($label),             'singular_name' => __($label),             'add_new' => _x('Add New', $label),             'add_new_item' => __('Add New '.$label),             'edit_item' => __('Edit '.$label),             'new_item' => __('New '.$label),             'view_item' => __('View '.$label),             'search_items' => __('Search '.$label),             'not_found' =>  __('No ' . $label . ' found'),             'not_found_in_trash' => __('No ' . $label . '  found in Trash'),              'parent_item_colon' => ''         );     }      * * * **Update** I have got the meta boxes back, it seems Wordpress now insists on having the posttype declared in all lower case, despite be declaring the post types with capital letters * * * **Please, if you have any idea where to look for the issue, comment. No suggestion too small at this stage**


Settings to get the most out of W3 Total Cache

I'm running a dedicated server which hosts one website - our WordPress install. Currently we're getting around 400,000 pageviews per month and that will likely rise quickly over the coming month - and hopefully exponentially from there onward ;) I want to install the W3 Total Cache plugin but after reading a few reviews/support forum posts, I'm concerned that I'll potentially slow the website down rather than speeding it up. I've installed it, had a quick play, then uninstalled it due to a few minify problems (see #2). My question, as such, is twofold.   1. Knowing that my server is a good spec, good network and hosts only this website, are there any options I should consider enabling (or disabling) to get the fastest site-usage possible?   2. How can I stop the plugin from caching my forums? Simple Press is located at `/forums/` and the JS minify breaks a number of features of the forum (TinyMCE editor, profile amendments, etc). I tried adding `*forum*\.php` to the `never cache` option, but it killed my site (500 error; had to remove the W3 Cache lines from `.htaccess`). Thanks in advance,