Moved Wordpress Directory - Having access issues now

I uploaded a couple of untouched Wordpress directories to my server and named them wordpress1, wordpress2, wordpress3 and so on. The reason behind is that I have a slow Internet Connection at home and when I had a fast Connection, I uploaded them to have them ready, when I need them. * * * So I renamed wordpress1 to new_website and started the install, connected to the database and all was set. I can create posts and pages. However, an upload of a file is not possible as Long as wp-uploads is not set to chmod 777. 755 is not working. Same with changing the permalinks structure. Wordpress can't write the .htaccess file, except I chmod 777 the wordpress directory. When I want to install a plugin, I always have to enter my FTP information so it can install. * * * I have other installations running on the same webspace without any issues. However, I didn't use the rename thing Any clues what I could do here?


Unexpected problems after importing WP data

I had to move my solution from one server to another. I therefore Exported all data so that I could import this on the new server. All worked fine except users. If I want to edit my own profile, all is well.   But if I try to edit another user profile, I get these error messages: > Notice: Undefined property: WP_User::$rich_editing in > I:\Development\wamp\www\storelocator\wp-admin\user-edit.php on line 199 and > Notice: Undefined property: WP_User::$nickname in > I:\Development\wamp\www\storelocator\wp-admin\user-edit.php on line 285 After I imported data from the other server, all nicknames have this text:   `<br /><font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'><tr><th align='left' bgcolor='#f57900' colspan=` If I click `Update`, data is stored and the error messages goes away. What could be the cause of this?


How can I modify page <h2> content in the admin panel?

I'm modifying the layout and content of the wordpress admin panel using a custom plugin. For most sections I have been able to change the page heading (i.e. the title wrapped in h2 tags at the top of each page), however I've been unable to do so for sections to relating post types, specifically adding and editing posts and pages. Currently when adding a new page to the wordpress site, the heading is 'Add New Page', but I'd like to be able to modify this text - so far I've been searching for the hook to do this but have been unable to find one.


Using the media uploader in a custom plugin

As part as a widget I'm creating, I need the admin to upload an image via the widgets panel I have the following code under a new class               <?php     function form($instance) {        $instance = wp_parse_args( (array) $instance, array( 'qrimage'=> '');        $qrimage=$instance['qrimage']; ?>          <label for="<?php echo $this->get_field_id('qrimage'); ?>">           Upload QR Image:     <input class="wide"             id="<?php echo $this->get_field_id('qrimage'); ?>"             name="<?php echo $this->get_field_id('qrimage'); ?>"             type="text"             value='<?php echo attribute_escape($qrimage); ?>' />     Upload Image      <label for="uploadi<?php echo $this->get_field_id('qrimage'); ?>">         <input class="uploadi<?php echo $this->get_field_id('qrimage'); ?>"                name="uploadi<?php echo $this->get_field_id('qrimage'); ?>"                id="uploadi<?php echo $this->get_field_id('qrimage'); ?>"                value="Upload Image" type="button" />     </label>          <script type="text/javascript">           var formfield = '';           var imgurl ='';           jQuery(document).ready(function() {             jQuery('.uploadi<?php echo $this->get_field_id('qrimage');?>').click(function() {              formfield = jQuery('#<?php echo $this->get_field_id('qrimage'); ?>').attr('name');              tb_show('', 'media-upload.php?type=image&amp&TB_iframe=1');              return false;             });                  // send url back to plugin editor             window.send_to_editor = function(html) {              imgurl = jQuery('img',html).attr('src');              jQuery('#<?php echo $this->get_field_id('qrimage'); ?>').val(imgurl);              tb_remove();             }                  });       </script>      Thing is... if I have 1 instance of the widget on the widgets panel , everything works fine. Once I add another instance, everything's working on the first instance but on the second one I cannot save the image , The text field gets the value but on save it just disappears Any thoughts why? Thanks


Advanced Custom Fields plugin : displaying a field while omitting the p tags

In Advanced Custom Fields plugin, is it possible to display a WYSIWYG editor field in which `p` tags are omitted?


custom post type: own database table structure and custom "new-post" interface

I was tried to search answer to my question, but I didn't find. What I need:   1. Make own post type. It's simple with Custom Post Type UI plugin. **Solved.**   2. To have own table in DB for post of new type. When I create custom post type, all data of created posts writes to default wordpress tables in DB and I want to change it. **Not solved.**   3. To have own interface for creating new post in my custom post type. Clicking on "Add new 'customtype' post" gives me standart interface for creating standart posts. Name, tags, categories and post body to fill. I want to change it too, with my own form (Name, date, place, some checkboxes and dropdown selects). **Not solved.** I will very appreciate any help or words to google and learn. P.S. I know, Im not good in english. Sorry and thank you.


Query posts by Author and/or by Tag

I'm pretty sure I need to do some sort of custom query, but not sure about the best way to go with it. I have an author page. It needs to display that author's posts. That's fine, I can do that. I need to amend the query so that it displays the author's posts as well as posts tagged to that author's name. So I imagined the query something like this `query_posts("author=$author_name||tag=$author_name");` I figured that I could set up the query using WP_Query and feeding it the `meta_query` with the relation `OR` but that only returned posts by the author and ignored ones that were tagged:                $args = array(         "showposts" => "$show_num_posts",         "meta_query" => array(         "relation" => "OR",              array(               "author" => "$authID"),             array(               "tag" => "$nametag"             )             )      );           $the_query = new WP_Query($args);      I figure that it's ignoring it because it's found ones by the author and I've specified `OR` when what I really need is some sort of `AND/OR`. I've had a look at this example but can't seem to recreate that user's solution to fit my needs. I just keep breaking the whole thing.               global $wpdb;     $args = $wpdb->get_results($wpdb->prepare(         "         SELECT $wpdb->posts.*         FROM $wpdb->posts, $wpdb->postmeta         WHERE  ($wpdb->posts.author = $authID)         OR ($wpdb->postmeta.tag = $nametag)         "     )     );     foreach ( $args as $post ) : setup_postdata($post);      Is there something out there you could point me towards? There has to be an easier way to do this. I'm probably over-complicating it and there's a really simple (probably in-built) way of doing it I've just missed. Searching the codex returned nothing useful though.


How can i add a random redirect button in wordpress?

I need a random redirect button just like 9gag.com I know that i need a add a rewrite rule but i dont know how to do this I tried to use plugins and other codes, but none worked.


Organize template parts and page templates in folders in regards of template hierarchy

Hello and happy new year Suppose one has a large theme composed of several post types, page templates and a bunch of custom loops and template parts which is best keeping in separate php files. What's the best practice to organise these files? For example, suppose I have 10 page templates. How about putting them in a folder named "pages"? And another folder for the archives? However, how to let Wordpress know where to look for the templates? Thanks


SP initiated login using SAML 2.0 Single Sign On

I am trying to configure SP initiated SSO using SAML 2.0 Single sign on plugin. All the steps are configured but when user clicks on login link in WordPress site the SAMl request goes to ADFS server and redirects back to the same page. After user again clicks on login link then user is logged in. Please suggest some solution why user is not logging in on first click itself.


Set a variable to using in redirected page

I need to set a global variable that will be used in the page set on wp_redirect               global $open;     $open = FALSE;              function open_menu($user_login) {        global $open;        $open = TRUE;        wp_redirect(home_url());        exit;     }     add_action('wp_login', 'open_menu');      After redirect, I'm using the variable to open dropdown menu:               <div class="dropdown login-dropdown<?php  global $open; if($open == TRUE){echo " open";} ?>">      But is not working


Folder Name and Category Name Wordpress

I have URLs that need have the old URL for download files. Before, it has 2 separate website. The MAIN and the PORTAL website.               http://www.website.org     http://www.website.org/portal      I want both websites under in one admin page. So I did and make "PORTAL" as CATEGORY and it works well. The problem is, I have "404 Not Found" page whenever I tried to view the PDF files. The files are now in:               website/wp-content/uploads/2013/01/31/      before:               website/portal/wp-content/uploads/2013/01/31/      Since I made PORTAL as category, I deleted the "PORTAL" folder. How can I make the URL path or what to change in the admin page or in .htaccess file to still have the OLD url? I cannot change the URL to the new one since most of the files are link to other websites.


Searchable database of members using multiple criteria / filters

I'm very new to wp let's say that first! What I need is to create a site which will list a database of members of an organisation. Users will also be able to sign-up and add themselves to the database. But additionally I want users to be able to search for other users using given criteria check boxes, for example: Is male [ ] Is female [ ] Lives in city x [ ] Lives in city y [ ] Lives in city z [ ] Is aged 20-30 [ ] Is aged 30-40 [ ] Is aged 40-50 [ ] (These arent the criteria I want to use but just examples by the way) I checked out 'Participants Database' plug-in which looks excellent, all up to the part that I want the search to do the above filtering which it isn't clear how to achieve. So, what is the best way to do this?


Wordpress theme showing blank page

Something is wrong to my installed theme, because when I am clicking on _Visit Site_ than its showing blank page. No error and no content, no navigation nothing to display. There is link below :- http://www.gate7infotech.com/projects/development/derrick_payne/


Two loops in one function

I am trying to get this function to work with jquery tabs, and I've gotten some of it to work. Right now the function correctly puts out the

item1

