how to implement next/prev within category archive?

I click on a link in my WP site to open a category archive. I see a list of posts for that category. I click on the permalink of one of those posts to see the full post. at the top of the window are prev/next arrows. I click on them expecting to be taken to the prev/next post within the same category, but that doesn't happen. I'm taken instead to the prev/next post within the post_type=post collection of posts. is it possible to set up the system so that when a post is displayed from a category archive, clicking on the prev/next buttons takes the visitor to the prev/next post within the same category?      ### update I apologise for the lack of detail.   for those people who need more information...   the category archive/listing currently loads a default 'index.php' template.   each post within the archive list has a permalink link.   the permalink link loads a default 'single.php' template (note. there can only be one permalink per post) Michael is correct. the theme is using the next_post_link() and previous_post_link() functions. the in_same_cat parameter is interesting but not really useful because it refers to the categories of the currently viewed post, not the category currently being viewed. a method would be needed to indicate that a specific category is being viewed, and it's id, so that the current page could point to the previous/next posts in that specific category rather than the complete collection of posts. I'm wondering if the permalinks would need to be adjusted on the category archive page to indicate that a category is being perused; eg, add a query to the permalink; '&cat=7'. the single.php page could then check for presence of the query variable and react accordingly. if this method was used, would I need to use a non-core variable to prevent WP from loading the wrong template? or... would it make sense to create a category.php page with a loop of only one post per page? again, my apologies for not giving specifics in the initial question. cheers,   Gregory


Weird: /?name in URL leads to blog

This is a strange behavior I can't come up with a good explanation for: **If you append`/?name` to a WordPress URL, it is loading the blog page.** I came up with it by creating a custom Aweber "thank you" page, which is supposed to load at http://mydomain.com/thank-you. However Aweber appends a lot of information to the URL via query strings, so the URL ends up being something like: `http://mydomain.com/thank- you/?email=my%40email%2ecom&from=my%40email%2ecom&listname=name&meta_adtracking=location&meta_message=1&meta_required=email&name=&submit=Submit` This doesn't open the thank you page but the blog. As soon as I remove the `name` part, it loads the correct page. And reverse engineered: every WordPress page seems to load the blog if `/?name` is appended to the URL. See:   * rollingstones.com (I'm not allowed to post 2 links)   * rollingstones.com/?name (Interestingly enough the rolling stone example doesn't affect pages. `/band/` stays `/band/` even when going to `/band/?name`. In my example it also affects the page) Any ideas where this behaviour comes from, and how to overcome it? Thanks!


Using Ajax in the prev_posts_link and next_posts_link

I am using the add_filter() function in my functions.php file, to give my prev_posts_link and next_posts_link individual classes. The following code successfully loads the individual classes, prev_button and next_button.               add_filter('next_posts_link_attributes', 'posts_link_attributes_1');     add_filter('previous_posts_link_attributes', 'posts_link_attributes_2');          function posts_link_attributes_1() {     return 'class="prev_button" onclick="javascript:ajax_loadContent(\'box-right\',' .      next_posts_link() . '");return false"';     }          function posts_link_attributes_2() {     return 'class="next_button" onclick="javascript:ajax_loadContent(\'box-right\',' .      previous_posts_link() . '");return false"';     }      I am also using the `onclick="javascript:ajax_loadContent(\'box-right\',' . previous_posts_link() . '");return false` code to load posts in my box-right DIV, using Ajax. Unfortunately, when I use `. previous_posts_link() .` in with my onclick attribute, it only gives me the `.../posts.php` instead of `...posts.php?paged=2` Any idea what I have done wrong? Thanks.


sort by name (slug) custom post type

What's wrong in this query ? the sortby=name doesn't change anything.               $the_query = 'posts_per_page=-1&sortby=name&order=ASC&post_type=mycustom&custom_cat=mycat';     // query is made                    query_posts($the_query);


How to send form values from the script in functions.php and not from the form on my website?

I have a form on my website and depending on if the user check paypal or wire- transfer the form action should always go to functions.php where I have this simple check at the end of the file:               if ( isset( $_POST['submitted'] ) && isset( $_POST['post_nonce_field'] ) && wp_verify_nonce( $_POST['post_nonce_field'], 'post_nonce' ) ) {          // CODE AFTER SUBMIT HERE           }      So, my question is how do I do some stuff using an if condition in my functions.php before posting the form to PayPal? Because all tutorials have form action `https://www.sandbox.paypal.com/cgi- bin/webscr` How could I send all the post info from the formular (I can grab the values and stoere them in variables) via this address `https://www.sandbox.paypal.com/cgi-bin/webscr`? Is it somehow possible doing this and not using form to send the values there? **Does WordPress have any function to send post request to a distant url?**


How to use mysql IN statement with wpdb update method?

I am using wpdb update method and wish to update records where the id is not found within multiple ids. So if I wanted to update records where each had an id of `1` I would do for example:               $wpdb->update(                  'wp_my_tables',                  array(                      'active' => 0                 ),                  array( 'id' => 1 ),                  array(                      '%d'                 ),                  array( '%d' )              );      But how would I edit that so it does NOT update values where the ids are for example `1,2,3` ?


Wordpress templates bug

I have a WP problem that's driving me crazy. I have created several templates, and it decides to switch them all the time... I think it does when I create a new template file, but it never did that before. I'm scared that it's actually when I edit a post that it messes up some other page because if it is, I'll have a mad client on the phone every other week so I'ld like to know if anyone know what the problem might be... PHP files names are structured like that : template-something.php They are directly on my theme's folder. Inside these I put this comment :               /* Template Name : Page Something */      And then it's usual php... Anyone know how this could happen ? I have used templates several times and never had this problem...


`wp_editor()` CSS messing up the jQuery Dialog

I have a custom admin page that includes both the user of `wp_editor()` and a jQuery dialog. For reasons unknown to me, the instance of `wp_editor()` uses some of the same css class names as dialog, and one in particular (`ui-widget-overlay`) is messing up my jQuery dialog. I'm unable to interact with the dialog due to the `z-index` of the overlay as set by `editor.css`, and the overlay is darker, with a stripe in the middle. Has anyone encountered this issue before? If so, how did you work around it?               function do_refreshing_invitees_dialog(){     ?>

                 <img src="<?php echo $this->loader_path; ?>ajax-loader-bulk-dialog-invitees.gif" />

Please wait while the refreshed invitee's are generated...

     <?php     }      ![Dialog working fine, but CSS messed up by wp_editor\(\)](http://i.stack.imgur.com/pchOZ.png)


Bogus postings to my blog

Are you folks addressing the ultra vexing question of bogus posts to our blogs. As I understand it, as the blog owner, I am the only one who can post to it; others may comment on what I post, but not post themselves. Yet every day, mysteriously, posts appear at my blog contributed by bogus users. Do you know to what I am referring, and if so, is there a fix? And it's getting worse and worse by the day. I've been reduced to considering moving away from WP and embracing some other system.


Listing all post from different custom post type for the logged in user

I'm trying to show in a list page all the post that the current logged in user could have created in differents custom post type (5) For exemple : the user makes a new post using a form using new_post.php and it's added in the WP custom-post-type 'Cookies' if it's what he selected from a dropdown list. Then the user want to see his post so i'd list him all the post he made no matter what custom-post-type he posted to. Thks in advance for the help


setcookies and header send

I put simple php condition in the header.php of template as this :               setcookie("test_time_".$cookie_id."", $cookies_times, time()+3600);      The result always as this **headers already sent** , i use this inside plugin and also i try outside the plugin and the result always the same It´s possible use cookies in header or what can i do for fix this problem , i need use cookies for works little function


Media Library not showing images when adding to Posts (but retrieving image info via ajax)

When uploading an image to a post/page, the media library doesn't display any images (when there are some), and then 'fails' when you try and upload (although the image is actually uploaded). I've checked file permissions (everything is owned by the server which has full and appropriate access; i've event tried setting it to 777), and deactivated all plugins and tried switching themes. None of which helped. this happens even with 2013 active. The strange thing is that I can see the ajax request in the inspector, and it's retrieving all the information about the images ( from the `wp- admin/admin-ajax.php` request), in the `data` object. So wordpress should know it's there.... I just upgraded to 3.6 to see if it fixed the problem (which started in 3.5.2), but nothing has changed. I'm using nginx, not apache; Does anyone have any idea about what could be failing here and/or what could be causing this? (even somewhere to start looking would b super helpful). I've tested with a fresh DB and it's still happening.


Wordpress Multisite - Can 2 domains share a database of users?

I'm creating a Wordpress site for a client. In the future, my client would like to have a second site that uses Wordpress as well. Ideally, we'd like people that have accounts on the first site to be able to use that same account on the second site. Is this something that can be achieved with Wordpress Multisite? If so, how? The kickers is that each site would need to have it's own domain. For example, http://www.firstblog.com and http://www.secondblog.com would be two different sites sharing the same user accounts. Any help or insight would be greatly appreciated.


Sell "create a post", paid account for post creation

How can in wordpress, one sell the "create post" option To elaborate more. One has to pay an amount before he can make create a post on the wordpress site. MORE ELABORATION Suppose a person pays $20, he gets to write a post on wordpress. This is just like a paid listing website. If the person wants to create another post, he has to pay another 20 Bucks.


WordPress Multisite Network installation and dev questions

Please go easy on me. I'm a clutzy dinosaur. I currently have a large, unwieldy website hand-coded in html/css with php includes. It currently has a single WP installation in a subdirectory. The plan is to reorganize, and I want to use WP as the CMS and incorporate 3 WP blogs for 3 subdomains. Ideally, would like to create a WP multisite network to allow for further expansion and to save admin trouble. I just want to confirm that if I install WP in the root directory and create 3 blogs (in subdomains), does this mean my website's home page is the mother blog's index.php? Essentially, I will have created 4 blogs - mother at root and 3 children in subdomains? How to set this up on my Mac (OSX 10.5.8) running MAMP for development? And then how to migrate to server without breaking?


wp_signon( $creds, false ); not working

In my multisite i'm using a custom blog registration using : `wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);` and the site creation is successfull. and i want users automatically sign into their site admin panel on signup,for that i use :               $creds = array();     $creds['user_login'] = $_POST['username'];     $creds['user_password'] = $_POST['password'];     $creds['remember'] = true;          $user = wp_signon( $creds, false );          if ( is_wp_error($user) )        echo $user->get_error_message();      But this will return an error : _ERROR: The password you entered for the username mysite is incorrect. Lost your password?_ i need auto signin without using a plugin!!! Please help...


the post thumbnail, scale

I'm trying to figure how to scale the_post_thumbnail to a specific width? Can you guys help? Currently I'm using               <?php             //Resize post thumbnail             $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'single-post-thumbnail' );             $thumbnailHeight = $thumbnail[1];             $thumbnailWidth = $thumbnail[2];             if($thumbnailHeight != 0){                 $ratio = $thumbnailWidth/$thumbnailHeight;                 $width = 220;                 $height = $width * $ratio;             }else{                 $height = $thumbnailHeight;                 $width = $thumbnailWidth;             }         ?>      And printing the thumbnail with                <img src="<?php echo $thumbnail[0]; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>"/>      It works but.... Thanks!


Change Post and CPT author on the fly while publish the post

I am developing my site and require to change post author id on the fly while publishing. All post will be write and publish by admin but as content provided by different author and need to change post author id from admin to other author ( author id will get from custom field ) So how to do this on the fly while publishing. Here is my theme metabox.php code I am using wpalchemy metabox script and below code is in my cpt loop php file               // getting custom field value from image_artist     // this is giving value like artist_login_name / id     $png_gallery_meta->the_field('image_artist');     $artist_info = $png_gallery_meta->get_the_value();          // to separate artist_login_name and id     $string = $artist_info;     $artist = substr($string, 0, stripos($string, "/") );          // getting first name and last name from user id     $author_first_name = get_userdata(basename($string))->first_name;          $author_last_name = get_userdata(basename($string))->last_name;      So I am using above code to get user info from custom field dropdown selection box. Now how can I use above value to change id on the fly while admin publish the post the post author id should change with above id value get from selection box. I hope now it is more clear.


WP_Query not returning correct result with meta_query parameter

I've got the following loop on my index.php template:
                      <?php                  $args = array(                      'meta_query' => array(                         'meta_key' => 'is_url',                          'meta_value' => 'yes',                          'meta_compare' => 'NOT LIKE'                     ),                 );                      $main_query = new WP_Query( $args );                 while ( $main_query->have_posts() ) : $main_query->the_post();                 ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<a href="<?php the_author_link(); ?>"><?php the_author(); ?><?php echo the_time(); ?>
                 <?php the_excerpt(); ?>                      <?php endwhile; wp_reset_postdata(); ?>
      The query should return all posts that do not have the custom field 'is_url' set to 'yes'. It is returning all posts, regardless of the value of is_url. I usually use Custom Post Types for this sort of thing, so I haven't used the meta_query too extensively. Anybody know what I'm doing wrong?


Contact Form 7 Custom module

I am using a custom post type name `venue` and I am using a `<select>` dropdown on one of the contact form by loading up a custom module in CF7 but when the form is submitted, my data shortcode is not replaced with the data filled by the user. I just see this `[selected-venue]`. Here is my code for custom module:               <?php          wpcf7_add_shortcode( 'party-venue', 'wpcf7_venue_shortcode_handler', true );          function wpcf7_venue_shortcode_handler( $tag ) {              global $wpdb;              $query = "SELECT post_title FROM {$wpdb->posts} where post_type = 'venue' and post_status = 'publish';";              $result = $wpdb->get_col( $query );              if ( $result ) {             $output = '<select name="contact_venue" id="contact_venue" class="input-select">';             $output.= '<option></option>';             foreach ( $result as $venue ) {                 $output.= '<option value="'.$venue.'">'.$venue.'</option>';             }             $output.= '</select>';         }              return $output;     }      My contact form's code is               namePlease enter your full name[text* your-name class:input-textarea]      emailPlease enter a valid email address[email* your-email class:input-textarea]     phonePlease enter a phone number to reach you at[text phone class:input-textarea]     party size*Min 50 guests for free bottle, 15 guests for buy 1 bottle get 1 free*[text party-size class:input-textarea]
     venuePlease select your party venue[party-venue selected-venue id:contact_venue]     datePlease enter your party date (mm/dd/yy)[text date id:contact_date class:input-textarea]     How did you hear about us?Please select one of the options[select menu-367 class:input-select "" "CitySearch" "Facebook" "Facebook Ad" "Friend" "Google Search" "NYC Daily Deals" "Yelp"]          [submit class:input-submit]      And here is my message body:               From: [your-name] <[your-email]>     Subject: Book a party!          Message Body:     Phone: [phone],      Party Size: [party-size],      Venue: [selected-venue],      Date: [date]     How did you hear about us: [menu-367]      When I get the email on form submission, `[selected-venue]` is not replaced with the actual value of the select dropdown. What I am doing wrong?


view queries made?

I know I can use `get_num_queries()` for the number of queries. However, how can I see what queries Wordpress actually makes? I've tried using $query but that didn't work.


Querystring parameter getting lost in rewrite rule

I have successfully added a custom post type and the permalink structure works great. So, for instance, I've got a custom post type `books`, and the permalink to a book is `/books/the-dictionary`. My `single-book.php` page template accepts a `letter` parameter to customize the content displayed on the page. I'd like to be able to link to this like `/book/the-dictionary/q`. I've added the following to my theme's functions.php file:               function my_init() {         add_books_rewrite();          function add_books_rewrite() {         add_rewrite_rule("books/([^/]+)/([^/])/?$", 'index.php?pagename=$matches[1]&letter=$matches[2]', "top");         global $wp_rewrite;         $wp_rewrite->flush_rules();     }     function add_books_query_vars($query_vars) {         $query_vars[] = "letter";         return $query_vars;     }     add_filter("init", "my_init");     add_filter("query_vars", "add_books_query_vars");      It took a few tries with using the flushing code above, manually going to the permalink settings page and saving, and fixing stupid errors in the regex, but eventually I was able to verify that the rewrite was added correctly by using Jan Fabry's fabulous rewrite analyzer plugin. ![confirmed in rewrite analyzer](http://i.stack.imgur.com/GFYM8.png) So, from here I think it's smooth sailing, right? Yeah...not exactly. When I load up my site and go to `books/the-dictionary/q`, it does load `the- dictionary` content correctly, but it is losing the parameter. The thing that I find interesting is that if I load `index.php?pagename=the- dictionary&letter=q`, everything works great. To retrieve the parameter, I have the following code:               global $letter;     echo $letter. " - global";     echo "
";     $current_letter = (isset($wp_query->query_vars["letter"]) ? $wp_query->query_vars["letter"] : "all");     echo $current_letter . " - query_vars";     echo "

";      I've also been looking at `$_SERVER["QUERY_STRING"]`. These are populated when I use `index.php?pagename...&letter...`, but not when I use `/books/pagename/letter`. So, it seems like a few things are happening here. WordPress isn't completely dropping the parameter since things work if I specify index.php with the appropriate querystring variables. This seems to indicate the rewrite rule isn't working correctly. However, the Rewrite Analyzer plugin seems to say things are set up properly for what I'm going for. I'm a bit confused at what I should be looking at here to fix the disconnect. Sorry if I'm missing something obvious. ):


Looking for a hook to add attachment information to the media library tab

I would like to be able to determine if an image has been attached to a post by looking at the collapsed viewmedia library tab. Is there's a hook I can use to add that data to this view of the Media Libray tab? I've included a mock-up of what I'd like the media library to look like. ![enter image description here](http://i.stack.imgur.com/q1D7j.png) Is it possible to amend the current media library tab or would I have to create a custom tab to get this functionality?


Get most recent posts by category that aren't first overall

> **Possible Duplicate:**   >  Duplicate posts I'm trying to create a home page, in which there is a top posts section that displays the three most recent posts (for all categories), and category subsections that display the most recent posts for that category only. I know how to get that far, but I'm not sure how to make sure there isn't any overlap (I don't want any posts to show up both at the top and in the category section of the page). Is there an efficient way to do this?


Duplicate post issue on multiple category loops on one page (1 post)

> **Possible Duplicate:**   >  Duplicate posts I am building a homepage template and it has an area with 4 separate category loops in a grid layout. Each loop will only show one post. The posts that I will be working with have multiple categories assigned to them and we don't want to have more than one instance of a post displaying amongst the 4 loops. For example if my latest post is assigned to all of the 4 categories that are setup to loop on the homepage, how can we set a priority so that it only displays in one of the categories and not the other three? I tried excluding the 3 other categories inside of each of the loops but then it just skips over all posts until it finds one that only has one category assigned to it and that won't work for this project. Let me know if you need further clarification. Does anyone have any thoughts or ideas on this. Thanks, Andrew


Faster better ways of adding/updating images in Wordpress?

I've used/developed Wordpress for 7 years and one of the worst aspects of it is uploading images. It is a HUGE pain the ass. You have to go to the page, upload it through the dialog, then place it, blah blah. It's a massive waste of time and resources. I suppose you could just edit the images on the server directly. Has anyone found a better way to work with images on WP?


How to add H4 tag to the_content filter (after content)?

I would like the H4 title to display before the loop starts and only once. The problem I'm having is that H4 tag title I've created either gets stuck in the loop or it displays on the top of the post, before the content, which is what I do not want. This is what I have.               //Related stock photo function     function custom_content_after_post($content){         if (get_post_type( get_the_ID() ) == 'portfolio') {                  //Query for the the related posts - portfolio custom post type             $loop = new WP_Query( array('post_type' => 'portfolio', 'posts_per_page' => 5, 'orderby' => 'rand'));             $sptitle = '
Related Stock Photos
';                  while ( $loop->have_posts() ) {                 $loop->the_post();                      $content .= '
';                 $content .= '
';                 $content .= '
';                               //Display post thumbnail assigned to it.                 $content .= '
';                 $content .= '' .get_the_post_thumbnail($page->ID, 'thumbnail'). '';                 $content .= '
' . get_the_title() . '
';                                  $content .= '
';                 $content .= '
';                 $content .= '
';             }         }         return $content;     }          add_filter( 'the_content', 'custom_content_after_post' );


Add Class After 4th Post

I need to add a "div" after the 4th post. I am showing 8 posts on the page and the code i am using above shows the div after the 4th and 8th... o just need the 4th to show not every 4th, just after the first 4th.               <?php if (have_posts()) : $count = 0; ?>       <?php query_posts("showposts=8&post_type=vender_list&orderby=rand");?>        <?php while (have_posts()) : the_post(); ?>         <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php echo eh_postImage(240,240,1); ?>          <?php the_title(); ?>          <?php the_content_rss('', FALSE, '', 60); ?>
     <?php if ($count % 4 == 3) { ?>

     <?php } ?>        <?php $count++;  ?>     <?php endwhile; endif; wp_reset_query();?>


How to include wp-load.php from any location?

I have a plugin which calls a stand-alone php script (myAjax.php) via a jQuery.ajax() script inside the plugin. I need to place the following code into the myAjax.php file:               require_once('../../../wp-load.php');          if (!is_user_logged_in()){         die("You Must Be Logged In to Access This");     }     if( ! current_user_can('edit_files')) {         die("Sorry you are not authorized to access this file");     }      However, I'd like a more bulletproof method of specifying the path to wp- load.php in case the actual relative path is different than my example.


Theme Customizer - Custom Sections Display, but do Nothing

I'm creating a theme and I've started doing some work on the theme customizer. I'm going to do all of it in the theme functions, but I have an issue I want to figure out first: I've added a Typography section which currently only has some color pickers that can change the color of paragraph text and links. However, it doesn't work. There's no errors, section displays with the options, but nothing changes when I change the colors. Here's my code, if anyone can help me out, I'd be thrilled :)               /* Theme Customizer Code */     function dsgn_customizer_register($wp_customize) {     $wp_customize->add_section('dsgn_typograhy', array(         'title' => __('Typography', 'dsgn'),         'description' => ('Modify the theme typography')     ));     $wp_customize->add_setting('content_color', array(         'default' => '#544e4e',     ));     $wp_customize->add_setting('link_color', array(         'default' => '#BF5050',     ));     $wp_customize->add_control( new WP_customize_color_control($wp_customize, 'content_color', array(         'label' => __('Edit Content Text Color', 'dsgn'),         'section' => 'dsgn_typograhy',         'settings' => 'content_color'     ) ));     $wp_customize->add_control( new WP_customize_color_control($wp_customize, 'link_color', array(         'label' => __('Edit Link Text Color', 'dsgn'),         'section' => 'dsgn_typograhy',         'settings' => 'link_color'     ) ));      }               function dsgn_css_customizer() {     ?>     <style type="text/css">         a {             color: <?php echo get_theme_mod('link_color'); ?>;         }         .entry-content p {             color: <?php echo get_theme_mod('content_color'); ?>;         }     </style>     <?php     }          add_action('wp-head', 'dsgn_css_customizer');     add_action('customize_register', 'dsgn_customizer_register');      **NOTE:** I tried adding another control for the body background-color and that works perfectly... I did actually already have support for background- color using this code:               // Add theme support for Custom Background     $background_args = array(     'default-color'          => 'e9e9e9',     'default-image'          => '',     'wp-head-callback'       => '_custom_background_cb',     'admin-head-callback'    => '',     'admin-preview-callback' => '',     );     add_theme_support( 'custom-background', $background_args );      When I remove that code, the option no longer works, so I'm guessing I maybe have to add some kind of support for the typography changes as well..?


How to Deny Access to No Referrer Requests on Multiste with Mapped domains

RewriteEngine On     RewriteCond %{REQUEST_METHOD} POST     RewriteCond %{REQUEST_URI} .wp-comments-post\.php*     RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR]     RewriteCond %{HTTP_USER_AGENT} ^$     RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]      I'm aware that the following code Denys Access to No Referrer Requests. However I'm using a multiste installation and I would like to know. How can I modify it so the code above to work with WP multiste and mapped domains?