item2
     etc..
      But it does not put out the second loop at all. I am not the most proficient at wordpress, not to mention php itself, so I am hoping for some help on how to correctly set up such a function.               function new_function($type='new_function') {         $args = array(             'post_type' => 'tabs',             'posts_per_page' => 10         );         //first loop puts out correctly so far.             $firstresult .= '
';         $firstresult .= '
';         $firstloop = new WP_Query($args);         while ($firstloop->have_posts()) {             $firstloop->the_post();             $firstresult .='
'.get_the_title().'
';                         }         $firstresult .='
';             return $firstresult;              //the second loop does not work at all, but does not break the first part either.         $result .= '
';         $loop = new WP_Query($args2);         while ($loop->have_posts()) {             $loop->the_post();              $result .='
';         $result .='

'.get_the_content().'

';             $result .='

' .get_the_title(). '

';         $result .='
';         }         $result .= '
';         $result .='
';         return $result;     }


Create Widget or Enable Shortcodes in Sidebar

I'm well aware that WordPress by default does not process shortcodes in the sidebar. My question is why. I'm building a very small plugin that exports some content when the shortcode is present. This will be primarily used in the content area. I want to allow the user to display that content in the sidebar and I'm debating including the one line fix to enable the shortcodes rather than adding ~50 lines of code to create a widget. Is there something going on under the hood that is a good reason to avoid the shortcode in the sidebar? Is it simply a convention?


Changing starting number of User ID

I've got a client who would like their online user registration to match their current database. Thus they'd like their wordpress sign ups to start with 00100, I can't seem to find a plugin that allows this, is there anyway of adjusting the database to achieve this?


Auto-Import of WXR File

I am running a WPMU instance and need to import around 1200 sites at once. I have put a process in place to create a properly formatted WXR file for each one. What I am missing at this point is how to access the WP Import option without the GUI, so I can automate this import. Any thoughts?


How to make text appear at bottom of post but not in featured

I'm trying to make some text (which includes a link) not appear in the slide at the top of my site, here's the site http://www.roboticmountain.com and you can see the "Image source.." etc is appear in the text in the slide, I need that to be in the actual post, but I don't want it to appear in that slide, any ideas how I can keep it out of it? Here's the actual post http://roboticmountain.com/neon-light-left-on-for-77-years/


Can a multisite's blogs be accessible from two different sub-domains?

**Quick Background:** We have a single WordPress instance, with Multisite enabled, hosting three separate blogs. (blog.example.com/blog1, blog.example.com/blog2, blog.example.com/blog3). This multisite will be load balanced across a web tier of four servers, all accessing the same DB. I understand that `blogs.dir` will need to be synced across the web tier, so that media is present, no matter which server a client hits. **Question:** Can I have a fifth web server (i.e., `post.example.com`), whose only purpose is to enable editors to login and post new content, for any of the three blogs? This way the load balanced servers are only receivers of uploaded content from `post.example.com`. I know the syncing part is possible, but I'm not sure about how to set up WordPress to be accessible from two different sub-domains. Is that possible? **Edit:** I should add that an additional goal by setting it up this way, is we hope to gain some security through obscurity, by blocking access to `/wp- admin/` on the web tier, so you can only login from the one web server (`post`), but of course that all depends on the aforementioned question. :) Mock below: ![Mock WordPress Architecture](http://i.stack.imgur.com/eY2WQ.png)


How make a custom search on backend in Wordpress without plugin?

I have a post type called usr_jardin with a custom field called sim_nuip. I would like to get the search to work for the title of the post and also by custom field . I try this but does not work me.               function searchfilter($query)     {         $custom_fields = array("_post_title", "nuip");         $searchterm = $query->query_vars['s'];         $query->query_vars['s']="";              if($searchterm != "")         {             $meta_query = array('relation' => 'OR');                  foreach($custom_fields as $cf)             {                 array_push($meta_query, array('key'=> $cf,'value'=> $searchterm,'compare'=> 'LIKE'));             }                  $query->set("meta_query", $meta_query);         }              if($query->is_search)         {             $query->set('post_type', array('post', 'usr_jardin'))         }         return $query;     }          add_filter('pre_get_posts','searchfilter');     add_action('save_post','add_title_custom_field');          function add_title_custom_field($postid){         update_post_meta($postid, "_post_title", $_POST["post_title"]);     }


making random query button using $_GET

Im trying to make my post random when i lick on my button using $_GET but it just keeps refreshing my page instead of refreshing with the random post.                   <a href="<?php echo $my_query; ?>?p=random"><img src="<?php bloginfo('template_directory'); ?>/images/shakeup.png" alt="" />          <?php if(isset($_GET['p']) && $_GET['p']=='random') {?>      <?php $my_query = new WP_Query('orderby=rand'); ?>     <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>      im getting this error now "Call to a member function have_posts() on a non- object in"


How can I make post fields required in Wordpress?

I am setting up a Wordpress site as a CMS and trying to figure out a way to make certain post fields "required" before an author can publish a post. In particular, I want authors to be required to select a "category" and to set a "featured image". It's been suggested that something like this could be done using some Javascript, but to be honest, I'm not entirely sure where to start (and my Javascript skills aren't the best). If anyone has an idea as to how this can be done, I can really use the help. Thanks!


get_shortcode_regex() only matches first shortcode

The Codex has an example of using get_shortcode_regex() to check if a shortcode is being called on a given page:               $pattern = get_shortcode_regex();     preg_match('/'.$pattern.'/s', $posts[0]->post_content, $matches);     if (is_array($matches) && $matches[2] == 'YOURSHORTCODE') {         //shortcode is being used     }      This only detects the first shortcode in the post content, though. Is that a bug with get_shortcode_regex(), or can the preg_match() parameters be tweaks to make it return all shortcodes present on the page?


How to filter custom post type archive by meta value

I have a problem where I'm trying to build a calendar plugin for a client. I'm having trouble getting a date based archive for the custom post type I'm using. I'm not too well versed in how the wordpress system for handling permalinks is set up on a low level, and I've hit a wall. **Background:** The plugin registers a custom post type, `event`. Each event has a meta value field called `kultkal_date`, holds a date in the form of `2011-09-28`. (Events are limited in the sense that each event's date is unique as well, by validation on the `save_post` action). I've defined a custom permalink for the post type as `/kalendarie/%kultkal_year%/%kultkal_month%/%kultkal_day%`, so the finished URL might look like `/kalendarie/2011/09/28/my-slug`. I've added rewrite tags for the custom permalink using the `init` action like so:               add_rewrite_tag('%kultkal_year%','([0-9]{4})');     add_rewrite_tag('%kultkal_month%','([0-9]{2})');     add_rewrite_tag('%kultkal_day%','([0-9]{2})');      I have a function to fix the permalink that runs on the `post_type_link` filter:               function filter_post_type_link($link, $post){         if ($post->post_type != 'event')             return $link;              if ($date = get_post_meta($post->ID, 'kultkal_date', true)) {             $dates = explode('-', $date);             $year = $dates[0];             $month = $dates[1];             $day = $dates[2];         } else {             return $link;         }         $link = str_replace('%kultkal_year%', $year, $link);         $link = str_replace('%kultkal_month%', $month, $link);         $link = str_replace('%kultkal_day%', $day, $link);         return $link;     }      Viewing individual posts works. So does the archive page (located at the `/kalendarium/` URL: `has_archive` is set to `kalendarium` when I register the post type). The trouble starts when I want to filter the posts by year - for instance, `/kalendarium/2011/` or `/kalendarium/2011/09/28/` etc. I've found an answer on how to filter based on meta value for date on built-in posts here: Archive Listings Filtered by Date Values in a Custom Field/Post Meta? - but it doesn't seem to work on custom post types. As soon as I add /year/month/day-parameters to test it, I get the archives for the built-in post type, not even a 404. (So far, I've only tried the first version in the answer above, with all the parameters (year/month/date), not the one with all the combinations + hook for `posts_where` etc. Here's what the (broken) function I run on `pre_get_posts` looks like:               function event_pre_get_posts($query) {         global $wp_the_query;         if ($query === $wp_the_query && $query->is_archive()) {             $qv = &$query->query_vars;             if (isset($qv['kultkal_year']) && isset($qv['kultkal_month']) && isset($qv['kultkal_day'])) {                 $date = mktime(0,0,0,$qv['kultkal_month'],$qv['kultkal_day'],$qv['kultkal_year']);                 $qv['meta_key'] = 'kultkal_date';                 $qv['meta_value'] = date("Y-m-d", $date);             }         }     }      Any ideas on how to achieve the solution I'm looking for?


url rewriting for most recent post

I'd like to set up my WP so that urls ending in `/last` would return the most recent post in that set of posts. For example, `/last` returns the most recent post of any type, `archives/category/trivia/last` would return the most recent post categorized as trivia, and `archives/LoomSong/last` would return the most recent custom post of type='LoomSong'. I think I need to add rewrite rules, but I'm very unsure of what the regex should be. So far this is what I have:               add_action( 'init', 'ASHmostrecent_init' );     function ASHmostrecent_init(){         add_rewrite_rule( 'last/?$', 'WHAT DO I PUT HERE?');     }          add_filter( 'query_vars', 'ASHmostrecent_query_vars' );     function ASHmostrecent_query_vars( $query_vars ){         $query_vars[] = 'ASHmostrecent_filter';         return $query_vars;     }


Retrieving images from a NextGEN gallery

I'm not sure if this is possible but after extensive searching I can't find an answer. What I want to do is to get all images from a NextGEN gallery so I can display them in a custom slideshow within a page/post. Is it possible to load them into an array or edit the HTML in some way? Any help is greatly appreciated!


How to create an attachments archive with working pagination?

This might sound like query_posts with pagination problem number 2103024 but I think this one might be special. My WordPress site is basically a huge database of car images. _Each image_ should have tags like 'color' => 'red' but a _set of images_ should be grouped in a gallery with certain other tags like 'location' => 'Monaco' (=> all images in this set are taken in Monaco). I should be able to create an archive for each _image tag_ e.g. /color/red and I'd see all _images_ showing red cars. I should be able to create an archive for _each gallery tag_ e.g. /location/Monaco and see all _galleries_ taken in Monaco. I thought long about this and I decided to use WordPress' post-attachment function in combination with custom taxonomies. There are several plugins that allow you to attach custom taxonomies to attachments and it's easy for the user who can simply use batch upload to push 30 images to the server. So an attachment serves as an image and images attached to a custom post type serve as a gallery. I got it working pretty much exactly as I wanted but now I'm stuck with the custom taxonomy archive for the attachments. In order to make WP show me attachments I have to push two parameters to the original query:               global $wp_query;          // convert query object to array     $original_query = (array) $wp_query;          // attach query parameters to original query     $attach_query = array(                     'post_type'=> array( 'attachment' ),                    'post_status' => array( null )     );          // merge both arrays     $args = array_merge($original_query['query_vars'], $attach_query);          query_posts( $args );      That's it, /image-tags/black/ is showing me a list of black cars. I even have the pagination working properly. However /image-tags/black/page/2/ and higher throw an error 404, strangely while still showing me my desired attachments. I wasn't event noting it first since one can only tell from the page title and body classes showing that this is clearly the wrong template location. Below I'm posting my complete index.php and print_r of global $wp_query. As you can see the query object shows a 'max_num_pages' value of 2. Any ideas will be greatly appreciated! print of Query Object on pastebin               <?php           get_header();          global $wp_query;          // convert query object to array     $original_query = (array) $wp_query;          // attach query parameters to original query     $attach_query = array(                     'post_type'=> array( 'attachment' ),                    'post_status' => array( null )     );          // merge both arrays     $args = array_merge($original_query['query_vars'], $attach_query);          query_posts( $args );          ?>               <?php if ( have_posts()) :  ?>
          <?php while ( have_posts() ) : the_post(); ?>
              <a href="<?php the_permalink(); ?>">

<?php the_title(); ?>

             <?php              echo wp_get_attachment_image($attachment->ID, 'bigger-thumb');             ?>
            <?php endwhile; ?>

          <?php          $big = 999999999; // need an unlikely integer          echo paginate_links( array(         'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),         'format' => '?paged=%#%',         'current' => max( 1, get_query_var('paged') ),         'total' => $wp_query->max_num_pages     ) );          ?>
           <?php else: ?>

<?php _e('Sorry, no posts matched your criteria.'); ?>
          <?php endif; ?>          <?php get_footer(); ?>


Assign specific ads to specific categories/posts

I've been playing around with solution to be able to show a different header banner on different categories, and hopefully later on, be able to extend that query to the post level. I've found a few options but they don't seem to be working as I hoped they would. Here's an example:                             <?php if (in_category('5')) { ?>                                                       <?php } elseif (in_category('7')) { ?>                                                            <?php } else { ?>                                                            <?php } ?>      All I get is all 3 banners showing at the same time no matter what category I'm in. I've tried both in_category and is_category but no change :( Here's a live demo: http://spacenun.com/ Any clues? Thanks!!


Load styles without them being merged as load-styles.php?

For development purposes, is there a way to avoid all the styles being merged by `load-styles.php`? I am trying to create an admin page that is in line with the common admin styles and `load-styles.php` makes it hard to find the styles in the original CSS files.


media 'path' issue / concern when bringing files live

I'm currently developing a site we have installed on a sub-domain. 'beta.mysite.com' We will eventually, be moving site to it's root domain. 'www.mysite.com' **Problem?** any post type attachment / the files uploaded directly from post and page content editor, will the paths to staging environment .. **before** 'http://beta.mysite.com/wp-uploads/2010/07/image1.jpg' **after** 'http://www.mysite.com/wp-uploads/2010/07/image1.jpg' How can I make a **batch** change to alter the prefix of any reference to staging site? (e.g. replace the http:// **beta** with http:// **www** ) Or, how can I prevent this for my next project?


Display Post Format as a String

I hope this isn't a stupid question, but I can't find an answer. I just want to display (in the loop) what post format a post is in. I'm trying to avoid using a bunch of if / else if conditions. I'm not trying to restyle the post based on format, just display "Gallery" or "Quote" or whatever the current post format is, given they are enabled for my current theme.


Help With Warning on creating new Post types?

Im Getting a couple of warnings when creating custom post types, someone referred me to using a plug in but since i'm new to this i want to know what is going on so i want to do it manually. This are the warnings i get.               Warning: Missing argument 2 for _x(), called in C:\xampp\htdocs\wordpress\wp-content\themes\posttypes.php on line 8 and defined in C:\xampp\htdocs\wordpress\wp-includes\l10n.php on line 189          Warning: Missing argument 2 for _x(), called in C:\xampp\htdocs\wordpress\wp-content\themes\posttypes.php on line 9 and defined in C:\xampp\htdocs\wordpress\wp-includes\l10n.php on line 189          Warning: Missing argument 2 for _x(), called in C:\xampp\htdocs\wordpress\wp-content\themes\posttypes.php on line 28 and defined in C:\xampp\htdocs\wordpress\wp-includes\l10n.php on line 189          Warning: Missing argument 2 for _x(), called in C:\xampp\htdocs\wordpress\wp-content\themes\posttypes.php on line 29 and defined in C:\xampp\htdocs\wordpress\wp-includes\l10n.php on line 189          Warning: Missing argument 2 for _x(), called in C:\xampp\htdocs\wordpress\wp-content\themes\posttypes.php on line 48 and defined in C:\xampp\htdocs\wordpress\wp-includes\l10n.php on line 189          Warning: Missing argument 2 for _x(), called in C:\xampp\htdocs\wordpress\wp-content\themes\posttypes.php on line 49 and defined in C:\xampp\htdocs\wordpress\wp-includes\l10n.php on line 189      Here is my code               <?php           //Add new post type for Models     add_action('init', 'models_portfolio_init');     function models_portfolio_init()     {         $args = array(                         'label' => _x('Models'),                         'singular_label' => _x('Models'),                         'public' => true,                         'publicly_queryable' => true,                         'show_ui' => true,                         'query_var' => true,                         'rewrite' => true,                         'capability_type' => 'post',                         'hierarchical' => false,                         'menu_position' => null,                         'supports' => array('title','editor','comments')                     );                     register_post_type('recipes',$args);     }          //Add new post type for Books     add_action('init', 'books_posts_init');     function books_posts_init()     {         $args = array(                         'label' => _x('Books'),                         'singular_label' => _x('Books'),                         'public' => true,                         'publicly_queryable' => true,                         'show_ui' => true,                         'query_var' => true,                         'rewrite' => true,                         'capability_type' => 'post',                         'hierarchical' => false,                         'menu_position' => null,                         'supports' => array('title','editor','comments')                     );                     register_post_type('books',$args);     }          //Add new post type for Advertisements     add_action('init', 'advertisements_init');     function advertisements_init()     {         $args = array(                         'label' => _x('Advertisements'),                         'singular_label' => _x('Advertisements'),                         'public' => true,                         'publicly_queryable' => true,                         'show_ui' => true,                         'query_var' => true,                         'rewrite' => true,                         'capability_type' => 'post',                         'hierarchical' => false,                         'menu_position' => null,                         'supports' => array('title','editor','comments')                     );                     register_post_type('advertisements',$args);     }          ?>


Reject upload of wrong-sized images using the Media Uploader

I'm working on a super-strict setting for adding images to Custom Fields in the Post Edit screen. My optimal scenario would be to add a a Custom Error message when the user tries to upload an image of the wrong size for that specific custom value. I'm aware I can do this with any custom uploader, but I'd really prefer to do it with the regular Media Uploader. I'm also aware of the wp_handle_upload_prefilter which I already use to validate filenames and generate custom error messages based on generic requirements. What I need right now is a way to use custom requirements to reject uploads based on which field we're uploading to. I'm also aware of Differentiate Featured Image from Post Images upon Upload but I wanted a pre-save solution. This would look something like this: ![enter image description here](http://i.stack.imgur.com/BsSRm.png) Any ideas on how to go about informing `wp_handle_upload_prefilter` ( or a similar ) of which field we're dealing with?


Issues on saving data from CPT select metabox

I can't save data from a select metabox. My code is http://pastebin.com/BMmKzti2 Where I'm going wrong? Edit: Here is my code                   function fichasvtmbasicas_meta_box_callback( $post ) {         wp_nonce_field( 'fichasvtmbasicas_meta_box', 'fichasvtmbasicas_meta_box_nonce' );         $fichasvtmbasicas_geracao_field = get_post_meta( $post->ID, '_vtmbasica_geracao_value_key', true );         $selecionargeracao = isset( $fichasvtmbasicas_geracao_field['_vtmbasica_geracao_value_key'] ) ? esc_attr( $fichasvtmbasicas_geracao_field['_vtmbasica_geracao_value_key'][0] ) : '';              echo '
';         _e( 'Geração:', 'fichasvtmbasicas_textdomain' );         echo ' ';         echo '<select id="fichasvtmbasicas_geracao_field" name="fichasvtmbasicas_geracao_field">';         echo '<option value="geracao15"' . selected( $selecionargeracao['_vtmbasica_geracao_value_key'], '15' ) . '>15</option>';         echo '<option value="geracao14"' . selected( $selecionargeracao['_vtmbasica_geracao_value_key'], '14' ) . '>14</option>';         echo '<select>';         echo '
';         }              function fichasvtmbasicas_save_meta_box_data( $post_id ) {         if ( ! isset( $_POST['fichasvtmbasicas_meta_box_nonce'] ) ) {                 return;         }         if ( ! wp_verify_nonce( $_POST['fichasvtmbasicas_meta_box_nonce'], 'fichasvtmbasicas_meta_box' ) ) {                 return;         }         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {                 return;         }         if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {                      if ( ! current_user_can( 'edit_page', $post_id ) ) {                         return;                 }              } else {                      if ( ! current_user_can( 'edit_post', $post_id ) ) {                         return;                 }         }         if ( ! isset( $_POST['fichasvtmbasicas_geracao_field'] ) ) { //para Geração                 return;         }         update_post_meta( $post_id, '_vtmbasica_geracao_value_key', esc_attr ( $_POST[ 'fichasvtmbasicas_geracao_field' ] )); //para Geração         }              add_action( 'save_post', 'fichasvtmbasicas_save_meta_box_data' );      Edit: I changed my code for               function fichasvtmbasicas_meta_box_callback( $post ) {     wp_nonce_field( 'fichasvtmbasicas_meta_box', 'fichasvtmbasicas_meta_box_nonce' );     $selecionargeracao = isset( $fichasvtmbasicas_geracao_field['fichasvtmbasicas_geracao_field'] ) ? esc_attr( $fichasvtmbasicas_geracao_field['fichasvtmbasicas_geracao_field'][0] ) : '';     echo '
';     _e( 'Geração:', 'fichasvtmbasicas_textdomain' );     echo ' ';     echo '<select id="fichasvtmbasicas_geracao_field" name="fichasvtmbasicas_geracao_field">';     echo '<option value="geracao15"' . selected( $selecionargeracao, '15' ) . '>15</option>';     echo '<option value="geracao14"' . selected( $selecionargeracao, '14' ) . '>14</option>';     echo '<select>';     echo '
';          function fichasvtmbasicas_save_meta_box_data( $post_id ) {     if ( ! isset( $_POST['fichasvtmbasicas_meta_box_nonce'] ) ) {         return;     }          // Verify that the nonce is valid.     if ( ! wp_verify_nonce( $_POST['fichasvtmbasicas_meta_box_nonce'], 'fichasvtmbasicas_meta_box' ) ) {         return;     }          // If this is an autosave, our form has not been submitted, so we don't want to do anything.     if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {         return;     }          // Check the user's permissions.     if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {              if ( ! current_user_can( 'edit_page', $post_id ) ) {             return;         }          } else {              if ( ! current_user_can( 'edit_post', $post_id ) ) {             return;         }     }         if ( ! isset( $_POST['fichasvtmbasicas_geracao_field'] ) ) { //para Geração         return;     }     update_post_meta( $post_id, 'fichasvtmbasicas_geracao_field', esc_attr ( $_POST[ 'fichasvtmbasicas_geracao_field' ] ));     }     add_action( 'save_post', 'fichasvtmbasicas_save_meta_box_data' );      but still can't save my data. I have more metaboxes on the same function and they are saving the data, just the select don't save it.


Author Tracking Code!

I need help with coding this piece. Basically i want with someone click on my author page. It stored a cookie of that author name and email. I want the cookie to stay in place untill the person close their browser, or however long. not a big deal. I should then be able to use this info in any gravityform on my site. Basically i am tracking leads generated by my authors. If you have a better way of doing this, i am happy for suggestions. Thanks . Heres is my current author.php code to get the author info               <?php     if(isset($_GET['author_name'])) :     $curauth = get_userdatabylogin($author_name);     else :     $curauth = get_userdata(intval($author));     endif;          ?>


Wondering how to turn your firefox bookmarks into a WordPress blog?

I was wondering this, too. I tried and spent quite a few hours trying, but I was finally able to proceed. I discovered a few things that won't be obvious to most people along the way, so I'm posting some steps here. You should be able to have this set up on a test server for a test yourself in no time. If anyone has found an alternate way to do it, please let me know. First, I had wanted all of my bookmarks to be organized somewhat, and though there are some tagging extensions for firefox, a lot of them seemed too bulky. In retrospect, I could have tried some of them first. I chose to use `delicious.com` (formerly `del.icio.us`) to tag my bookmarks for me. It seemed the simplest way to go about it, and most of the 1,500 bookmarks I had were known to that site, so tags were available. You will be able to use the firefox delicious extension, or import directly to their website. They have an API, and hidden inside it is this URL `http:// username:password@api.del.icio.us/v1/posts/all` which should get you to having your bookmarks, now with tags, as an xml file. Next, you'll use the script from here http://memografia.com/wordpress/delicious-to-wordpress-importer/ to import it as a blog. But you can't put this script in your plugins directory and make it work! WordPress 3.0 changed the way they do the importers, BUT they left in some legacy support (though this isn't really documented anywhere.) Simply make folder named 'input' in the wp-admin folder and drop the delicious.php file in there. (This works with any importer script that uses the register_importer() function.) Now when you go to your dashboard and look under Tools>Import you'll see that Delicious is an option. You can import the bookmark tags as categories or tags and it'll make a post for each bookmark. If anyone tries this out I'd love advice on what to do next. I reseached how to do this so I could get a handle on my bookmarks and comment on the ones that were most useful. I can do that, but if anyone knows of any plugins that would grab excerpts to flesh things out, please let me know. It is rather neat to have an archive of your bookmarks that can easily be sorted by time.


How can I enable Google Analytics on a file download link?

I'm using Wordpress to present some software for download. The download links are provided via Custom Link entries in a side menu. I would like to enable Google Analytics tracking for these file downloads but I can't see how I can add the required javascript triggers as per the example here: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55529. Can anyone offer a way of achieving this? Edit: By "Custom Link", I mean that the file links are created in a custom menu as custom links in the Appearance->Menus area of WP3. I'm using the Atahualpa theme, if that makes any difference. Further Edit: I'm trying the plug-in route, which will hopefully automate the process, but another possibility I've found is to use the "Text" widget and simply paste the menu code in there and edit in the javascript trigger on the links. This is obviously more of a pain to maintain. I would add this as a possible answer, but I can't answer my own question, apparently. Outcome: Thanks for the responses. I've ended up going with the Text widget and just hand-coding the menu for now. I'm not sure why the answer simply pasting the info from the link I gave in the question is being up-voted as it doesn't address how to do this _in Wordpress_. A plugin that allows adding onclick handlers to the custom links or similar would be best, but I can't find one and "if you had a unicorn" isn't an answer either. I may come back to the coding suggestions but the creation of useful GA identifiers seems difficult to do automatically, which seems to lead back to effectively writing my own plugin... and surely that's an answer to almost anything?


Can I setup WordPress in a subdirectory and then point my URL to the subdirectory when I'm ready to go live?

I have a client that has a current WordPress installation in their website root, and they are creating a new WordPress site which is in a subdirectory during development. My question is, what do I do when they are ready to go live and replace their current WordPress install with the new dev version? Can they just point their main URL to the subdirectory instead of having to move the entire dev site into the root of their website? Will this work with WordPress?


Avoid class name collision when using third party libraries in plugins?

I am currently developing a Wordpress plugin handling very specific behaviours in our new Wordpress website. I started by reading the introduction articles in the Codex, and I also found the Wordpress plugin boilerplate. It is said that > to avoid function and variable collisions, we should enclose our functions > inside a class, which should be named after our plugin. The boilerplate already seems to handle that, fine! However, I also expect to use third party libraries for my plugin (Swiftmailer, Mixpanel, etc.), which will be placed in '/wp- content/plugins/myplugin/includes'. My question is, what if an other plugin also uses one of those libraries in its code? Swiftmailer is a pretty common library, so an other library could load it when initialized. There will be a collision (a class cannot be redefined in PHP). Are there mechanism in Wordpress to handle that ? Or does somebody already have a solution for this kind of issue ?


delete post also attachments

I am trying to delete a post with its all attachments. This is the function that i came up with right now;               function remove_post(){                 if(isset($_POST['post_id']) && is_numeric($_POST['post_id'])){                     $post = get_post($_POST['post_id']);                     if(get_current_user_id() == $post->post_author){ echo 'ee';                         wp_delete_post($_POST['post_id']);                     }                 }                        exit;             }      This deletes the post but not the attachments link to that post also its not hard deleting, the post remains in the trash. So what do you think? Thanks.


Deploying from local to dev: pages do not work

So I have deployed a WP that was local to a dev environment. I have done the following:   * Deployed files via FTP   * Imported DB via PHPMyAdmin   * Modified home and siteurl values in the _options table So far, the landing page works fine, however as soon as I try to change page, it doesn't work. It may be interesting to say that I have deployed onto a URL like http://dev.example.com/project-name/. I cannot put it at the root, this dev servers is used to present multiple projects. I am not at ease with databases, deployments or htaccess things, so if you must explain with these things, please be gentle with me. Any help is appreciated.


Plugin updates, version dependencies, and backwards compatibility

Let's say I have a plugin that's currently at version 1.1, and I am releasing version 1.2. When you run the 1.2 update, a script will run to add new options, columns, tables, etc. A month later, 1.3 is released. Do I still need to include the update scripts in version 1.2 so people can update the plugin from v1.1 _directly to_ v1.3? Is there a way for WordPress to automatically download v1.2, run the update scripts, and then download v1.3, or do I need to include some sort of flag in v1.3 that says "if upgrading from 1.1 or below, run the v1.2 update scripts first"? In other words, is there a way to flag v1.3 of my plugin and say, "you need v1.2 or higher of this plugin for this update to work"?


Aliasing a subdomain on a wordpress network

I have a subdomain network install with the primary at http://test.domain.com. One of the sub-sites exists at http://sub.test.domain.com. I'd like to be able to access that sub at http://honky.domain.com but I'm stuck on how to make that work. Ideas? Also, I'd yet another alias to access that sub, but by a different domain. In other words, I'd also like to access that sub at http://www.supercooldomain.com. No idea how to make that happen either. FWIW, I'm using apache as the web server.


Use a higher than 230px logo image with 2013 theme

**UPDATE:** My question is not offtopic, because WordPress crops the logo image and not just CSS. I'm trying to use a 4724 × 2362 png image as a site logo at the top of a WordPress website with the stock Twenty Thirteen theme. By default the image height is cropped (here fullscreen) and you can't see the face of the person sitting at a table: ![website screenshot](http://i.stack.imgur.com/GDtPQ.png) Being a WordPress newbie I have edited the section 4.1 in the file `wp- content/themes/twentythirteen/style.css` and changed 230px to 500px:               .site-header .home-link {             color: #141412;             display: block;             margin: 0 auto;             max-width: 1080px;             min-height: 500px;             padding: 0 20px;             text-decoration: none;             width: 100%;     }      Now the "header" is higher, but my problem is that the image is still cropped (I think at the moment when I set it as the "header image" for the theme 2013). Please advise me how to fix this, probably by editing some PHP file under `wp- content/themes/twentythirteen`?


How much maintenance is required to run a WordPress server?

I recently started a blog at wordpress.com, but I am considering moving to a self-hosted WordPress to get access to plugins such as MathJax and Markdown and probably several others I will discover along the way. I am reluctant to do so, because running at my own website will inevitable require some maintenance (I will not be maintaining the HW, just using some standard webhosting service). How much work is required to maintain WordPress? That is, how often are there security updates and new versions that you will probably want? How difficult are updates to perform?


get_post_meta not working inside loop

I was hoping for some assistance with a custom meta box that I added to my genesis child theme. The data is being saved properly, and stored properly, but when I try to echo it out using get_post_meta, nothing shows up. But a custom function someone showed me does echo it out. Can someone figure out what it isn't working? This should work but doesn't.               add_action ('genesis_before_post_content', 'gteh_tagline');     function gteh_tagline() {         $meta = get_post_meta($post->ID, $field['dbt_text'], true);         echo $meta;         }      This works but I don't want to use this, would rather use the proper code               add_action ('genesis_before_post_content', 'gteh_tagline');     function gteh_tagline() {         echo "
";         $customs = get_post_custom(get_the_ID());         $text = (isset($customs['dbt_text'][0]))?$customs['dbt_text'][0]:"";         var_dump($customs);         echo "
text=".$text;         echo "
";     }      It dumps this and echoes it out when asked.               ["dbt_text"]=>     array(1) {     [0]=>     string(89) "At vero eos et accusamus et iusto odio dignityr simos ducimus qui blanditiis praesentium "     }      Here is dbt_text               $prefix = 'dbt_';     $meta_box = array(     'id' => 'my-meta-box',     'title' => 'Post Tagline',     'page' => 'post',     'context' => 'normal',     'priority' => 'high',     'fields' => array(         array(             'name' => 'Post Tagline',             'desc' => 'Displayed below the post title',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ''         )     )      );


Get number of comments per page

I am trying to grab number of comments to display per page. So far unsuccessful, looking for something similar to this `$wp_query->max_num_pages;` Thanks.


How do I use get_query_var() within plguin code

I am tring to access the author's id using               get_query_var('author')      , but this only seems to work on the page, not within plguin code. How do I access this from within plugin code?


Church hope them issue

I'm using the church home theme and can't figure out how to modify the three images under the download button page. http://themeforest.net/item/churchope-responsive-wordpress- theme/full_screen_preview/2708562 they say life groups , New here, Every Penny helps The appear on my home page and its the default content.


Display Audio Attachment URL

To get the image url from a Post Thumbnail in WordPress to display it in a template, I would use:               <?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'large'); $image_url = $image_url[0]; ?><?php echo $image_url;?>      I'm trying to do the same for a MP3 uploaded to a post. I had a snippet a while back to get it done, but I don't know what happened to it. How can I do the same for a MP3 uploaded to a post?


Trying to display posts but getting the pages as output

I am trying to display the posts on my front page of the `roots theme's base.php` file. I have added the loop as               <?php while (have_posts()) : the_post(); ?>         <?php             echo '<h2>';             the_title();             echo '</h2>';             the_content( 'Read the full post »' ); ?>     <?php endwhile;?>      However, this keeps displaying just the content and title from the first page. How do i get it to display the posts? I have set the number of posts as 3 under settings -> reading .


Role scoping for contributors down to the field level

We've been looking for a Wordpress plugin or system that lets you scope admin/contributor "roles" down to the field level. We have an immediate need for something like that, but totally coming up empty on options. There's a ton of options that let us scope down to a custom post type, but not necessarily the fields within that custom post type. So far, the only solutions I've found let you customize admin user access to a custom post type, page or post, like add/edit/delete on the custom post type itself; but I haven't been able to find a solution that says "John Smith only gets to edit XYZ custom fields, and read-only access to the rest of the data for an entry". **For example:** > We might have a custom post type called "Inventory", and it may have title, > description, stock number, features, price, status. We'll have sales people > able to edit "description" and "features, but they are not allowed to edit > any of the other information. Those are created when the listing is added by > a manager or website admin. I'm at my wit's end with this, and not sure what the appropriate path to take might be. I may be stuck creating the CMS from scratch as we used to do in the old days. Which would be okay...if not for the timeframe deliverable given to me. That said, if I were not able to find this all wrapped up in a nice plugin (paid or otherwise), is there a way for me to build out the custom post types and fields ahead of time, then apply some type of "functions.php" logic that adds the limitations I'm attempting to impose?


Get author id from url

I am trying to get the authors `user_id` on a page linked to by using `get_author_posts_url(),`. For example               http://example.com/author/John%20Smith       where `John Smith` is `user_id` is `23`. I need to get `23`.


Multiple loops breaking side bar

Trying to put a bunch of loops in the side bar using WP_query.
     <?php $category_query_string = new WP_Query(array( 'post_type' => 'page' , 'posts_per_page' => '-1' , 'post_parent' => '413')); if ( have_posts() ) : while ( $category_query_string->have_posts() ) : $category_query_string->the_post(); ?>          <div <?php          $catspacetitle = get_the_title();          $cattitle = str_replace(" ", "-", $catspacetitle);               echo 'id="',$cattitle,'"'           ?> class="FL-pest-cat">     <p <?php          $pcatspacetitle = get_the_title();          $pcattitle = str_replace(" ", "-", $pcatspacetitle);               echo 'id="',$pcattitle,'-title"'           ?>class="FL-pest-cat-title">       <?php the_title(); ?>
               <?php          $postid  = get_the_ID();          if ($postid == '654') {          $curretnCat = '11';}     elseif ($postid == '661') {          $curretnCat = '12';}     elseif ($postid == '662') {          $curretnCat = '13';}     elseif ($postid == '664') {          $curretnCat = '15';}     elseif ($postid == '665') {          $curretnCat = '16';}     elseif ($postid == '666') {          $curretnCat = '17';}     elseif ($postid == '668') {          $curretnCat = '18';}     elseif ($postid == '669') {          $curretnCat = '19';}     elseif ($postid == '670') {          $curretnCat = '20';}     elseif ($postid == '671') {          $curretnCat = '21';}     elseif ($postid == '673') {          $curretnCat = '22';}     elseif ($postid == '674') {          $curretnCat = '23';}            echo '
';       echo '
';          $query_string = new WP_Query(array( 'post_type' => 'Pests', 'posts_per_page' => '-1' , 'cat' => $curretnCat )); if ( have_posts() ) : while ( $query_string->have_posts() ) : $query_string->the_post(); ?>
         <p <?php          $pestspacetitle = get_the_title();          $pesttitlesearch = array(' ', '(', ')', '.');          $pesttitlereplace = array('-', '', '','');          $pesttitle = str_replace($pesttitlesearch, $pesttitlereplace, $pestspacetitle);               echo 'id="',$pesttitle,'"'           ?>class="FL-pest-indv-title"><a href="<?php the_permalink(); ?>">            <?php the_title(); ?>

     <?php endwhile; endif; ?>     <?php   wp_reset_query(); ?>

     <?php endwhile; endif; ?>     <?php   wp_reset_query(); ?>
      It just ends up breaking the page, but works on it's own as a page template.


How can I add my_account_item to my custom theme?

Now I am creating a theme for my website. But now on my theme I need to add user account item (`my_account_item()`) that is shown on my admin bar. ![enter image description here](http://i.stack.imgur.com/FqSbI.png) On above image shows my theme part and admin_bar. I need to add this admin bar to my theme. On my image there is a red rectangle named admin,there I want to place admin avatar and **drop down** menu like **admin_bar**.


WordPress keeps resizing my 947x947 image down to 500x500 (full-size option)

This is driving me crazy. The code for the image is: `<img src="MYLINK" />` Yet it keeps resizing my image down to 500x500 from 947x947. How do I fix this? Also, it disregards the image map I have which lets you click on different parts of the image to go to different sites. EDIT: This is what I'm referring to: http://macaulay.cuny.edu/eportfolios/menatwork/test-page/ Right click and check the image properties: it shows how the 947x947 has been scaled to 500x500.


Some user's cant see custom taxonomy meta-box

I have strange problem with users who can not see metabox with custom taxonomies. When I delete user and create him again problem is solved, but this is not the best solution :) All my taxonomies are created in functions.php (https://gist.github.com/palcas/aaa87ab9915e08c79c84) Some of them have 20000+ terms (I don't know is this may cause the problem). For displaying terms of taxonomy in metaboxes (with dropdown's) I use this code (https://gist.github.com/palcas/0542c35119d54b4ca7df). And for grouping metaboxe's I use this js file (https://gist.github.com/palcas/c85849618d0ac2fe6261). Where did I made mistake? I hope I provided all information everyone could need to help me solve this strange problem :)


Any ideas how to allow CSS input to perfectly work in the text area with wp_kses?

I'm having issues with wp_kses. I have a text area that allows CSS input (only) While the rest of the CSS gets through (don't have any issues ever since). Until one user , inputs a CSS Code like this one:               li > mycolor { color: blue; }      It will be rendered like this (after passing through the filter):               li > mycolor { color: blue; }      The greater sign is passed through entities. Any ideas how to make this work while still having the filter?


Difference between add_filter and apply_filters

I have searched for a suitable explanation of the difference between `add_filter()` and `apply_filters()` in here but couldn't find one. Can anyone tell me what information or logic to consider before using `add_filter` or `apply_filters` in one context. Hhat makes the use of one imperative and not the other ? Is it correct that `add_filter` just adds a function to the queue of functions waiting to be executed on a variable and `apply_filters` executes the functions in order? Is it also correct that `apply_filters` when called with an argument (the name of the function to be run) will execute that function before all the others (if they exist) in the queue?


content summary of a post disappears If an images added at the beginning of the post. how to solve it?

If I put an image at the beginning of the post my content just disappears at the home page. but when I click read more button it shows full content ( **single.php** ) **index.php**               <?php     if (strlen(get_the_content()) > 10) {         $content = get_the_content();         echo str_replace(' ', '', substr($content, 0, 50)). "....";     ?>      How can I show the content summaryon the home even I add an image at the beginning of the post? Any help will be very much appreciated....


Pagination is not working on custom query

I have `custom query` with different conditions so that's why my `pagination` is not working with it. When i click on next button it show me the same posts. The `query` i am using are               <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;?>          if($selectedoption){                             $args = array(                                 'posts_per_page' => 30,                                 'paged' => $paged,                                  'post_type' => 'post',                                  'include' => $catID02,                                 'post_status' => 'publish',                                 'meta_query' => array(  array(                                         'key' => $checkkey,                                         'value' => $checktoption                                                     )                                                             ),                                 'author'=> $user_id                                   );                         }                          else if($tag_filter){                         $args = array(                         'posts_per_page' => 30,                         'paged' => $paged,                          'post_type' => 'post',                          'post_status' => 'publish',                         'meta_query' => array(  array(                                 'key' => 'post_state',                                 'value' => $tag_filter                                             )                                                     ),                         'author'=> $user_id                           );                     }     else{      $args = array('posts_per_page' => 10, 'paged' => $paged, 'post_type' => 'post', 'post_status' => 'publish' );                          } ?>               <?php query_posts($args); ?>                <?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>      //content here               <?php endwhile; ?>                     <div class="span10 pagination">                         <?php next_posts_link(); ?>                         <?php previous_posts_link(); ?>                         <?php //if(function_exists('wp_simple_pagination')) {                             //wp_simple_pagination(); } ?>                      </div>                     <!-- pagination -->                          <?php else : ?>     <?php endif; ?>      So what can i do in order to make pagination working. Thanks


Is it possible to disable caching of an option when using w3 total cache?

a plugin i'm working on has a conflict with w3 total cache. To be more specific, in my code i have               static function get_instance()     {         if( self::$_instance === NULL ) {             // get the settings from the database             self::$_instance = get_option( 'ai1ec_settings' );                  // if there are no settings in the database             // save default values for the settings             if( ! self::$_instance ) {                 self::$_instance = new self();                 delete_option( 'ai1ec_settings' );                 add_option( 'ai1ec_settings', self::$_instance );             } else {                 self::$_instance->set_defaults(); // set default settings             }         }              return self::$_instance;     }      The problem lies in `self::$_instance = get_option( 'ai1ec_settings' );` because un incomplete object is returned (this happens only when using w3 total cache, i have declared an autoloader, but doing some debugging it seems that the incomplete object is stored in the cache) This is the error message > Ai1ec_Settings::get_instance(): The script tried to execute a method or > access a property of an incomplete object. Please ensure that the class > definition "Ai1ec_Settings" of the object you are trying to operate on was > loaded before unserialize() gets called or provide a __autoload() function > to load the class definition 1) Is there a way to tell w3 total cache not to cache that option?   2) If not, it would be correct to handle things like this?               try {         self::$_instance = self::getOptionsFromDb();     } catch (Exception $e) {         //Show a friendly error page     }          private static function getOptionsFromDb(){         $ai1ec_settings =  get_option( 'ai1ec_settings' );         if ( ! $ai1ec_settings instanceof self ) {             if (false === $ai1ec_settings) {                 return false; //option was not set in the db             } elseif( class_exists('W3_Plugin_TotalCacheAdmin') ){                 //let's clear thew cache and try again                 $plugin_totalcacheadmin = & w3_instance('W3_Plugin_TotalCacheAdmin');                 $plugin_totalcacheadmin->flush_all();                 $ai1ec_settings =  get_option( 'ai1ec_settings' );                 if ( $ai1ec_settings instanceof self ) {                     return $ai1ec_settings;                 } else {                     throw new Exception();                 }             } else {                 throw new Exception();             }         }        }


Retrieving custom fields with $wpdb->get_results

I'm trying to use `$wpdb->get_results` to retrieve an array of all posts including custom fields. I can retrieve the meta_key and meta_value columns like this:               [meta_key] => state [meta_value] => california      but I'm trying to list them in the object like this:               [meta_key] => meta_value [state] => california [city] => san francisco       The Query:               global $wpdb;     $query = "     SELECT ID, post_date, post_title, post_content, guid, meta_key, meta_value     FROM wp_posts INNER JOIN wp_postmeta     ON (wp_posts.ID = wp_postmeta.post_id)     ";          $results = $wpdb->get_results($query);          foreach($results as $result) {         print_r($result);     }      Is it possible to use an alias and/or subquery to achieve this?               SELECT ID, post_date, post_title, post_content, guid, meta_value AS (subquery here??)


How to protect post attachments related to a custom post type, from non-logged in users, on 1 subsite of a multisite installation?

I'm developing a simple "member's only" section within a website, with the sole intention of allowing the client to post files for their members. I've come to realize quickly that the posts' attachments themselves are not protected in any way within WordPress. For example, if a user was not logged in and if they knew the direct url to the file, they could access it/share it with others. This is a big problem as the documents are rather sensitive to the client' business. The member's area is being built using all the tools you'd expect - a custom page template paired with current_user_can conditionals, wp_redirects, custom roles using the members plugin, and a custom post type for the "file" posts. Each file post within the custom post type has metaboxes that the client can use to attach files/documents (.jpg, .gif, .pdf to name a few). I'm using WPAlchemy and it's Media Access class to satisfy the metabox requirements. The member's area will be running on 1 particular site within a multisite installation, which comprises of 3 sites in total (all related to the same company). I'd be very grateful if someone could steer me in the right direction. I'd prefer not to have to use an array of plugins, as I like to keep things simple and like to know what the code is actually doing. I also realize that this may not necessarily be a WordPress question, and more of a `.htaccess` question (as I've seen from the questions I've come across and their answers), but I can't help thinking that my question is different in that it relates to multisite, and the possible need for a separate upload folder. Here are my thoughts so far on protecting the attachments:   1. I could somehow create a separate media upload directory that the metaboxes upload the files to from each post within the custom post type. Because these files are separated from the rest of the sites' media uploads (only the member's attachments need to be protected) It would make it easier to protect just that folder using .htaccess. 1.1. Is some sort of .htaccess modification definately the way to go here? 1.2. How could I actually create the separate media upload directory, and have WPAlchemy's metaboxes upload the files here? I've seen a `uploads_dir` filter hook but not sure on how to use it.   2. Rather than creating a separate media upload directory as outlined above, maybe the better solution would be to only protect the attachments belonging to my custom post type? But then I have no idea how that ties in with the .htaccess solution. It seems like having a separate folder would be easier... I've seen the following questions that are very similar to my own:   1. How to Protect Uploads, if user is not Logged In? Look like it deals with a non-multisite installation of WP, and also the whole site is a member area vs a section of my site. Remember, I don't want all uploads to be protected, just the ones attached to the custom post type. I do like the idea of passing requests through a php script? Perhaps I could use this script and modify it to use a separate upload directory on the 1 site within my multisite installation?   2. Protect Uploads in Multisite and..   3. How to restrict access to uploaded files? **Update:** Found this thread but no solution to it. Seems like the better way to go if I can get it working. I'll work out how to upload the files to a new uploads directory after I've managed to protect all of the site's files


Order posts by custom field and if custom field is empty return remaining posts

I have an archive page ordered by a numeric value in a custom field. This returns the ordered posts correctly, but does not display posts that don't have a custom field.               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      query_posts("paged=$paged&cat=7&posts_per_page=24&meta_key=custom_order&orderby=meta_value_num&order=ASC");      What is the best way to return the ordered posts correctly, followed by any posts that do not have a custom field value associated with them? **Edit** : Just to elaborate -- The final result that I want to accomplish is a category archive page that has specific posts show up first, followed by the rest. Pretty much like sticky posts, but only for a specific category archive. **Edit Two** : I am trying Jessica's suggestion, and I think we're almost there. The problem is that now if I set to `order=ASC` then all of the posts that have the custom field filled, show up after the posts that don't have a value associated. If I set `order=DESC` then the posts that have a custom field value are returned first, but in reverse. So, it would appear 4, 3, 2, 1, and then the rest of the posts with no value associated. How can I correct the order, so it shows 1, 2, 3, 4, and then the rest of the posts with no value in the `custom_order` field? I have added the following to my functions.php:               function wpse_55791_custom_order($clauses)     {         global $wp_query;              // check for order by custom_order         if ($wp_query->get('meta_key') == 'custom_order' && $wp_query->get('orderby') == 'meta_value_num')         {             // change the inner join to a left outer join,              // and change the where so it is applied to the join, not the results of the query             $clauses['join'] = str_replace('INNER JOIN', 'LEFT OUTER JOIN', $clauses['join']).$clauses['where'];             $clauses['where'] = '';         }         return $clauses;     }     add_filter('get_meta_sql', 'wpse_55791_custom_order', 10, 1);     function wpse_55791_custom_orderby($orderby)     {         global $wp_query;              // check for order by custom_order         if ($wp_query->get('meta_key') == 'custom_order' && $wp_query->get('orderby') == 'meta_value_num')         {             $orderby = "{$wpdb->postmeta}.meta_value='', ".$orderby;         }         return $orderby;     }     add_filter('posts_orderby', 'wpse_55791_custom_orderby', 10, 1);


Is there a spam comment blocker that blocks IP addresses for a limited amount of time?

I'm getting **a lot** of spam on my Wordpress blog. I'd like to cut down on the amount of comments I have to moderate. I'm looking for a plugin that does something like this: automatically marks comments as spam, and allows me to say "yes, this is spam". Once I've marked the comment as spam, block the user's IP address for X number of days. Is there a plugin out there that will do that, rather than me going through and blocking IP addresses manually?


How to remove the parentheses from the category widget

In the default category widget, when you check the "show posts count" checkbox, the number of posts appear surrounded by parentheses, how to remove them.


How do I include background images in my stylesheets in a plugin?

I'm trying to specify a background image in a style in a plugin I'm making. I was just outputing tags from the php, but realized I should probably be using enqueue_style... But how do I put a line of code like this:               .star.half {         background:url(<?php echo plugins_url(); ?>/my-plugin/images/star-half.png) no-repeat 0px 0px;     }      Into a plain .css file? What do I put where it says `<?php echo plugins_url(); ?>`?


How to display an alert when deleting a plugin?

My plugin allows for some custom templates to be installed into it by the user. Problem is, if someone deletes the plugin from WP in order to install a new version, all their custom files get deleted as well. Is there a way to catch deletion and fire an alert warning the user of this, before they delete? Oh and putting their templates into the DB is not an acceptable option.


How to Check If A Plugin Is Enabled Through API?

How to find out if a particular plugin is enabled in a sub-blog in a multisite blog?


Server database problem

> i just transferred my website from shared server to VPS, but then it is not > starting, when i inquired with the VPS technical support then they emailed > me something this, which i am not understanding:- email > >> Your site "www.onlinemba.co.in" has been migrated from your previous host and we are now getting a blank page while accessing the database dependant php files. There seems to be an issue with the database codings as all other php files are accessing fine and there is also no problem with the database connectivity. You can check for the same by accessing the site preview URL "http://38.100.101.228/info.php". >> >> Your Kloxo panel details are >> >> URL : XXXXX User : XXXXXX pass : XXXXX >> >> Server root access detail are as follows >> >> IP : 38.100.101.228 User : XXXXXXX Pass : XXXXXXX >> >> Kindly check your database once with your database developers with the details given above and let us know for further help. > > what should i do? ok well i did some changes for this in wp-config.php, but after that the admin guys from hosting are saying me this: > Virtual host entry for the IP is pointing to different folder ( which > doesn't have any contents ), hence you have received the default page. I > have pointed in to the correct folder "onlinemb". You can view the blank > page, please check and resolve it. i edited the database MySql hostname from local host, to the IP-38.100.101.228 but then he changed again to local host, and again the blank page came, what to do now?


Pagination for custom query won't let me back on page 1

I have a custom query …               <?php     /**      * The loop that displays the posts.      */     ?>
     <?php              $args = array(             'post_type' => array('post', 'wr_raffle'),             'posts_per_page' => 4,             'order' => 'DESC',             'paged' => (get_query_var('page')) ? get_query_var('page') : 1,         );              $loop = new WP_Query( $args );         while ( $loop->have_posts() ) : $loop->the_post(); ?>      At the bottom of this document I have this …               ?>

         <?php             $endsize = $midsize = 1;             $type = 'plain';             $loop->query_vars['paged'] > 1 ? $current = $loop->query_vars['paged'] : $current = 1;                  // Sanitize input argument values             if ( ! in_array( $type, array( 'plain', 'list', 'array' ) ) ) $type = 'plain';             $endsize = (int) $endsize;             $midsize = (int) $midsize;                  // Setup argument array for paginate_links()             $pagination = array(                 //'base'          => @add_query_arg('paged','%#%'),                 'format'       => '?page=%#%#blog',                 'total'         => $loop->max_num_pages,                 'current'       => $current,                 'show_all'      => false,                 'end_size'      => $endsize,                 'mid_size'      => $midsize,                 'type'          => $type,                 'prev_next'     => false,                 //'paged'         => $loop->query_vars['paged']             );                  echo paginate_links( $pagination );         ?>
      Well, I've already read quite a few threads about this but can't figure out why my pagination "almost" works. My pagination works on every page, just if I navigate back to page 1 the pagination link doesn't work. – Before I clicked on Page Number Two: http://cl.ly/TNHx – After I clicked on Page Number Two: http://cl.ly/TN3o (so there is obviously no href for page-number 1) Any ideas why my page number 1 link wouldn't work? Kind regards, Matt


Remove quick edit for custom post type

Is it possible to remove the quick edit function for a custom post type? I have 14 custom taxonomy with hundreds of terms in each and it takes too much time and resource to load all of them into the source-code of the page. I tried to find a solution using google but most of them just hides the quick edit button, but the code is loaded in the footer by wordpress, so it doesn't really make any difference.


Enable comments for author.php

> **Possible Duplicate:**   >  Commenting in user profile page? ## Question I have an author.php page and I need to enable comments so when other users come to that authors page they could leave a short message in a form of a comment. Is that possible? I would really appreciate any help :)


How to display post from one custom post type in another custom post type with the same taxonomy?

I created two custom post types and one custom taxonomy. I wanted to be able to link the two different post types by applying the same taxonomy to both. How could I do this? Scenrio: Custom Post Type One: Places (eg. The Grand Canyon) Custom Post Type Two: Trips (eg. Journey Aboard the Grand Canyon Railway, Grand Canyon National Park South Rim Bus Tour) Custom Taxonomy: Location (eg. Arizona) Now if I add a Place called Grand Canyon and two Trips Called Journey Aboard... & South Rim Bus... I would tag all with the Location Arizona, because they are all related to Arizona. Now, how would I be able to automatically display the list of all Trips that are related to a Place based on the Location that they are tagged with? Also, Is there a better way to accomplish this?


Administration Pages Styling

I am adding administration pages using `add_menu_page()` function. But it wont look good. Check the image below. ![alt text](http://i.stack.imgur.com/5vrEQ.png) I would like to have it as separated and in between Appearance and Plugins section with rounded borders.


After upload on server 404 on all pages, no css

I developed a WordPress based site on using XAMPP 1.8.3. On my local machine everything is working fine. On the server I am using php 5.4.12, I copied the site files into subfolder with the same name I had in xampp/htdocs. I changed all occurrences of localhost to mydomain.com in the database with the searchreplacedb2.php script (http://interconnectit.com/products/search-and-replace-for-wordpress- databases). I am confident that the tool is working properly as I have used it several other times with success. On my local machine the site was in localhost/site, on the hosting server is on mydomain.com/site. The problem is that accessing the site home page produces a WordPress managed 404 page with no CSS being loaded. The title, menu and other site specific text is displayed, therefore the db is being read correctly. Trying to access any page other than the home page gets a Webhost managed 404 page. This happens also if I try to access page through non symbolic urls, ei. mydomain.com/site/?page_id=5; therefore it is should not be a redirection issues. What can be the issue? How can I proceed in troubleshooting it?


Use of wp_insert_post and parameters

I've JUST started using WordPress..i'm trying to add posts to Wordpress using php and i came across this piece of code:               // Create post object     $my_post = array(       'post_title'    => 'My post',       'post_content'  => 'This is my post.',       'post_status'   => 'publish',       'post_author'   => 1,       'post_category' => array(8,39)     );          // Insert the post into the database     wp_insert_post( $my_post );      i understand this is the way to go when creating a post using php..my questions are:   1. how do we execute the above php script and where do we save it in the WordPress folder?   2. what does the 'post_category' array mean(i'd like to use a category id to add posts to WordPress)? i'd like to mention that i've done some descent searching on the net but the resources i've found do not mention how to execute the above script.


Removing action from template class

I'd like to replace an action in a theme with my own version in a child. In this case, the theme hooks into `wp_head` to add it's own links. My own functions.php resides in the child theme and looks like this:               global $SMTheme;     remove_action('wp_head', array($SMTheme, 'headtext'));     add_action('wp_head', 'custom_headtext');      Unfortunately, it's not working yet and I'm fairly new to this. This is how the theme adds it's action:               class SMTheme {       var $options;            function SMTheme() {         // some unrelated code here                  include TEMPLATEPATH."/inc/settings.php";         $reset='';         // if (current_user_can('administrator')) {}         $this->getparams($settings,$reset);         add_action('wp_head', array(&$this, 'headtext'));       }


Help with static front page blog at /blog

I'm interested in installing wordpress and having a static front page and have link to the blog at /blog. How do I install wordpress in the root directory, but have the blog live at /blog I see how I could do it for the blog urls, but do I just change the wordpress url in general settings for this? Thanks.


How to control accept encoding on HTTP API requests?

Related to this ticket about issues with inflating data. So far it had been suggested by API's support to request gzip instead of deflate. However I cannot find a way to override WP settings that set deflate with highest priority as accepted encoding for all requests. Related functions - `WP_Http_Encoding::is_available()` and `WP_Http_Encoding::accept_encoding()`. Is there any hook or other option to control this that I am missing?


Trouble highlighting correct menu parent with wp_nav_menu classes while viewing "single posts"

I just updated a menu on a site of mine to utilize wp_nav_menu. Setting this up with WP was fairly straight forward however I've run into one small snag with the the way wordpress is outputting its parent/ancestor classes for use in highlighting the current page that the content belongs to, _particularly with single post pages_... Highlighting the current page with `.current_page_item a` and `.current_page_parent a` works perfect as long as its just on a normal page with children, **however as soon as you visit a post from _events_ or _media_ , the blog link in the menu is highlighted instead which is incorrect obviously**. *One thing noticeably wrong when looking at Wordpress' output is that the current page classes are not even being generated on the correct _li tag_ that the post belongs to which seems to be the root of the problem. For future reference, the Events, Media, & Blog pages all use a special query I've written to only grab the respective category for that page, ie.               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts("category_name=media&paged=$paged");          if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <div class="post">     </div>     <?php     endwhile;     else:     endif;      > **It should be noted** : I have a secondary loop in the footer grabbing the > latest blog post, dunno if this could be the culprit but Id like to keep > that as is since it was placed there upon request of the client. > > -- I take it back, I removed the secondary loop in the footer to see what > would happen and the same results occurred so its not the problem as far as > I can tell. Hope thats enough info, if not let me know. Best, SB


Make changes of wp-db.php file persistent against updates

I've added `$this->query("set session wait_timeout=600");` into `wp- includes/wp-db.php` file because of "MySQL has gone away" errors in every query and I need to find some way to do the changes in file persistent (I suppose update of WordPress rewrites `wp-db.php` file). Any ideas? Thanks


permalink is only showing relative path in dashboard

Permalink: /blog/blog/      My permalinks are only showing as relative. In the database for each post and image they are stored as relative urls as well. When a user tries to share an article to social media, only the relative path is being shared and the links become broken. Is there a simple setting for this without doing a find and replace in the database?


Custom theme hooks / filters - passing arguments

I'm getting confused trying to implement these custom theme hooks. Trying to wrap my head around that. I thought i understood this. but now after reading code for several hours; it's made it worst. How do i modify the argument being passed in the following? `functions.php`               function theme_content() {        do_action('theme_content'); // Initialize my custom hook     }               function theme_content_alter($arg) {        // Do processing        if (!$arg) {          echo '
default
';        }        if ($arg == 'foo')  {          echo '
bar
';        }             echo apply_filters('theme_content','theme_content_alter', $arg);     } add_action('theme_content', 'theme_content_alter');      `index.php`               theme_content($arg = 'foo');      **What i'm trying to achieve** Being able to override hooks and handle contextual processing inside a functions or a separate file from a require. **An example:** on a front page i want theme_content() to have no sidebar but on a subpage it'll contain a sidebar, etc. This could be expressed like so: Is this the proper way to do this? I've tried to write it in my theme and haven't been able to figure out why it's not working. My arguments are not being passed in the parameters. **What i have done** Reviewed several threads on this SE and found them not very helpful for my context:   * Explanation for apply_filters function and its variables   * get_template_part vs action hooks in themes   * Difference Between Filter and Action Hooks?


How do I enforce a 404 status for an EXISTING page?

I was able to replace the main query for 404 pages with pre_get_posts but as soon as I point to an existing page, the error changes to 301. What function should I hook to to change the status to 404 AFTER a page has been found? The relevant working code is               $query-> set('p' , null);     $query-> set( 'page_id' , $some_page_id);     $query->set_404();     status_header(404);     nocache_headers();      Please, don't suggest using a 404.php page, unless you can explain all the default behavior I should hack to avoid creating one. ( I want to be the one who decides if doing it otherwise is not worth the try, rather than accepting other's limits). Thanks.


Set the default category of an attachment

I wanted to apply the same categories that exist for posts to attachments, so I wrote this code:               function wpmediacategory_init() {         register_taxonomy_for_object_type( 'category', 'attachment' );     }     add_action( 'init', 'wpmediacategory_init' );      The problem I am having now is that behaviour is not quite like with posts. There a 2 features I would like to achieve:   1. When adding a new attachment, set it to "Uncategorized"   2. When updating an attachment, if it has no categories selected, set it to the "Uncategorized" category. I have been trying to think what hooks I could be using, but without much success. How could I solve this problem?


Delete row of custom table in WordPress using AJAX

From my custom table (`$table = $wpdb->prefix . 'user_req';`) I'm showing data with `$wpdb->get_results()` and a foreach loop: ![my table](http://i.stack.imgur.com/qYE22.png) I managed to update the database with the individual values from the form where there is a "Submit" button. But, from this table I want to delete any of the row by clicking on the `(x)` button on the right of each row. I can use `$_GET[]` and can easily delete the row, but in this case I want to use AJAX. The `(x)` button on the right of each of the row is actually:               <input type="button" class="delete" title="Exclude This One"/>      I'm not a code-background, so I'm actually struggling with it. Most of the solution comes when I search, are for raw PHP-mySQL, but I'm trying to deal it with a WordPress way. I could prepare my $wpdb delete query:               <?php $wpdb->delete( $table, array( 'post_id' => $products->post_id ) ); ?>      But couldn't manage to go with it in an WordPress-AJAX way. Therefore, any help would be greatly appreciated.


how to show images in slider direct?

i am newbie in wordpress. i am using http://wordpress.org/support/plugin/nextgen-gallery plugin to show albums... you can have look of my site http://server.clickmak.com/demo.. when i click on any of the albums its opening gallerias and when i click on any of the images then slider will get open... i don't want like this. i want when i click on album link i want to open direct slider with images... in short i don't want to see gallerias page.. please give me some suggestion Thanks in advance


Conditionally set post_content in wp_insert_post

Is it possible to conditionally set the post_content in wp_insert_post? Im using a foreach to add multiple pages at once:               foreach ($create_pages as $new_page) {         $add_pages = array(             'post_title' => $new_page,             'post_content' => '', // lets say, if the page_title is 'Home', set the post_content to 'Default home page content'             'post_status' => 'publish',             'post_type' => 'page'         );         $page_id = wp_insert_post($add_pages);     }      Would it be also possible to set the default content for all the pages inside a php file?


Adding custom Bulk Actions

I have been looking around for ways to add custom Bulk Actions to the categories page. Most of them say that it is impossible to do it in a clean way, because of the lack of a hook for this. Most of the solutions include using JS in the client side to add the options though DOM manipulation. While this works, it is still quite an ugly solution. Most of the articles I have been reading are about 2 year old, so I was wondering since then to the present a new hook or solution has been added to this problem, to have a more up-to-date solution to this problem.


Not showing up on Wordpress Reader

I'm hosting a WordPress site on Name.com (using Jetpack). Although I can access my blog stats, etc. from wordpress.com, my posts aren't showing up on wordpress.com's reader or under topics. I haven't broken any WordPress rules (excessive tags, crappy content, etc.). Any idea how to get my posts to show up on the reader?


custom post type and taxonomy URL

I'm using following code for my custom post type               function resources_custom() {         $labels = array(             'name'               => _x( 'Resources', 'post type general name' ),             'singular_name'      => _x( 'Resources', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'book' ),             'add_new_item'       => __( 'Add New resources' ),             'edit_item'          => __( 'Edit Resources' ),             'new_item'           => __( 'New Resources' ),             'all_items'          => __( 'All Resources' ),             'view_item'          => __( 'View Resources' ),             'search_items'       => __( 'Search resources' ),             'not_found'          => __( 'No resources found' ),             'not_found_in_trash' => __( 'No resources found in the Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Resources'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our products and product specific data',             'public'        => true,             'menu_position' => 5,             'menu_icon' => get_template_directory_uri(). '/images/image-empty.png',             'supports'      => array( 'title', 'editor', 'thumbnail'),             'has_archive'   => true,         );         register_post_type( 'resources', $args );          }     add_action( 'init', 'resources_custom' );      and use the following code for taxonomies,               add_action( 'init', 'create_resources_taxonomies', 0 );          function create_resources_taxonomies() {         $labels = array(             'name'              => _x( 'cat', 'taxonomy general name' ),             'singular_name'     => _x( 'cat', 'taxonomy singular name' ),             'search_items'      => __( 'Search category' ),             'all_items'         => __( 'All category' ),             'parent_item'       => __( 'Parent category' ),             'parent_item_colon' => __( 'Parent category:' ),             'edit_item'         => __( 'Edit category' ),             'update_item'       => __( 'Update Category' ),             'add_new_item'      => __( 'Add New Category' ),             'new_item_name'     => __( 'New category Name' ),             'menu_name'         => __( 'Sections' ),         );              $args = array(             'hierarchical'      => true,             'labels'            => $labels,             'show_ui'           => true,             'show_admin_column' => true,             'query_var'         => true,             'rewrite'           => array( 'slug' => 'cat',             'with_front' => true,             'hierarchical' => true ),         );              register_taxonomy( 'genre', array( 'resources' ), $args );     }      Well, my url for custom post archive is : example.com/resources for custom post taxonomies is : example.com/cat/test-taxonomy and for posts is : example.com/resources/test-post is there any way to use "resources" instead of "cat"? So the custom post taxonomies URL should be like this : example.com/resources/test-taxonomy


Alternative to using get_avatar function?

I used a WP hack for displaying author's pics. For example, my single.php has an author slug which displays the author's pic. I created a folder called authors in my theme/images folder. Based on the author's ID, I name the file 1.jpg, 2.jpg and so on. So I call this image as               <img src="<?php bloginfo('template_directory') ?>/images/authors/<?php the_author_ID()?>.jpg" alt="<?php the_author(); ?>">      Now i'm modifying a plugin that displays the authors in the sidebar. However this plugin uses the get_avatar function, which is as follows:               /**                      * If show avatar option is checked, add get_avatar function to cache.                      */                     if($jmetc_options['show_avatar'] == 1) {                         $jmevar['cache'] .= get_avatar($tc->comment_author_email, $jmetc_options['avatar_size']);                     }      Can someone advise me on how to use/modify the get_avatar in order to use the default code that I use?


Add # to submenu URLs automatically

I'm trying to replace all my child page URLs to include a # automatically example: http://www.website.com/parentfoo/#childfoo I tried using `wp_setup_nav_menu_item` to run through all the child menu items and add '#' to it but now $menu_item->post_name brings up the ID so I don't know how to replace the string correctly. What I have so far:               function auto_hashtag( $menu_item ) {         if ( ! is_admin() && $menu_item->post_parent > 0) {                  // url             $url = $menu_item->url;             // slug             $slug = $menu_item->post_name;             $menu_item->url = str_replace($slug, "#"+$slug, $url);         }              return $menu_item;     }     add_filter( 'wp_setup_nav_menu_item', 'auto_hashtag' );


How to show pages in menu without link

I need to have a menu like this:               - a (link to a)     -- b (link to b, children of a)     -- c (link to c, children of a)     - d (NO LINK, #)     -- e (link to e)      I have the menu composed by the pages, as wordpress default. I want that "d" links to nothing (#), because i have a blank page and it doesn't have sense to exist. How can i achieve this?


Why permalinks work with /index.php/%postname% but not with just %postname%?

I'm having a problem with Wordpress permalinks. I change the permalinks to pretty permalinks but I am just getting 404s for the pages now. The strange thing is when I use /index.php/%postname% the page links work fine, but I need to get rid of the index.php part. I read about making changes to httpd.conf file but can't find the file anywhere. The htaccess file is correct as far as I can find out, it's below               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      Any other ideas? Thanks Emma