Output terms to post_class()

I am trying to output all terms attached to a specific post (including custom taxonomy terms) as CSS classes applied to a DIV Something like that :                  <div <?php post_class('class-name'); ?>>
      So it outputs something like this :

      How do I do this? Thanks!


Stop turning small dashes into longer ones

When I write my site's title, description, posts, pages, or a taxonomy description, small dashes `-` are turned into longer, uglier ones `–`. Is there some way to stop this from happening? Can I put some sort of function in my functions.php? Any ideas?


Regenerate Thumbnails Plugin successfully updated my thumbnails but image src won't change to new image size?

I "successfully" regenerated my thumbnails using the Regenerate Thumbnails Plugin as I added a variety of new image sizes to my site; however, I'm having difficulty getting these new images sizes to actual display. When I inspect each image it is still showing the old image size path in the src="". I don't have any cacheing plugins running (this is on a staging server.) Could this be an .htaccess issue? For example:               Local:               Staging:           As you can see, on my Local environment the image src is using the correct image sizes as at the end of the link it has the "456x244.jpg" crop, whereas on my Staging environment it is still using the original upload.


Changing wp_link_pages() to "Next Page" and "Previous Page" buttons?

Currently I am using `<!--nextpage-->` to split a post into multiple pages, but I would like to change from `Pages: 1 2 3 4` to `Next Page` and `Previous Page` links similar to what you see on this multipaged post In my `single.php` I have:               <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'pearl' ), 'after' => '
' ) ); ?>      How can I change this to a next and a previous button?


order by multiple meta_keys?

Hi i'd like to order by multiple meta_keys want to make it order using these keys adminscore + user_like + _count-views_all + comment_count combine these keys how should i array order it?? i try this but not work..                 $args = array(                 'meta_key' => 'adminscore' + 'user_like' + '_count-views_all' + 'comment_count',                     'numberposts' => $number_posts,                     'post_status' => $post_status,                     'post_type' => $custom_post_type,                     'orderby' => 'meta_value_num'                    );      Thanks for check my question, hope someone has answer for it.


Deleted pages are NOT removed from custom menus?

When I delete a page, post or category that has previously been added to a custom menu, the delete routine is apparently not checking to see if the item belongs to a custom menu, and thus its not removing it from the custom menu. This results in a 404 page error when the menu item is clicked on from the website. So as the code is now, its up to the user to (1) have knowledge of this behavior and (2) remember to delete the item from BOTH places, to avoid embarrassing 404 "not found" and search bot crawl errors. Is this a known bug/design flaw? It seems entirely counter-intuitive if its known and allowed to stand as is. I should note, as pointed out below by Maugly, that once the item is removed from "Trash", WordPress finally removes it from any custom menus. However, this is counter-intutive the the way all other WordPress menus operate. As soon as you place an item in the trash, its removed from "Pages" and "Recent Posts" widget listings, why not the same behavior for custom menus? I'd err on the side of consistency, and even more importantly, link integrity. Users should not expect custom menus to follow a completely different set of rules with respect to deleting pages and posts than other menus.


jQuery cycle and WordPress: Captions, buttons, oh my

I'm attempting to use jQuery cycle to create a rotator on my blog (which will be used going forward on all other blogs) like the following: http://www.pbs.org/teachers
          <?php      $loop = new WP_Query( array( 'category_name' => 'Dynamic Lead', 'posts_per_page' => 3 ) );      $i = 0; ?>
     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>                <li class="feature-well-feature <?php echo ++$i; ?>">         <a href="<?php echo get_post_meta($post->ID, 'custom_permalink', true); ?>">             <img alt="<?php the_title(); ?> image" <?php echo get_post_meta($post->ID, 'img_url', true); ?" />                              Go!                 <?php the_title(); ?>                 <?php the_content(); ?>
            <?php endwhile; ?>
     <?php $i = 0; ?>
              <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>         <li class="feature-<?php echo ++$i; ?> <?php if ( $i <= 1 ) echo 'activeSlide'; ?>"><a href="<?php echo get_post_meta($post->ID, 'custom_permalink', true); ?>" <?php if ( $i <= 1 ) echo 'class="activeSlide"'; ?>><?php the_title(); ?>
     <?php endwhile; ?>

       But when I implement the above code, I get nothing but blank space (the page doesn't continue loading). I've tried several tutorials about creating jQuery sliders in WP but none that allow me to have captions along with, lack of better word, buttons that hold the same titles as the captions. Can anyone help me out?


Creating Settings Page with dropdowns for Plugin

I am setting up my plugin's settings page and I am able to get the fields I want on the page, but I want them to be dropdowns not textboxes... I have not found any useful info on the web on how to do this other than using add_settings_field. With add_settings_field I can display a dropdown for my setting but I can't get it to appear on my plugin settings page, I can get it to appear on the 'reading settings page' though for example. basically I have used add_options_page() so that my Plugin Options page shows up under the settings menu in the wordpress backend, and addaction() to register my settings, and the form is built with the callback function from add_options_page. This all works, I just can't get anything but textboxes... and I would like dropdowns and probably checkboxes. I hope that makes sense. Thanks!


Select category from dropdown, display random post from that category

Was wondering if anyone could recommend a good way to display a single, random post from a wp_dropdown_categories() menu. Basically, I have a custom post type called Tips and a taxonomy term called Tip Categories. I want to display the Tip Categories in a dropdown (which I have done already using wp_dropdown_categories), then when a user selects a Tip Category and clicks a submit button, a random tip from that category will display. I suppose I can figure out a way to do this on the front end with Javascript/CSS (generating all tips, then showing/hiding them) but it seems like it would be best to generate one tip and do it all in PHP. Anyone have an idea of how best to accomplish this? Can I somehow pass the value of the wp_dropdown_categories selection to WP_Query()? Maybe this is easier than I thought and I'm missing something?


Finding posts containing matching array elements in a meta field usign WP_Query

I have a metafield, that contains a series of options and writes the results to an array in a single meta field:               array([0]=>'First',           [1]=>'Second',           [2]=>'Third',          );      I find posts that contain any of the array elements, and display them using `WP_Query`               $search = new WP_Query('meta_key=mykey&meta_value=second');      But this doesn't seem to work. Any idea on how to achieve this? * * * I have edited my method, following this question:               $arg['meta_key'] == $key;     $args['meta_value'] = "%|".$value."|%";     $custom_query = new WP_Query($args);      But no darts.


Multiple search template with separate stylesheets

I'm building a site which needs to have two search bars and two search results templates. One of the search bars is for regular posts, and the other is for a custom post type. I need the two search results pages to be styled completely differently, so I have set up two templates to display results. One is the standard `search.php` that detects if the post type is a custom one, and displays it on a template named `new-index.php` Im trying to attach different style sheets to the different pages using the following code:               <?php     if ( is_page_template('new-index.php')) { ?>     <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/home.css" />     <?php } ?>      which dosen't work, but if i use:               <?php     if ( is_search()) { ?>     <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/gallery.css" />     <?php } ?>      it works fine but it gives both the templates the same style sheet, I understand why its happening, but cannot figure out a way around it, any suggestions?


Conditional statement for parent, child and grandchild pages

I'm trying to figure out how to set up a conditional statement to check if the parent, child or grandchild is being displayed. This is what I've got so far:               <?php           if ( is_page( 'about' ) || '29' == $post->post_parent ) {         //Start of the custom code...         while(has_sub_field('site_slideshows','option')):         ?>                   <div class="slideshow-slide" style="background-image:url(<?php the_sub_field('site_slideshows_slide_image'); ?>)">                 <div class="block-text" style="color: <?php the_sub_field('site_slideshows_slide_text_colour'); ?>;"><?php the_sub_field('site_slideshows_slide_text'); ?>

              <?php //Opening the PHP tag again         endwhile;          } elseif ( is_page( 'contact' ) || '31' == $post->post_parent ) {         //Start of the custom code...         while(has_sub_field('two_site_slideshows','option')):         ?>                   <div class="slideshow-slide" style="background-image:url(<?php the_sub_field('two_site_slideshows_slide_image'); ?>)">                 <div class="block-text" style="color: <?php the_sub_field('two_site_slide_text_colour'); ?>;"><?php the_sub_field('two_site_slideshows_slide_text'); ?>

              <?php //Opening the PHP tag again         endwhile;          }     ?>      This will successfully check for the parent and child page, e.g. the `about` page and all the children of the `about` page, but how would I adjust these statements to include grandchild pages also? Any suggestions would be greatly appreciated.


Wordpress Query orderby title with UTF8 string in title

I got posts with titles are in utf8 encoding. When I query posts with `orderby` is `title`, those with utf8 characters at the beginning are at the end. Example: post title starts with `Đ` are at the end of the list. Is there anyway I can make orderby order sorts `Đ`right after `D`?


Add profile field (usermeta) to Add New User

Edit: Add profile field (usermeta) to user registration I am trying to add a custom field to the Add New User page much as I have done with the user profile page like so:               add_action( 'show_user_profile', 'my_show_extra_profile_fields' );     add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );          function my_show_extra_profile_fields( $user ) { ?>
Player information

             Team Name	                                   <?php                  $status = get_the_author_meta( 'team-meta', $user->ID );                  $items = get_posts (array (                     'post_type' => 'team_page',                     'posts_per_page' => -1                 ));                 echo '<select name="team-meta" id="team-meta">                       <option value="">No team selected</option>';                   foreach($items as $item) {                      echo '<option value="'.$item->ID.'"',$status == $item->ID ? ' selected="selected"' : '','>'.$item->post_title.'</option>';                       } // end foreach                   ?>                      Please enter the player's team name

     <?php }          add_action( 'personal_options_update', 'my_save_extra_profile_fields' );     add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );          function my_save_extra_profile_fields( $user_id ) {          if ( !current_user_can( 'edit_users', $user_id ) )         return false;          update_user_meta( $user_id, 'team-meta', $_POST['team-meta'] );     }      Basically I want whoever creates a new user to be able to add this directly without going to the user profile.


Custom class on Media image inserted in the editor

I would like to have different classes added regarding the options selected during the media insertion. When inserting a media, there are 3 options (media file, attachement page and custom URL) wrapping the image with `a href` : ![enter image description here](http://i.stack.imgur.com/Yc7U9.jpg) At the moment, the code returned is always the same :                                  It doesn't make difference what option is selected. What I would like to achieve is add a different class to my `a href` for each option available. For example, if I selected the option "Custom URL", I would have something similar to :                                   These different classes would help me to trigger actions in jQuery.


How to make my new theme read [youtube id="id of the video here" width="600" height="350"]?

I recently changed the theme on my website pocketlife.com.br , and now all my videos, which were used on the posts on this format: [youtube id="only the id here" width="600" height="350"] are not understood, and inside the posts like this one for example http://pocketlife.com.br/2014/03/cut-the-rope-2-chega- finalmente-ao-android/ , the following message is shown where the video is supposed to be: "Please enter the url to a YouTube video." . How can I make it so I don't need to go into all the posts I have that has any video inside and edit in a way that wordpress will embed it? Thanks!


Obliterate the main query and replace it

There are lots of good resources on how to alter the main query, or add secondary loops... But I actually want to completely replace the main query with a different query altogether. I am hijacking one of my pages to serve, essentially, as a category page. (Note I am changing from "page" to "post" in my effort to do this.) But when I alter the main query by doing this:               function front_page_announcements( $query ) {         if ( $query->query_vars['page_id'] == 84 && $query->is_main_query() && !$query->is_admin ) {             $query->set("category_name", "special-announcement");             $query->set("page_id", NULL);         }     }     add_action( 'pre_get_posts', 'front_page_announcements' );      I end up getting every page (not post) in the database. What I actually want is every post (not page) with a category id of `3`, or `special-announcement` in my case. I don't want to make unnecessary calls to the database, so it seems like the `pre_get_posts` action hook is what I'll want, but I can't figure it out. Even just setting `$query = new WP_Query('cat=3')` doesn't seem to work.


Changing theme from twentytwelve to twentythirteen comments not working

I have a wordpress blog located HERE. A couple of days ago I changed the child theme from this blog over from twentytwelve to twentyfourteen. As a result now, my comments box at the bottom of each blog post no longer works. I click it but nothing happens. I am rather new to wordpress design and willing to learn.


How to control template resolution if both Author and Category filter in place?

The following url resolves to the category template: http://localhost/author/myusername/?category_name=somecategory I have a `category-somecategory.php` template and just a generic `author.php` template. Is there any way to make such a url use the `author.php` template instead of the `category-somecategory.php`? If not how can I filter on both category and author and force it to use the author template?


How to create custom anchore to specific past category with feature image?

I created wordpress website and add 6 statics banner. Now i want to dynamic so i created a add category and add featured image as a banner but dont know how add anchore please give me idea or aany suggestion.


Is it possible for a plugin to prevent certain plugins from being installed?

Or perhaps if it can't prevent it, can the plugin disable certain plugins in the admin area and prevent them from being activated, sort of like the reverse of disabling plugin deactivation? **Edit** : Changed the question from 'is it possible for a theme' to 'is it possible for a plugin'.


Displaying shortcode output through Options Framework

I'm hoping someone might be able to help me. I'm using the Options Framework Plugin to customise my site, but I'm having difficulty with using a shortcode in one of the custom fields. I've created an 'editor' field, and called it in my theme like so:               <?php        if ( of_get_option('footer_contact_form') ) {         echo of_get_option('footer_contact_form');       }     ?>      But it outputs the shortcode (gravity forms) as raw text, like so: https://dl.dropboxusercontent.com/u/4676147/shortcode-output.png Is it possible to achieve what I'm trying, or will I have to hard code the form into the theme? Many thanks in advance!


Using Multisite with a CDN?

I'm running Wordpress Multisite hosted with Bluehost, and only have 5 low volume sites. My site load time has been awful recently, so I've used Lazy Load, DB optimization, Smush.it, and Quick Cache to try to remedy the speed issue. Spending a lot of time looking for a good CDN, and apparently, there ISN'T a CDN that easily implements with WP Multisite. Every one requires W3 Total Cache, which can't be activated across the network. There are risky-looking tutorials on how to create a mirror static page, etc., but nothing that makes a clear and simple installation. My choice CDN would be MaxCDN, but even they require W3TC. Does anyone have a definitive answer on how to put a Multisite installation in the cloud, or on a CDN service?


Problem with registering menus - What to do when other solutions aren't working?

I'm not able to get nav menus to register - and I'm not sure what else to try when posted solutions are not working? I've tried the solution in this post: register_nav_menus() won't register menus And have also followed the instructions in: http://codex.wordpress.org/Function_Reference/register_nav_menus and http://wptuts.org/how-to-add-menu-to-wordpress-theme/ I cannot get this to work - I still get this message: > "The current theme does not natively support menus, but you can use the > “Custom Menu” widget to add any menus you create here to the theme’s > sidebar." Currently in my functions.php file (keeping it simple - but isn't working):               register_nav_menu('primary_navigation', 'Primary Navigation');     add_action('after_setup_theme', 'hchw_setup');      This isn't working for me either (hchw is my theme name):               register_nav_menus(array(         'primary_navigation' => __('Primary Navigation', 'hchw'),         'sub_navigation' => __('Sub Navigation', 'hchw'),     ));     add_action('after_setup_theme', 'hchw_setup');      My navigation template (header-top-navbar.php):               if (has_nav_menu('primary_navigation')) {         wp_nav_menu(array('theme_location' => 'primary_navigation', 'menu_class' => 'nav'));     }      The include: `<?php get_template_part('templates/header-top-navbar'); ?>` The entire functions.php file:               // Use 'static' instead of 'wp-content'     function rename_wp_content($path) {       return str_replace('wp-content', 'static', $path);     }     add_filter('template_directory_uri', 'rename_wp_content');          // Is this an auth page?     function is_auth_page() {       return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'));     }          // Change login logo     function login_css() {       wp_enqueue_style('login_css', get_template_directory_uri() . '/css/login.css');     }     add_action('login_head', 'login_css');          if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }          require_once locate_template('/lib/utils.php');           // Utility functions     require_once locate_template('/lib/config.php');          // Configuration and constants     require_once locate_template('/lib/activation.php');      // Theme activation     require_once locate_template('/lib/cleanup.php');         // Cleanup     require_once locate_template('/lib/htaccess.php');        // Rewrites for assets, H5BP .htaccess     require_once locate_template('/lib/widgets.php');         // Sidebars and widgets     require_once locate_template('/lib/scripts.php');         // Scripts and stylesheets     require_once locate_template('/lib/post-types.php');      // Custom post types     require_once locate_template('/lib/metaboxes.php');       // Custom metaboxes     require_once locate_template('/lib/custom.php');          // Custom functions     //require_once locate_template('/lib/wp-admin-menu-classes.php'); // Load the Admin Menu Classes               /**      * Load the Options Panel     **/     if ( !function_exists( 'optionsframework_init' ) ) {         define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('template_directory') . '/admin/' );         require_once dirname( __FILE__ ) . '/admin/options-framework.php';     }          function hchw_setup() {          // Make theme available for translation     load_theme_textdomain('hchw', get_template_directory() . '/lang');          // Register wp_nav_menu() menus (http://codex.wordpress.org/Function_Reference/register_nav_menus)     //register_nav_menus(array(     //    'primary_navigation' => __('Primary Navigation', 'hchw'),     //    'sub_navigation' => __('Sub Navigation', 'hchw'),     //));               register_nav_menu('primary_navigation', 'Primary Navigation');     add_action('after_setup_theme', 'hchw_setup');               // Add post formats (http://codex.wordpress.org/Post_Formats)     // add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));          // Tell the TinyMCE editor to use a custom stylesheet     add_editor_style('assets/css/editor-style.css');          /**      * Custom images size     **/       // Add post thumbnails (http://codex.wordpress.org/Post_Thumbnails)     // This is then pulled through to your theme useing the_post_thumbnail('custombig');      add_theme_support('post-thumbnails');       set_post_thumbnail_size(150, 150, false);       add_image_size('category-thumb', 300, 9999); // 300px wide (and unlimited height)       add_image_size('postfull', 504, 334); // Blog Post Full-Size       add_image_size('customfeatins', 248, 165, true); //hp featured inset       add_image_size('customfeatblg', 290, 192, true); //int featured inset       add_image_size('customfeed', 136, 90, true); //feed thumbnails       add_image_size('customparade', 176, 98, true); //logo parade          }          // Remove the link and 'Powered by WordPress' from the login page     function login_header_unlink() {       return null;     }     add_filter('login_headerurl', 'login_header_unlink');     add_filter('login_headertitle', 'login_header_unlink');               /**      * Add class to body tag if has sidebar     **/     function wpfme_has_sidebar($classes) {         if (is_active_sidebar('sidebar')) {             // add 'class-name' to the $classes array             $classes[] = 'has_sidebar';         }         // return the $classes array         return $classes;     }     add_filter('body_class','wpfme_has_sidebar');      Can anyone tell me what it is I'm missing, or if there is something incorrect with my code? Thanks in advance for your any help or direction!


Remove double space after a period

I run a multiple author platform with more than 1000 writers. Most users writer their content externally (Microsoft Word, OpenOffice etc) and paste it into the Visual Editor. Around 20% of the articles have a double space after every single period. Feedback from the users tells me that some versions of these programs adds two spaces after full stop instead of one. I initially linked these users to tutorials of how to address this in the external application itself however the growth of the platform is making this a ridiculously exhausting task. **Is there a way to remove all double spaces and convert them into single space on the post page**? Maybe upon clicking publish. It would be ideal if it happened on the backend post page rather than the front end (through some styling fix) - although I am open to ideas. On a personal note, I find it quite astonishing that this feature is not a part of the core functions of Wordpress given that at least 20% of my authors are experiencing it.


Assigning the same custom meta box to multiple post types

I currently have videos set up as a custom post type and I have also created a custom meta box for it that allows users to enter the ID of either a youtube/vimeo video - the video is then displayed on the front end. I want to re-use this meta box for another custom post type. How would I do this? The function for the current meta box is:               // Create the Video Information Meta Box by hooking into the admin menu for a post         add_action('admin_menu', 'video_add_box');                   function video_add_box(){         add_meta_box('video_information', 'Video Information', 'video_information', 'videos', 'normal', 'high');         }              //function to populate the meta box added above         function video_information(){         global $post;              // Noncename needed to verify where the data originated         echo '<input type="hidden" name="video_noncename" id="video_noncename" value="' .         wp_create_nonce( plugin_basename(__FILE__) ) . '" />';              //adds the custom field _youtubeID plus some other stuff         $youtubeID = get_post_meta($post->ID, '_youtubeID', true);         if ( empty($youtubeID) ) {         $youtubeID = '';         }              //adds the custom field _vimeoID         $vimeoID = get_post_meta($post->ID, '_vimeoID', true);         if ( empty($vimeoID) ) {         $vimeoID = '';         }              //add the box         echo '
';         echo 'Youtube ID:  <input type="text" name="_youtubeID" value="' . $youtubeID  . '" size="20" maxlength="30" />';         echo '
';         echo 'Vimeo ID:  <input type="text" name="_vimeoID" value="' . $vimeoID  . '" size="20" maxlength="30" />';         echo '
';         } //end video_information function              //save_video_meta is called below with the action "save_post" and saves your IDs to the post         function save_video_meta($post_id, $post) {         // verify this came from the our screen and with proper authorization,         // because save_post can be triggered at other times              if ( !wp_verify_nonce( $_POST['video_noncename'], plugin_basename(__FILE__) )) {         return $post->ID;         }              // Is the user allowed to edit the post or page?              if ( !current_user_can( 'edit_post', $post->ID )){         return $post->ID;         }              $video_meta['_youtubeID'] = $_POST['_youtubeID'];         $video_meta['_vimeoID'] = $_POST['_vimeoID'];         foreach ($video_meta as $key => $value) { // Cycle through the $video_meta array         if( $post->post_type == 'revision' ) return; // Don't store custom data twice              $value = implode(',', (array)$value); // If $value is an array, make it a CSV              if($value) {         update_post_meta($post_id, $key, $value);     } else          delete_post_meta($post_id, $key); // Delete if blank     }         } //end save_video_meta              //save the video custom fields         add_action( 'save_post', 'my_save_postdata' );     function my_save_postdata($post_id){         $video_meta['_youtubeID'] = $_POST['_youtubeID'];         $video_meta['_vimeoID'] = $_POST['_vimeoID'];         foreach ($video_meta as $key => $value) { // Cycle through the $video_meta array             if(  $_POST['post_type'] == 'revision' ) return; // Don't store custom data twice             $value = implode(',', (array)$value); // If $value is an array, make it a CSV                  if(get_post_meta($post_id, $key, FALSE)) { // If the custom field already has a value                 update_post_meta($post_id, $key, $value);             } else { // If the custom field doesn't have a value                 add_post_meta($post_id, $key, $value);             }             if(!$value) delete_post_meta($post_id, $key); // Delete if blank         }//endforeach video meta      }


Wordpress Defined Memory Limit

Running a dedicated managed server with 2 GIGS of RAM. How much memory can I define in `wp-config.php` Currently I have               define('WP_MEMORY_LIMIT', '256M');      I suspect a plugin that resizes images when they are being uploaded, that might cause the server to crash, but I am not sure yet. How can I allocate more memory for this plugin to operate? Many thanks Andy


Display selected parts from selected pages on the frontpage?

I'm build a site for my company and want to display four (of my choise) of our special deals on our frontpage. A special deal is a page. I want to grab:   * Featured Image   * Page Title   * Price (taking from a custom field or something)   * Read More (link to the page)   * +I want to be able to determine whether the page will be displayed on the frontpage or not. The sitemap look like this   * Home Our    * Special Deals      * Special Deal #1     * Special Deal #2     * Special Deal #3     * Special Deal #4     * Special Deal #5     * Special Deal #6     * Special Deal #7    * Info    * Contact Can someone help me with this?


Best way of getting a a series of custom fields into an array?

I've a series of custom fields attached to certain pages. These fields are named slide1, slide2, side3, slide4, slide5, slide6. These are images which are going to be used as a slideshow (I'm using jflow slider for this - http://net.tutsplus.com/articles/news/using-the-wonderful- jflow-plugin-screencast/ ) (I don't want to call them all 'slide' and put them in an custom field array because there may be captions for each slide, and when both slides and captions are custom field arrays, the order may not match up) Now, sometimes there will be only 3 slides entered (slide1 to slide3), and sometimes all 6 slides (slide1 to slide6). Not being very PHP savvy, I wonder what the best way best way to stick these custom fields into a PHP array, and then iterate thru them to print out the code, which looks a bit like the below?

        The code to print, for instance slide1's image, would be something like:               <img src="<?php echo wp_get_attachment_url($slide1); ?>">


link wordpress and stackoverflow

how do i link stackoverflow widget in wordpress to my profile in stackoverflow to show badges, reputaions ??


Does WP show me if I'm logged in from multiple locations?

Does word press show me if I'm logged in in another location? Related: Limiting sessions to one IP at a time


How to set "lang" attribute for post/page title?

I am creating multilingual website in Urdu & English lanugage on Wordpress. Major part of site is in English. Only article's body (i.e paragraph & headings etc) are in Urdu. To assign Urdu fonts to urdu content, when writing article, I just switch to HTML Mode and insert lang="ur" attribute with elements and style them in CSS by :lang() pseudo selector. Now I get problem that how I can specifie lang attribute for Post/Page title? Any idea? I hope you will understand what I want to say. Thanks


How to add dynamic inline style?

I want to add dynamic CSS, so currently I am adding directly to the div, ie:               $color = "#000000";     echo '<div style="background:'.$color.'">      Is it bad to add code like above? I have read in some forum that it adds server burden and it is not recommended by WordPress coding standards. I should use `wp_add_inline_style()`. So I am trying to use that but it does not work. Here's what I'm trying: functions.php:               function add_custom_css() {             wp_enqueue_script('custom-css', get_template_directory_uri() . '/custom.css');                   }     }     add_action( 'wp_enqueue_scripts', 'add_custom_css' );      single.php               $color = "#000111";     $custom_css = "         .mycolor{                 background: {$color};         }";          wp_add_inline_style( 'custom-css', $custom_css );      It does not add any code in the custom.css file. What am I doing wrong?


Grouped custom taxonomy query

I have created   * 1 custom post types: image-gallery   * 1 custom taxonomy: media-category   * 2 categories (under Media Categories): categoria-uno and categoria-due I need to print the records grouped by category, example: Categoria uno   * record 1   * record 2   * record 3 Categoria due   * record 1   * record 2   * record 3 Anybody could please help me with this query? Thank you in advance


How to add editor's name to entry meta byline?

I have one multi-authored blog site and a few editors. What I want is to display the name of the editor along with the author's name in a post, so that it would read like: Posted by , Edited by Is it possible?


Returning website screenshot based on Custom Field

I am trying to return a screenshot from websites using this               <img src="<?php echo 'http://s.wordpress.com/mshots/v1/'.urlencode('http://domain.com/').'?w=200' ?>" />      This works fine for the current domain.com, I am trying to combine this with a custom field where I normally enter               <?php the_field('website'); ?>      I have tried the following               <img src="<?php echo 'http://s.wordpress.com/mshots/v1/'.urlencode(the_field('website'); ').'?w=200' ?>" />      But it doesn't seem to work. Any ideas? Thanks Richard


How to modify Media Library images DPI [ image quality down to make small in size ]

I wonder if there any code or hook out there to manage the image DPI, for example when we use photoshop or other image editing software we use export and image quality to 0-100%, now i am looking for a plugin or code to define the media library'r image DPI to make them small in size. This is i want store two version one with smaller size[DPI] and one for HD quality. Anyone Can help ?


How to use existing hook in twentytwelve to all theme of wordpress?

I Recently tried to read the tutorial for `wp_footer` and also `twentytwelve_credits` for creating a sample wordpress plugins. `wp_footer` hook to display the footer beneath the page area. `twentytwelve_credits` hook display the footer in the page footer on a white background. **For Example:** I tried this code to show the footer with custom message.               <?php     function your_function() {         echo '
This is inserted at the bottom
';     }     add_action('wp_footer', 'your_function');     ?>      I tried this code after switching a theme to twenty twelve.               <?php     function your_function() {         echo '
This is inserted at the bottom
';     }     add_action('twentytwelve_credits', 'your_function');     ?>      I find the difference when using different hooks. `wp_footer` hook is working for all themes but it is in bottom of the site. `twentytwelve_credits` is working for the twentytwelve theme only. I beleive twentytwelve_credits is the efficient way rather than wp_footer. but its hard to change the hook for every theme. I am not sure is the way to show of the footer with every theme with twentytwelve_credits. Any Possibilities like `do_action('twentytwelve_credits');`. Any Suggestion would be great.


Post type to calendar

I have a custom post type called "events" How can I use the date on that post type to create a ics feed so users and subscribe to upcoming events?


Custom column for changing post status via ajax

I'm currently trying to implent a new custom column at the page manage screen that will let me change the status (published/pending) of the different pages via an easy toggle link. From what I've gathered I need to use $post->post_status, ' _status_ 'in someway, probably toggle with jQuery or something. But I can't figure out how I tie it together with ajax. Thought I'd get some help looking at the default post status modifier in the edit post screen, but I realized that it's not ajax based, I the status updates when you press "update" (obviously, duh). Here's my lousy try for an attempt so far:               function wp_change_page_status_link() {         $status = get_post_status($ID);         if($status == 'publish'){             $status = 'On';             //$post->post_status, 'pending'         }         elseif($status == 'pending'){             $status = 'Off';         }         return $status;     }      Would be really grateful if someone could point me in the right direction..


comment_form - show all fields when logged in

I'm using the http://codex.wordpress.org/Function_Reference/comment_form in my comments. If logged in I'm seeing only the textarea for my comment, **not the fields for e-mail and name.** **Question** Is it possible to make them visible even when logged in? Why would I want to do that? I'm designing themes and it would be easier for me as a designer to see what visitors see.


Fixing media links after importing to multisite

When i imported all posts and media from a old site to new site which on wordpress multisite. The image links on posts are got broken because how media are stored on a multisite is quite different from a single installation wordpress site. And also the links in the contents are static so it don't change when imported. Single installation example: `http://oldsite.com/wp-content/uploads/2010/07/image.jpg` Multisite installation example: `http://mysite.com/files/2010/07/image.jpg` So, you see if i can go through all posts replace old links with the new links in all image/media links it is going to work. We need to change the first part of the url. the name and the date of the media will be same as the importer will use the same publish date and name when imported. **My question is:** Is there any plugin which can do that? or some other way i can do it?


Limited number of paging to 10 "pages: 1 ... 10"

How to limit the function of paging down to stop at number 10? Eg: pages: 1 2 3 4 5 6 7 8 9 10.               function kriesi_pagination($pages = '', $range = 2)     {        $showitems = ($range * 2)+1;             global $paged;      if(empty($paged)) $paged = 1;           if($pages == '')      {          global $wp_query;          $pages = $wp_query->max_num_pages;          if(!$pages)          {              $pages = 1;          }      }              if(1 != $pages)      {          echo "
";          if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "«";          if($paged > 1 && $showitems < $pages) echo "‹";               for ($i=1; $i <= $pages; $i++)          {              if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))              {                  echo ($paged == $i)? "".$i."":"".$i."";              }          }               if ($paged < $pages && $showitems < $pages) echo "›";            if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "»";          echo "
\n";      }     }      I appreciate any help.


How to add TinyMCE keyboard shortcut

The most thorough documentation I can find of how to add a new keyboard shortcut to TinyMC is at this page: http://www.lifeinsuranceonmyterms.com/other/custom-keyboard-shortcuts-for- tinymce-how-to It involves adding this code to the main TinyMCE source file, tiny_mce_src.js (and then recompressing):               t.addShortcut([keyboard command], [shortcut name], [command name]);      Is there a way to add a shortcut without hacking the core/TinyMCE? > Update: Specifically, I want to add shortcuts to apply h2/h3/h4 or other > TinyMCE button actions to selected text in TinyMCE.


Sort WP_Query by one meta key and post_date

I want to order by post to check for the existence of a meta key ('featured') and include those posts first and as a secondary option I want to sort by post_date, similar to 'sticky' posts on a discussion forum. I first tried this straightforward method ...               $args = array(       'store'         => 'walmart',       'post_type'     => 'post',       'showposts'     => '-1',       'orderby'       => 'featured date',       'order'         => 'desc',       'meta_key'      => 'featured'     );      It almost worked but instead of having the 'featured' posts at the top of the order it had them at the bottom, and no simple toggling could get it to work. I then researched some more and came across this method http://dotnordic.se/sorting-wordpress-posts-by-several-numeric-custom-fields/, but I can't get this to work for the life of me. I would prefer to use this filter as I have one other customization that this might help with, can anybody show me what I'm doing wrong. Here's what I have now ...               add_filter('posts_orderby','customorderby');     $args = array(         'store'         => 'walmart',         'post_type'     => 'post',         'showposts'     => '-1',         'meta_key'      => 'featured',         'meta_query'    => array(             array(                 'key' => 'featured'             )         )     );          $query = new WP_Query($args);     remove_filter('posts_orderby','customorderby');      and in my functions.php               add_filter('posts_orderby','customorderby');     function customorderby($arg) {         global $wpdb;              $arg = 'mt1.meta_value DESC, post_date+0 DESC';         return $arg;     }


Filter plugin posts by meta value

I am a WordPress beginner, but have a few years of software development experience. I have a WordPress plugin used to display custom data via a custom post type. The index page contains something like this to display this data:               <?php if ( have_posts() ) : ?>             <ul>                 <?php while ( have_posts() ) : the_post(); ?>                     <?php get_template_part( 'content', get_post_format() ); ?>                 <?php endwhile; ?>             </ul>              <?php endif; ?>      I need to filter this data based on the value of a cookie that corresponds to a meta value set on this post type. So in the `functions.php` of my plugin, I have something like this:               function modify_post_query($query)     {         if ($query->get('post_type') == 'my_post_type' && !is_admin())         {             if (isset($_COOKIE["my_key"]) && $_COOKIE["my_key"] == "val1")             {                 $query->set('meta_key', 'my_meta_key');                 $query->set('meta_value', 'meta_value_1');             }             else             {                 $query->set('meta_key', 'my_meta_key');                 $query->set('meta_value', 'meta_value_2');             }         }     }     add_filter('pre_get_posts', 'modify_post_query');      I got this mostly from this post. And it doesn't have any effect. I've already figured out that the cookie value is not available at this point in the page cycle (how to get at that data is a separate question), but that just means I'll always end up in the `else` case, and even that doesn't have any effect on what's being rendered in the list. And I know the `else` case is being executed, because I've added `error_log` statements to check. What am I doing wrong? What exactly needs to go where?


permalink /category/post-name with custom post type and taxonomy

I want to use custom post types with a custom taxonomy for different types of posts on my page. I have registered a custom post type called "portfolio" and a taxonomy for this post type.               function my_custom_post_portfolio() {       $labels = array(         'name'               => _x( 'Portfolio', 'post type general name' ),         'singular_name'      => _x( 'Portfolio-item', 'post type singular name' ),         'add_new'            => _x( 'Add New', 'portfolio' ),         'add_new_item'       => __( 'Add New Item' ),         'edit_item'          => __( 'Edit Item' ),         'new_item'           => __( 'New Item' ),         'all_items'          => __( 'All Items' ),         'view_item'          => __( 'View Item' ),         'search_items'       => __( 'Search Items' ),         'not_found'          => __( 'No items found' ),         'not_found_in_trash' => __( 'No items found in the Trash' ),          'parent_item_colon'  => '',         'menu_name'          => 'Portfolio'       );       $args = array(         'labels'        => $labels,         'description'   => 'Holds our portfolio items',         'public'        => true,         'menu_position' => 5,         'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),         'taxonomies'    => array('category'),               'has_archive'   => true,       );       register_post_type( 'portfolio', $args );      }     add_action( 'init', 'my_custom_post_portfolio' );              function add_custom_taxonomies() {         register_taxonomy('portfolioitems', 'portfolio', array(             'hierarchical' => true,             'labels' => array(                 'name' => _x( 'Portfolioitems', 'taxonomy general name' ),                 'singular_name' => _x( 'Item', 'taxonomy singular name' ),                 'search_items' =>  __( 'Search items' ),                 'all_items' => __( 'All items' ),                 'parent_item' => __( 'Parent item' ),                 'parent_item_colon' => __( 'Parent item:' ),                 'edit_item' => __( 'Edit item' ),                 'update_item' => __( 'Update item' ),                 'add_new_item' => __( 'Add new item' ),                 'new_item_name' => __( 'New item name' ),                 'menu_name' => __( 'items' ),             ),             'rewrite' => array(                 'slug' => 'portfolio',                 'with_front' => false,                 'hierarchical' => true             ),         ));     }     add_action( 'init', 'add_custom_taxonomies', 0 );      I have template files for both of them, a archive-portfolio.php, the "starting page" of the portfolio posts, a single-portfolio.php for the display of the single portfolio item, and a taxonomy-portfolioitems.php for displaying all posts related to one "tag" (technically a custom taxonomy item) It is working now fine, except that I get a 404 when trying to view the portfolio post. My permalink structure is: /%category%/%postname%/ and I have the FV Top Level Categories plugin active to remove the "category" (like /category/portfolio/portfolio-post) from the url. When I try to view my "normal" blog posts its working fine, the url is /blog/blog-categoryname/post-name But my custom post type items give me 404 when trying to call /custom-post- type/post-name (I have also a menu link called "portfolio" and its pointing to the category portfolio, which is registered with the custom post type.. could this be intefering somehow?) Thanks so much!


How do I do a page break?

Is there a way to add a page break into length pages? Preferably automatically, but doesn't really matter. Ideally without a plugin.


Where to replace short code

Hey I am new to wordpress and web design in general. I just downloaded a plugin that helps edit navigation menus. The plugin is called Simple Responsive Menu. They are asking me to " Add shortcode in your theme(header.php) or replace your current menu.               [srMenu theme_location=primary]      OR               <?php echo do_shortcode('[srMenu theme_location=primary]');?>      The theme I am using is DonateNow, and would like to know what exactly in the header.php code I should replace. The header.php code is as follows:               <!DOCTYPE html>                         <html <?php language_attributes(); ?>>              <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />     <meta name="viewport" content="width=device-width, initial-scale=1">     <title><?php wp_title( '|', true, 'right' ); ?></title>     <link rel="profile" href="http://gmpg.org/xfn/11" />     <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />     <?php wp_head();            global $page, $post, $paged;             ?>               <body <?php body_class(); ?> >     <?php if (function_exists('AWM_generate_linking_code'))AWM_generate_linking_code(); ?>               <?php     $title_bg=get_post_meta($post->ID, "m_title_backgrounds", true);     $title_sub=get_post_meta($post->ID, "m_title_sub", true);     $title=get_post_meta($post->ID, "m_title_on", true);     $header=get_post_meta($post->ID, "madza_header_type", true);     $headerp=get_post_meta($post->ID, "m_page_background", true);      $_bacground_image_page=get_post_meta($post->ID, "m_page_background", true);      $breadcrumbs = get_post_meta($post->ID, "m_title_bred", true);     $pagination_navigation = get_post_meta($post->ID, "madza_portfolio_navigation", true);                    /*-----------------------------------------------------------------------------------*/     /*  BG IMAGE     /*-----------------------------------------------------------------------------------*/          $_background_exist = "no";     if ( $_bacground_image_page !="") { if (  $_bacground_image_page['background-image'] !="" ) { $_background_exist = "yes"; } }          $_background_exist_r = "no";     if ( $_bacground_image_page !="") { if ( $_bacground_image_page['background-repeat'] !="" ) { $_background_exist_r = "yes"; } }          $mt_homepage_bg = ot_get_option('mt_homepage_bg');      if (is_front_page()){           if ( ! empty( $mt_homepage_bg )) {               if ($mt_homepage_bg['background-repeat']=="" and $mt_homepage_bg['background-image']!=""){                        $mt_homepage_bg = ot_get_option('mt_homepage_bg');                       ?><img id="background" src="<?php echo $mt_homepage_bg['background-image']; ?>" alt=""  /><?php                   }         }     } else if ( $_background_exist == "yes" and $_background_exist_r ="no" ) {                     ?><img id="background" src="<?php echo $_bacground_image_page['background-image']; ?>" alt=""  /><?php                } else if($_background_exist == "no" and $_background_exist_r ="no") {                $mt_homepage_bg = ot_get_option('mt_defaultpage_bg');                   if ( ! empty( $mt_homepage_bg )) {                      if($mt_homepage_bg['background-repeat']=="") {                          ?><img id="background" src="<?php echo $mt_homepage_bg['background-image']; ?>" alt=""  /><?php                           }             }          }                                   function mt_logo() {              if(ot_get_option("theme_logo")!="") { $logo_image = ot_get_option("theme_logo"); } else { $logo_image = get_template_directory_uri()."/images/donatenow_logo.png";  }         if(ot_get_option("responsive_logo")!="") { $logo_image_responsive = ot_get_option("responsive_logo"); } else { $logo_image_responsive = get_template_directory_uri()."/images/donatenow_logo.png";  }              ?>         <a class="visible-desktop" style="margin-top:<?php if(ot_get_option("logo_style_margin")!="") { echo ot_get_option("logo_style_margin"); } else { echo "20"; } ?>px" id="logo" href="<?php echo home_url();?>">                  <img width="<?php if(ot_get_option("logo_style_width")!="") { echo ot_get_option("logo_style_width"); } else { echo "225"; } ?>" height="<?php if(ot_get_option("logo_style_height")!="") { echo ot_get_option("logo_style_height"); } else { echo "40"; } ?>" src="<?php echo $logo_image; ?>"  alt="<?php bloginfo('name'); ?>" />                            <a class="hidden-desktop" style="margin-top:<?php if(ot_get_option("logo_style_margin")!="") { echo ot_get_option("logo_style_margin"); } else { echo "20"; } ?>px" id="logo" href="<?php echo home_url();?>">                  <img  width="<?php if(ot_get_option("logo_style_width")!="") { echo ot_get_option("logo_style_width"); } else { echo "225"; } ?>" height="<?php if(ot_get_option("logo_style_height")!="") { echo ot_get_option("logo_style_height"); } else { echo "40"; } ?>" src="<?php echo $logo_image_responsive; ?>" alt="<?php bloginfo('name'); ?>" />                       <?php     }          add_filter('mt_logo','mt_logo');               function mt_social() {              ?>
 <?php                  if(ot_get_option('soc_facebook')!="") {?>
<a class="facebook" href="<?php echo ot_get_option('soc_facebook'); ?>">Facebook
<?php }              if(ot_get_option('soc_twitter')!="") {?>
<a class="twitter" href="<?php echo ot_get_option('soc_twitter'); ?>">Twitter
<?php }              if(ot_get_option('soc_vimeo')!="") {?>
<a class="vimeo" href="<?php echo ot_get_option('soc_vimeo'); ?>">Vimeo
<?php }              if(ot_get_option('soc_youtube')!="") {?>
<a class="youtube" href="<?php echo ot_get_option('soc_youtube'); ?>">Youtube
<?php }              if(ot_get_option('soc_linkedin')!="") {?>
<a class="linkedin" href="<?php echo ot_get_option('soc_linkedin'); ?>">LinkedIn
<?php }              if(ot_get_option('soc_google')!="") {?>
<a class="gplus" href="<?php echo ot_get_option('soc_google'); ?>">GooglePlus
<?php }              if(ot_get_option('soc_dribbble')!="") {?>
<a class="dribbble" href="<?php echo ot_get_option('soc_dribbble'); ?>">Dribble
<?php }              if(ot_get_option('soc_skype')!="") {?>
<a class="skype" href="<?php echo ot_get_option('soc_skype'); ?>">Skype
<?php }             if(ot_get_option('soc_delicious')!="") {?>
<a class="delicious" href="<?php echo ot_get_option('soc_delicious'); ?>">Delicious
<?php }              if(ot_get_option('soc_pinterest')!="") {?>
<a class="pinterest" href="<?php echo ot_get_option('soc_pinterest'); ?>">Pinterest
<?php }              if(ot_get_option('soc_yahoo')!="") {?>
<a class="yahoo" href="<?php echo ot_get_option('soc_yahoo'); ?>">Yahoo
<?php }              if(ot_get_option('soc_amazon')!="") {?>
<a class="amazon" href="<?php echo ot_get_option('soc_amazon'); ?>">Amazon
<?php }              if(ot_get_option('soc_rss')!="") {?>
<a class="rss" href="<?php echo ot_get_option('soc_rss'); ?>">Rss
<?php }               ?>
 <?php     }          add_filter('mt_social','mt_social');               function mt_header_html() {              ?>
<?php echo ot_get_option('mt_top_html'); ?>
<?php     }          add_filter('mt_header_html','mt_header_html');                    function mt_menu() {         wp_nav_menu( array('theme_location'=>"header_menu",  'menu_class' => 'sf-menu',  'menu_id' => 'menu', 'echo' => true, 'depth' => 0));           wp_nav_menu( array('theme_location'=>'select_menu', 'fallback_cb' => false, 'walker'=>new select_menu_walker(), 'items_wrap' => '<select class="select-menu" id="sec-selector" name="sec-selector" onchange="location.href = document.getElementById(\'sec-selector\').value;">%3$s</select>',  'container_id' => 'mobile_menu_secondary' ));     }          add_filter('mt_menu','mt_menu');                    function mt_menu_html() {              if(ot_get_option('right_area_search')=="html") { ?>

<?php do_action('icl_language_selector'); ?>

<?php echo ot_get_option('mt_menu_html'); ?>

              <?php  }      }          add_filter('mt_menu_html','mt_menu_html');          ?>          <?php if(get_post_meta($post->ID, "mt_style_header", true)!="style_default" and get_post_meta($post->ID, "mt_style_header", true)!="")  {?>                        <?php if(get_post_meta($post->ID, "mt_style_header", true)=="style_4") { ?>

<?php mt_logo(); ?>

<?php mt_menu_html(); ?>

<?php mt_header_html(); ?>

Donate Today!

<?php mt_menu(); ?>

              <?php } else if(get_post_meta($post->ID, "mt_style_header", true)=="style_2") { ?>

<?php mt_logo(); ?>

 <?php mt_menu(); ?>

Donate Today!

                                 <?php } else if(get_post_meta($post->ID, "mt_style_header", true)=="style_3") { ?>

<?php mt_logo(); ?>

 <?php mt_menu(); ?>

Donate Today!

                                 <?php } else  { ?>

<?php mt_logo(); ?>

                                  <?php mt_header_html(); ?>                             <?php mt_social(); ?>

Donate Today!

                              <div class="<?php if(ot_get_option('right_area_search')=="search") { echo "span12"; } else { echo "span8"; } ?>"><?php mt_menu(); ?>
                         <?php if(ot_get_option('right_area_search')=="search") { } else { ?>
<?php mt_menu_html(); ?>
<?php } ?>

              <?php } ?>          <?php } else { ?>              <?php if(ot_get_option("mt_style_header")=="style_4") { ?>

<?php mt_logo(); ?>

<?php mt_menu_html(); ?>

<?php mt_header_html(); ?>

Donate Today!

<?php mt_menu(); ?>

              <?php } else if(ot_get_option("mt_style_header")=="style_2") { ?>

<?php mt_logo(); ?>

 <?php mt_menu(); ?>

Donate Today!

                                 <?php } else if(ot_get_option("mt_style_header")=="style_3") { ?>

<?php mt_logo(); ?>

 <?php mt_menu(); ?>

Donate Today!

                                 <?php } else { ?>

<?php mt_logo(); ?>

                                  <?php mt_header_html(); ?>                             <?php mt_social(); ?>

Donate Today!

                              <div class="<?php if(ot_get_option('right_area_search')=="search") { echo "span12"; } else { echo "span8"; } ?>"><?php mt_menu(); ?>
                         <?php if(ot_get_option('right_area_search')=="search") { } else { ?>
<?php mt_menu_html(); ?>
<?php } ?>

              <?php } ?>          <?php } ?>          <?php     /*-----------------------------------------------------------------------------------*/     /*  Slider     /*-----------------------------------------------------------------------------------*/     if (is_front_page()){                  if(ot_get_option('home_slider_type')=="home_slider_flex"){                            function_slider_flex();                   }                   if(ot_get_option('home_slider_type')=="home_slider_shortcode"){                          echo '
';  echo do_shortcode(ot_get_option('home_slider_shortcode_code')); echo "
";              }          } else {                       if(get_post_meta($post->ID, "mt_page_slider_type", true)=="flex_slider"){                           function_slider_flex();              }                   if(get_post_meta($post->ID, "mt_page_slider_type", true)=="shortcode_slider"){                           echo '
'; ;  echo do_shortcode(get_post_meta($post->ID, "mt_page_slider_shortcode", true));  echo "
";                   }     }           ?>          <?php if ( !is_front_page() and $title=="on" or !is_front_page() and $title=="" ) { ?>               <div id="header-title" <?php if( $title_bg != "" or ot_get_option("title_background") != "" ) {  ?>              style="background-image: url(<?php if( $title_bg == "" ) { echo ot_get_option("title_background"); } else { echo $title_bg; } ?>)!important; background: center; "<?php } ?>>

                              <?php if (is_singular("tribe_events")) {  ?>

<?php the_title(); ?>

<?php next_post_link('%link','

'); previous_post_link('%link','

');  ?>
                                   <?php } else if (is_singular("portfolio") ) {  ?>

<?php the_title(); ?>

<?php next_post_link('%link','

'); previous_post_link('%link','

');  ?>
                                   <?php } else if (is_singular('causes')){ ?>

<?php the_title(); ?>

<?php next_post_link('%link','

'); previous_post_link('%link','

');  ?>
                              <?php } else if (is_single()){ ?>

<?php the_title(); ?>

<?php next_post_link('%link','

'); previous_post_link('%link','

');  ?>
                               <?php } else if (is_search()){ ?>

<?php printf( __( 'Search Results for: %s', "madza_translate"  ), '' . get_search_query() . '' ); ?>

                              <?php } else if (is_404()){ ?>                                   <divclass="span8">
<?php printf( __( '404 page', "madza_translate"  ) ); ?>

                              <?php } else if (is_category()){ ?>

<?php single_cat_title( $prefix = '', $display = true ); ?>

<?php if ( ot_get_option('bredcrumb')=="on" AND $breadcrumbs == "on"){  dimox_breadcrumbs(); } ?>
                              <?php } else if (is_tag()){ ?>

<?php single_cat_title( $prefix = '', $display = true ); ?>

<?php if ( ot_get_option('bredcrumb')=="on" AND $breadcrumbs == "on"){  dimox_breadcrumbs(); } ?>
                              <?php } else { ?>

<?php                                   if(function_exists( 'tribe_is_event' ) ) {                                           if (tribe_is_event() && !tribe_is_day() && !is_single()) {                                                    printf( __( 'Events', "madza_translate"  ) );                                            } else {                                                   the_title();                                      }                                   } else {                                       the_title();                                   } ?>

<?php if ( ot_get_option('bredcrumb')=="on" AND $breadcrumbs == "on"){  dimox_breadcrumbs(); } ?>
                              <?php } ?>

            <?php } ?>

 <?php           Any and all help is appreciated. Thank You!


Developing, Testing and Releasing

How do you develop, test and deploy-to-live your Wordpress sites? Its always a bit of a faff I find, especially where databases are concerned - mainly due to the fact that having a testing site needs a whole new database to be deployed which can sometimes be EXACTLY the same, except all the links are changed to the testing site url, instead of the live site. Similarly any uploads that users have uploaded since the last time you needed to fix a bug or develop something new will have to be copied across to the testing site. How do others do it? Do you just put up with the faff? Do you use clever version control systems which help? Thanks


Using Subversion to deploy WordPress

I use Subversion with my websites. Up until now, this has meant creating a new repo for each of my sites. However, this is wholly inefficient as it means me lugging around the whole WordPress source for each of the sites. It also has meant that I have to copy plugins between repos and thus duplicate the code each time. So what I wanted to do was have a repo which only really contained my theme file (and possibly other site-specific directories such as site-specific plugins). This would then have a link to the tagged WordPress repository for the WordPress version I would be building against and a link to my other shared plugin repos, so that in order to release or deploy for testing I would only have to do a `svn checkout svn://path/to/site/repo` and it would download the whole WordPress repo, all my plugins and all the site-specific stuff too. Is there any way to do this? Or is this a bad idea? Is there an easier/better way to do this at all? How do others do it?


Why are authors allowed to approve comments on their posts? How to revoke privilege?

I was under the impression that only admins/editor roles can approve comments however our authors are able to do so as well on their own posts. I want to disable the ability for an author to approve comments on their posts. Under dashboard settings > discussions > Before a comment appears-- Selected: Comment must be manually approved   Unselected: Comment author must have a previously approved comment


get_post_meta slowing down my page load (in a plugin)

I've been working on this project where I need to load events (custom post type) and a whole bunch of meta data for every event. The problem is that page loading times are getting longer and longer when more and more events get added. At the start with only a few events this wasn't a problem at all, but now when there are 100+ events in the system page loads take up to 6 seconds which is too long. Example of what I'm doing: Show all the events in the system (All below is done inside a plugin) I load all events with get_posts and specify the custom post type. I loop through all the posts and get all the meta data with `get_post_meta` in a single call. When testing where the bottleneck was, I found out that when I remove `get_post_meta` execution time went down from 4.5 seconds to 14ms. I also tested what would happen if I load every meta data separately like so: `get_post_meta($post->ID, "meta_value", true);` If I have a view where I only need a few meta values this speeds up the process to where I could cut 20% of the loading time, but when I need almost all, there was no change in loading times. I also noticed that using `get_post_custom` doesn't really help in this case. After looking around online (here, blogs, etc..), people pointed out that when you do a `get_posts`, all meta data is automatically retrieved and cached. But it seems this isn't true when I look at the execution time and amount of queries that are processed. Is there any way of speeding this up further via php/mysql? One thing I was thinking of was: is there a way of getting all posts and meta data for each post in a single call. But I didn't have any luck of finding something online that would help me achieving this.