How to get the specific Page's current ID and use it in a get_page function?

Example of the code:               $page_id = 116; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.     $page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), Wordpress will generate an error.          $content = apply_filters('the_content', $page_data->post_content); // Get Content and retain Wordpress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem     $title = $page_data->post_title; // Get title     echo $title; // Output Content     echo $content; // Output Content     ?>      Instead of `166` (which was manually entered), I would like to retrieve the ID of the current page. When i do $page_id = $post -> ID it retrieves the title and content of thte first post of the loop below (this is the posts page):
                     <?php // find all content that has the type of video and then to loop through them. ?>                     <?php query_posts('showpost'); ?>                          <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                                          <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                                         <?php if ( is_front_page() ) { ?>
<?php the_title(); ?>
                                         <?php } else { ?>
<?php the_title(); ?>
                                         <?php } ?>
                                             <?php the_content(); ?>                                             <?          php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>                                                 <?php edit_post_link( __( 'Edit', 'twentyten' ), '', '' ); ?>

                                              <?php comments_template( '', true ); ?>                              <?php endwhile; ?>
      I would like to retrieve the code of the current page dynamically (which is 116). What is the code to accomplish that?


display custom portfolio tags

This is a part from the code that is used to display portfolio categories:               $post_cat = array();                         $post_cat = wp_get_object_terms($post->ID, "portfolio_category");                         $post_cats = array();                   $attachments = get_post_meta($post->ID, '300-160-image', true);                  if ($attachments) {                                      $post_cat = array();                             $post_cat = wp_get_object_terms($post->ID, "portfolio_category");                             $post_cats = array();                                  $cats_pf_this = implode(":", $post_cats);                  $fg_imagemain.='{"url": "'.get_bloginfo('template_directory').'/image.php?'.str_replace("&", "&", $image_resizer_output).'image='.$attachments.'", "aid": '.$post->ID.', "color": "'.addslashes(get_post_meta($post->ID, 'thumbnail_hover_color', true)).'", "thumb_title": "'.addslashes($thumb_title).'", "thumb_descr": "'.addslashes($thumb_descr).'", "thumb_cats": "'.addslashes($cats_pf_this).'", "fullimgsrc": "}';                  var fg_divhoverbgmetadata = $("
").addClass("hoverbgpfthnailmetadata").html(''+srcobj.thumb_title+''+srcobj.thumb_cats+'+');      What I want to do, is, to display also the portfolio tags. I think the first step is to duplicate this:               $post_cats = array();                         $post_cat = wp_get_object_terms($post->ID, "portfolio_category");      like :               $post_tags = array();                         $post_cat = wp_get_object_terms($post->ID, "portfolio_tags");      and the same for rest of the code. I've tried this but with no success, I can't make it work to display portfolio items tags. What am I doing wrong?


Changing the category permalink structure

Hopefully another simple one, I have some nested categories, like this:               - category-a         - category-b              -category-c      The permalink for category-c is as follows:               http://<domain>/category/category-a/category-b/category-c/      What I'd really like is for the permalink to not include any parent categories, instead it would become this:               http://<domain>/category/category-c/      Is there a way this can be achieved? I have some categories that do nothing but group sub-categories together, thus I don't really want them displaying to my users. Many thanks!


Wordpress 3.5 Media Uploader - Only allow 1 upload and certain file types

I am trying to include the new WP Media Uploader in a Custom Meta Box. I found this tutorial: http://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/ However i am looking for a way to limit the uploader to only accept certain types of files like 'application/msword', 'application/vnd.ms-excel', 'application/pdf', etc. and to return the linked document url to a text field i have in the metabox I have searched google now for countless hours but could not find anything useful... Any ideas, links or just basically anything to point me in the right direction would be highly appreciated! Thanks!


Displaying page content in category archive (archive.php)

I'm new to template editing in wordpress and I'm trying to get a page description to show up on my site but it is not appearing. The URL I'm trying to get to display the description is here: http://fourwallsla.com/category/the-neighborhood/east-side/ and I've attached the screenshot of the page description within wordpress. It appears to be using the archive template (why is it not using the page template?). Here's the code for the archive template:               <?php get_header(); ?>
                  <?php             $category = get_the_category();              $catName = $category[0]->cat_name;             $catName = strtolower($catName);              ?>              <?php if (have_posts()) : $first = true; ?>             <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>             <?php /* If this is a category archive */ if (is_category()) { ?>
<?php single_cat_title(); ?>
             <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<?php single_tag_title(); ?>
             <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<?php echo get_the_time('F jS, Y'); ?>
             <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<?php echo get_the_time('F, Y'); ?>
             <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<?php echo get_the_time('Y'); ?>
             <?php /* If this is an author archive */ } elseif (is_author()) { ?>
<?php _e( 'Author Archive', 'gray_white_black' ); ?>
             <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<?php _e( 'Blog Archives', 'gray_white_black' ); ?>
             <?php } ?>
             <?php             switch ($catName)             {                 case "east side":                     iinclude_page(17);                     break;                 case "downtown":                     iinclude_page(20);                     break;                 case "mid-city":                     iinclude_page(15);                     break;                 case "west side":                     iinclude_page(23);                     break;                 case "coastal":                     iinclude_page(27);                     break;                 case "valley":                     iinclude_page(25);                     break;                 default:                     iinclude_page(6);             }             ?>

             <?php while (have_posts()) : the_post();                 if($first) $class = "first-in-row";                 else $class="";                 $first = !$first;                 ?>                                  <li <?php post_class($class); ?>>                     <?php the_post_thumbnail(); ?>
<?php the_category(", "); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?> <?php edit_post_link(__('Edit', 'gray_white_black'), '', ''); ?>
                          <?php the_excerpt(); ?>
<a href="<?php the_permalink() ?>"><?php _e( '»» ', 'gray_white_black' );?>
                     <?php if(has_tag()): ?>
<?php the_tags(""); ?>
<?php endif; ?>
                              <?php endwhile; ?>

                 <?php next_posts_link(__('« Previous Posts', 'gray_white_black')) ?>                 <?php previous_posts_link(__('Next posts »', 'gray_white_black')) ?>
              <?php else : ?>
<?php _e( 'Not found', 'gray_white_black' ); ?>

<?php _e( 'Sorry, but you are looking for something that isn\'t here.', 'gray_white_black' ); ?>
             <?php get_search_form(); ?>         <?php endif; ?>
     <?php get_sidebar(); ?>          <?php get_footer(); ?>      Where, in the code above, the_post(), appropriately, refers to the content for the home listing within the category displayed on the page. But how do I get the_post() for the page itself, shown in the screenshot? Thanks. ![enter image description here](http://i.stack.imgur.com/3YIQO.png)


Force is_search to always TRUE

I'm extending the search functionality by adding custom query vars to the search query object via `pre_get_posts` so that it'll be able to include tax_query and meta_query as search conditions. Everything works except when the query var `s` is empty, Wordpress redirects to the archive page which is not ideal because I'd still want it to search posts based on the other query vars(tax_query & meta_query). I'm thinking maybe it has something to do with setting `is_search` boolean. So I tried to manually set it to `true` but it gets overridden and reverted back to `false`. Is there a way to force it so it'll always be true and therefore Wordpress stays in the search page even though the query var `s` is empty? Or am I doing this the wrong way? Here's my class for that:               class Custom_Query {          private $_get;     private static $_instance;          public function __construct() {         $this->_get = $_GET;         add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 9999 );         add_filter( 'wp', array( $this, 'remove_product_query' ) );     }          /**      * Hook into pre_get_posts to do the main product query      *      * @access public      * @param mixed $q query object      * @return void      */     function pre_get_posts( $q ) {         // We only want to affect the main query         if ( !$q->is_main_query() || is_admin() )             return;              $meta_query[] = $this->date_meta_query();         $q->set( 'meta_query', $meta_query );              $tax_query[] = $this->category_tax_query();         $q->set( 'tax_query', $tax_query );              $q->set( 'is_search', true );     }          /**      * Returns date meta query      *      * @return array $meta_query      */     function date_meta_query() {         $meta_query = array();         $compare = '=';         $value = $this->to_date( $this->_get['ptp_date'] );               if ( isset( $this->_get['ptp_date_start'] ) && isset( $this->_get['ptp_date_end'] ) ) {             $compare = 'BETWEEN';             $value = array( $this->to_date( $this->_get['ptp_date_start'] ), $this->to_date( $this->_get['ptp_date_end'] ) );         }              $meta_query = array(             'key' => '_event_date',             'value' => $value,             'compare' => $compare         );              return $meta_query;     }          /**      * Returns category taxonomy query      *      * @return array $tax_query      */     function category_tax_query() {         $tax_query = array();         $terms = array( (int) $this->_get['ptp_term_id'] );         $operator = 'IN';              $tax_query = array(             'taxonomy' => 'product_cat',             'field' => 'id',             'terms' => $terms,             'operator' => $operator         );              return $tax_query;     }          /**      * Converts date string into supported DATE format      *      * @param $date      * @return string $date      */     function to_date( $date ) {         return date( 'Y-m-d H:i:s', strtotime( $date ) );     }          /**      * Remove the query      *      * @access public      * @return void      */     function remove_product_query() {         remove_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ) );     }      }


Worpdress PHPSESSID / EU law

WordPress is installing a PHPSESSID cookie as soon as someone lands on my site. Under new EU law if its non-essential i have to block it so that a user can opt-in. But if it is essential its ok as long as I detail its use on my site. This is the problem. I look after about 20 WordPress sites and only 2 of them install a PHPSESSID cookie immediately. I cant see why. Its definitely not caused by any of my more unusual code or any of the plugins as I have stripped it down to its barebones and its still doing it. I know WordPress is installing it and I assume it's essential (which will mean it's ok according to the new directive) but I still need to detail it on my cookies page. But I dont know what it is and cant find anything on the web :( Both of the sites affected don't give the option for login. Whereas a load of the others do and they don't install that cookie so I have no idea what its purpose is. Can anyone say what this cookie does and why only 2 of my sites are installing it into the browser? Both use latest version of WP and there is nothing like an ecommerce element in either site. cheers James


Cant remove line that appears above page content

Hi all I am running a multisite I have custom page templates that are working fine however the home page displays the text below, am sure its not in the template and I am struggling to find where its coming from. Any direction as to what might be calling it would be gratefully received. 2" class="hentry p1 page publish author-jonkino untagged is-full comments- closed pings-closed y2012 m05 d18 h23 slug-home"> http://www.secretgardensfestival.net/secretkino/


Custom Post Type Rewrite To Include Parent Page(s)

I have a page title "more" with subpage "cities-guide". Said "cities guide" page has a loop that pulls in posts from custom post type "thailife_city_guide". My permalink structure is `/%category%/%postname%/`. At present clicking a link to a custom post from   `www.mydomain.com/more/cities-guide gives`   `www.mydomain.com/thailife_city_guide/bangkok` for example. I want it to be displayed as `www.mydomain.com/more/cities-guide/bangkok` but cannot get anything to work I tried fixing the rewrite in the CPT register to `'rewrite' => array( 'slug' => 'more/cities-guide' )`, but to no avail, throws a 404. Can someone please advise as I just dont really understand the way in which WordPress rewrite works so I am stumped?


Different results between permalink and query var search

I'm running WordPress 3.3.2 with my own custom-built theme that has 4 custom post types. Currently, I'm looking for a way to replace the search link from `example.com/blog/?s=findme` with `example.com/search/findme`. I've seen that WordPress already has the possibility to generate search results by using the pretty permalink search, but the result it gives includes all the other custom post types as well, while the standard search using the `?s=` query var retrieves only blog posts. How do I limit the search results generated by the permalink search to only include regular blog posts and filter out the custom post types?


How to redirect http://mydomain/blog/blahblah/ to http://mydomain/blahblah/ in wordpress htaccess?

I would like the htaccess rewrite rule to compare to IIS rewrite rule I tried which doesn't seem to work:               <rule name="rewrite /blog/">          <match url="^blog/([_0-9a-zA-Z\-]+)/$" />          <action type="Rewrite" url="/{R:1}/" />      </rule>


How to display wp_nav_menu() conditionally only when not on a 404 page?

I made a custom design for my site. On my header i put my navigation so everytime i call the header the navigation will be called to, so that i would not be calling it all the time.   But now i have a problem, on my 404 PAGE , i don't want to include the navigation, but if i don't include the header the themes won't play. SO how can i do this?. Any ideas is greatly and highly appreciated.


Single post page breaks when post is more than 30,000 words

When my post contains approximately more than 30,000 words then the page only shows the post title and no text at all. The same happens with shared host and with WP running on my PC. Any ideas? Any text filter I might disable? Thanks.


Run a cron job (or similar) in the background of WP after post update/create

I would like to run a filter on post content after it has been created or updated. I would like this to occur after the user has submitted the post, as it may be a bit of a lengthy process (a find/replace to search for glossary terms and replace them with links). What's the most efficient and reliable way to achieve this? Thanks in advance,


Alternative to email notification system?

Instead of having an email on every comment on a blog post I've wrote, I'm looking for a visual notification on wordpress itself, an "inbox" if you get what I mean. Does that exist? Thanks, Dennis


How to find attachment ID for first image in a post

I am using a plugin to forward photo posts from wordpress to a tumblr blog. I have the following code:               //post blog to tumblr     function postBlogTumblr($postID)     {         $URLServer = "http://www.tumblr.com/api/write";         $t_post = get_post($postID);         $t_url = get_permalink($postID);         $tumblr_data = unserialize(get_option("tumblr"));         $postdata['email'] = $tumblr_data['tumblr_login_email'];         $postdata['password'] = $tumblr_data['tumblr_login_pass'];         $postdata['type'] = "photo";              **$postdata['source'] = the_attachment_link($attachment_id);**              $postdata['caption'] = $t_post->post_title." _(via adamblanchard.co.uk)_ ";            $postdata['state'] = "published";         $postdata = http_build_query($postdata);            $result = datapost($URLServer,$postdata);          }      I believe I am using the right method on the **$postdata['source']** line, but I am unsure how to go about getting the attachment id. Any guidance would be greatly appreciated.


Remove taxonomy base or term from url

I know there are a lot of posts about this here, but NONE of them have answered my problem. I am working with a custom built theme that has a custom category type (named messagetypes). I have a category created named media. This theme is setup so that I can add a menu item that when clicked, displays all of the items labeled media, but the URL of the page is then mysite.com/messagetypes/media. I want to remove messateypes from the url and have it only mysite.com/media. The closest I have gotten is when I add to the custom category functions page, where               register_taxonomy( 'messagetypes', ...      is called with               'rewrite' => array( 'slug' => ''),      When I do this, I get the desired result from this page, but all of my other page links break (using permalinks.) I have also tried adding to the rewrite array               'with_front' => false      but that didn't work either. Any help or insight would be great. I've wasted too many hours on this and it's driving me nuts. Thanks.


How to get the value of particular get $meta value in wordpress

I am using this wordpress Script to add metaboxes under posts.. I followed as it was written.. but I am having trouble on how to get those values in singe.php Example an uploaded image Please guide me on this..


All links in WP blog redirect to main non-WP site

I worked on a Drupal site for a client, but he wanted to keep his blog on WP, so I manually created a 'blog' folder on the root of the Drupal site and moved all the WP content there. I uploaded the database and change the wp-config.php settings accordingly. The main Drupal site (example.com) works fine, and when I click on the blog link I'm taken to the front page of the blog like it's supposed to, but inside the blog, (example.com/blog), any other link I click will show a 'page not found' message as if I was looking for non existing content on the main site. I'm not very familiar with WP. Is it because I installed manually? what configuration am I missing? EDIT: I tried               define('WP_HOME','http://example.com/blog/');     define('WP_SITEURL','http://example.com/blog/');      on wp-config.php, but that didn't work.


Update: I cant enqueue any core scripts. Masonry wont load with enqueue handle, Wordpress 3.6.

I'm trying to load masonry but I'm having no luck, I've managed to load it manually but then I realised it was included in the wordpress core, so I thought oh that's handy. I have it enqueue' (I really hate that word) like this:               function lart_front_end_scripts() {                 if (is_admin()) return;                 wp_enqueue_script('jquery', '1.10.2' );                 wp_enqueue_script('jquery-masonry', array('jquery'));             }//End add_scripts          add_action('wp_print_scripts', array(&$this,'lart_front_end_scripts'));      Other jquery is loaded like normal, but I keep getting "masonry has no method" in the console and it's clearly not being loaded because of its absence under network - scripts console. Help much appreciated. **Edit: I've updated my code to use enqueue_script instead of print_script.**               function masonry() {         wp_enqueue_script('jquery-masonry');     }//End add_scripts          add_action('wp_enqueue_scripts', array(&$this, 'masonry'));      Still no dice.


Clean URLs with custom link in WP menu

I've read some articles on here and numerous through Google and I'm still struggling with clean urls. Basically I have a menu where I inserted a custom link which is               /shop/phones/?phoneType=somephonetype      I've added some code to my functions file               function add_query_vars($aVars) {         $aVars[] = "phoneType";         return $aVars;     }     add_filter('query_vars', 'add_query_vars');          function add_rewrite_rules($aRules) {         $aNewRules = array('phoneType/([^/]+)/?$' => 'index.php/?phoneType&phoneType=$matches[1]');         $aRules = $aNewRules + $aRules;         return $aRules;     }     add_filter('rewrite_rules_array', 'add_rewrite_rules');      And in my page template for the phones I have               if(isset($wp_query->query_vars['phoneType'])) {         $phone_type = urldecode($wp_query->query_vars['phoneType']);         print $wp_query->query_vars['phoneType'];     }      So I added the print to be sure and when I load the page it prints out the variable but for some reason my url still shows the whole query string and I can't figure out why. Any help would be appreciated.


Wordpress do_shortcode first iteration

I've created a recursive shortcode that looks like this.               [tabs]     [tab state="active"]Home[/tab]     [tab]About[/tab]     [tab]Contact[/tab]     [/tabs]          [tabcontent]     [tabpane]Content 1[/tabpane]     [tabpane]Content 2[/tabpane]     [tabpane]Content 3[/tabpane]     [/tabcontent]      It is working, but I would like to remove the state="active" and automatically add that to the first tab, but I'm not sure how to tell which iteration my do_shortcode is on? **Update:** What would be even better is if I could keep a count while iterating through the do_shortcode so I could add attributes like id="tab1", id="tab2".


pull non-wp site into content area of wordpress -or- pull wp header into non wp site?

I am building a site which has a ecommerce nature that is not able to be tied directly into wordpress. What my goal is to have a constant header that is generated by my wordpress header on all pages including the ecommerce store. Now my question is what route is best: a) Pull wordpress header into e-commerce site   b) Pull e-commerce site into the "content" area of my wordpress site via a custom template, this is my perfered option as I could keep the footer and rest of the theme going on. So how would I accomplish this? I imagine making a custom page template pulling in the index.php of the e-commerce store is the way to go, does anyone have an example or tips on this as I have not made a custom template strucutre in WP. Thanks in advance.


How to display list of child pages with parent in wordpress?

I have following format of sub-pages in WordPress:               About Us        -Services        -Products        -Surgery       I want to list all sub-pages with parent page like above but the code that I am using from wpbeginner site is not working as my requirement. Can somebody tell me that how to show sub-pages with parent page. I tried following code in functions.php file:               function wpb_list_child_pages() {         global $post;         if ( is_page() && $post->post_parent ) {             $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' );         } else {             $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' );         }         if ( $childpages ) {             $string = '<ul>' . $childpages . '</ul>';         }              return $string;     }         add_shortcode( 'wpb_childpages', 'wpb_list_child_pages' );      And then use short code **[wpb_childpages]** in widget but it is showing only child page but I want child page with parent page


Which is better and faster ? Wordpress Queries or SQL Query

Suppose I am developing a minimal theme, the the post page `single.php` displays only the post title, the excerpt and the content. So in general that would be               <?php the_title(); ?>     <?php the_excerpt(); ?>     <?php the_content(); ?>      So I am expecting 3 queries... Instead if I write a custom query where I am just fetching these 3 datas in an array at once...               <?php arr[] = get_row(select title, excerpt, content from wp_posts where post_id = 1); ?>     <?php echo arr[0] ?>     <?php echo arr[1] ?>     <?php echo arr[2] ?>      Which is faster or does it make a difference ? Plz ignore syntax if wrong...


How to create a Menu based a username

How would I create a menu so lets say user1 sees user1's menu and not user2. or just see there own pages which I assigned to them in a menu. So not user role menu but a username menu. i know it could get to be alot but need this done. Thanks


Should multi-language site using multi-site architecture have default language in base site?

I am setting up a multi-language site using wordpress multi-site and wanted some feedback on the best approach/best practice. I will have the following languages: en, sa, de, ru. en is default. Should the domain.org by default be English, or should domain.org redirect to domain.org/en?


Use meta_query to get title of associated post

I have two post types that I've associated in one direction by assigning Post A as a custom meta field of Post B. I need to search based on the titles of Post A and return the associated Post B results. This feels a little tricky. Normally I can display titles from Post A like so:                       $post = get_post($post_id);             $author_post_id = get_post_meta($post->ID, 'custom_author', true);             $post_object = get_post( $author_post_id );             echo get_the_title($post_object);      And I believe I'm using `meta_query` correctly to search Post B:                       $args = array(                 'post_type' => 'journal_entry',                 'meta_query' => array(                     array(                         'key' => 'custom_author',                         'compare' => 'LIKE'                     )                 )              );             $query = new WP_Query( $args );             if ( $query->have_posts() ): while ( $query->have_posts() ) : $query->the_post();                 // Loop             endwhile; endif;             // Reset post data             wp_reset_postdata();      But I think I need to shoehorn `get_the_title` into my `meta_query` value. I think. I'm a little turned around. Am I on the correct path?


Setting different width and height for gravatar

I've been trying to set a different width and height using the `get_avatar` function. I need to set the author's avatar in `single.php` to 60x40 size. So let's say the gravatar looks like this: ![enter image description here](http://i.stack.imgur.com/J8jtu.jpg) when set to 60x40, it would look like this (resized and cropped): ![enter image description here](http://i.stack.imgur.com/UlhBW.jpg) However, the default `get_avatar` does not seem to allow different values for width and height, since               <?php echo get_avatar( $comment, '60' ); ?>      would simply result in 60x60-sized gravatar. I'm not sure if this is a nice way for doing this, but I tried adding this to `functions.php`, by facilitating the TimThumb image resizer (I renamed the `timthumb.php` to `display.php`):               add_filter('get_avatar','change_avatar_url');     function change_avatar_url($urel) {         $urel = str_replace("src='", "src='". bloginfo( 'template_directory' ) ."/script/display.php?src=", $urel);         $urel = str_replace("' class", "&w=60&h=40&zc=1' class", $urel);         return $urel;     }      but it (seem obviously) does not work. Is there any way to achieve this?


Access to option page by role/capability

So i've been googling around and i'm trying to figure out a plain simple solution to my problem. I've tried several things but they are simply not working. I just got into WordPress and i have to edit some permissions. I want to give the Editor rank access to ONE specific plugin. I've determined that this is the piece of code that returns a false or true statement ( Are you an admin? ). The editor should have sufficient rights to work in the settings tab of this plugin. This is the piece of code. I'm not asking for straight answers, i just need some advice.               if (is_admin() ){     add_action('admin_menu', 'rooster_admin_menu');     add_action('plugins_loaded', 'rst_add_registration');     add_action('plugins_loaded', 'rst_cancel_registration');     add_action('plugins_loaded', 'rst_delete_event');     function rooster_admin_menu(){         add_options_page('Rooster', 'Rooster', 'administrator', 'rooster', 'rooster_html_page');     }


My site looks different when activating new theme

I'm working on my site ontwik.com, just created a new design and uploaded it and when I activate, it works fine for the homepage and otherpages. but the problem is when i lo gout from wordpress admin or open ontwik in a different browser the homepage looks great but the other pages using the old theme. I tried to activate my oldest themes to see if the problem from the new theme but still there. You can visit the site now and check for difference. Thanks


Query to select specific users is not returning any users

I use wordpress and have the following query to select specific users, but the query is not showing any users when running it put together.               global $wpdb;          $date2day = date("d-m-Y");     $date2monthsfromnow = date("d-m-Y", strtotime(" + 2 months"));     $select_query = "SELECT DISTINCT users.* FROM " . $wpdb->users . " as users INNER JOIN " . $wpdb->usermeta . " as mt ON (users.ID = mt.user_id) WHERE 1=1 ";          $select_query .= " AND mt.meta_key = 'user_end_date_registration' AND mt.meta_value <= '". $date2monthsfromnow ."' ";          $select_query .= " AND (mt.meta_key = 'user_end_date_registration' AND mt.meta_value != '') ";          $select_query .= " AND (mt.meta_key = 'account_type' AND mt.meta_value = 'Sportvereniging')";          $expire_results = $wpdb->get_results($select_query);      If I remove the last $select_query I get results, when I delete the second and third $select_query and keep the last one, I also get results. But when putting them all together, I get no results, while I know I should get at least 2 results back. This code has been placed inside the functions.php of my theme. Please help.


How do I style the first two posts of a loop

I'm trying to style a single loop to look like so               ---------------------------------------------     ||            |             ||              ||     ||            |             ||--------------||     ||            |             ||              ||     ||            |             ||--------------||     ||            |             ||              ||     ||            |             ||--------------||      ||            |             ||              ||     ----------------------------------------------      So what I'm trying to achieve here is 5 posts being pulled from the loop. The first two are positioned on the left and are larger. The next 3 are on the right and are much smaller. I'm attempting to use two `get_template_part` in order to achieve this using Twitter Bootstrap. This is what I've attempted so far

                 <?php if ( have_posts() ) : ?>                 <?php if ( in_category( 'Featured' ) ) : ?>                     <?php /* Start the Featured Loop */ ?>                     <?php $count=0; ?>                     <?php while ( have_posts() ) : the_post(); ?>                              <?php $count++; ?>                              <?php if($count <= 1):?>                         <?php get_template_part( 'content', 'featured' ); ?>

                     <?php else: ?>                          <?php if($count >= 3)?>                             <?php get_template_part( 'content', 'featuredside' ); ?>                             <?php endif; ?>                     <?php endwhile; ?>                         <?php endif; ?>                     <?php endif; ?>

      And this works when I set the line `<?php if($count <= 1):?>` to 1 but when I change it to two to try and create the layout I'm after, the second post jumps over to the `<div class="col-lg-5">` and messes up the entire layout. Can anyone seew hat I'm doing wrong?


How to place a div inside a function that creates a div

I am wondering how instead of having the menuTab div come after the bones_main_nav function html code that is outputted to have it injected inside of it I suppose. I have the following function               // the main menu     function bones_main_nav() {         // display the wp3 menu if available         wp_nav_menu(array(             'container' => false,                           // remove nav container             'container_class' => 'menu clearfix',           // class of container (should you choose to use it)             'menu' => __( 'The Main Menu', 'bonestheme' ),  // nav name             'menu_class' => 'nav top-nav clearfix',         // adding custom nav class             'theme_location' => 'main-nav',                 // where it's located in the theme             'before' => '',                                 // before the menu             'after' => '',                                  // after the menu             'link_before' => '',                            // before each link             'link_after' => '',                             // after each link             'depth' => 0,                                   // limit the depth of the nav             'fallback_cb' => 'bones_main_nav_fallback'      // fallback function         ));     } /* end bones main nav */      and the following html/php                                            <?php bones_main_nav(); ?>
                                 d
                               **UPDATE** the bones_main_nav function generates the following html, i have commented where I want the menutab div to go.

home

****


How to sort list of custom posts to get view like a tree of posts under categories and their children's categories?

I'm new here and my english isn't perfect so I'm sorry for this :) I'm here because I'm workin on site with post list sorted by category and I have problem with sort out my posts in categories and children categories under them. Now everything is messed up. I would like to sort my custom posts like that: CATEGORY 1   * CHILD CATEGORY 1     * Post      * Post      * Post    * CHILD CATEGORY2     * Post      * Post      * Post  CATEGORY 2   * CHILD CATEGORY3      * Post      * Post      * Post  CATEGORY 3   * Post   * Post   * CHILD CATEGORY4     * Post      * Post      * Post  Is it possible with this code:               <?php     $querystr = "SELECT terms.* FROM $wpdb->term_taxonomy tax LEFT JOIN $wpdb->terms terms ON       tax.term_id = terms.term_id WHERE tax.taxonomy = 'MY_CUSTOM_TAXONOMY'";          $categories = $wpdb->get_results($querystr, OBJECT);          foreach( $categories as $category ):      echo '

'.$category->name.'
';       echo '
'.strip_tags(term_description($category->term_id,'MY_CUSTOM_TAXONOMY')).'

';            $posts = get_posts( array( 'MY_CUSTOM_TAXONOMY' => $category->name, 'post_type' => 'MY_CUSTOM_POST' ) );       foreach($posts as $post) :       setup_postdata($post);             the_title();             endforeach;          endforeach;     ?>      I will be grateful for all help, thank You!!


Integrate comment system in the sidebar?

I would like the comments of a post and the comment box to appear in the sidebar. How can I do that?


How to stop writing content twice on Wordpress using ajax?

I've been using javascript and ajax to do some post request inside a page and everything seems to work fine. Later on when content got more complicated I stop writing HTML code with javascript and I started using Mustache making everything easier to handle the generated content. So I basically used to get a jSON with the either a post or a post list and then I run a template with mustache to display the content and everything was working fine. The main issue is that I am actually writing the template part with php/html to display the content and then i'm using the same content structure (duplicate into a mustache template) to display new content loaded with ajax. My question is, after using ajax techniques with Wordpress to load content, how do I stop to stop coding the template two times. Maybe I am missing some good practices about handling content or I just need to start changing my workflow.


Styling first post using Advanced Custom Fields

I'm working with a company's About page. I created a custom post type for "Employees", and am using the Advanced Custom Fields plugin to create simple meta boxes for name, title, image, and bio. The first employee listed is the owner, and i'd like to style his bio differently from the rest, but my php skills aren't quite up to the task. Here is the code i'm working with so far, I just need to understand how to create a variable for the first post in the array and style it differently.               <?php         $args = array('post_type' => 'employee');         $employee= new WP_Query( $args );         if( $employee->have_posts() ) {         while( $employee->have_posts() ) {         $employee->the_post();         ?>              <div <?php post_class('portrait'); ?>>             <img src="<?php the_field('employee_photo'); ?>" alt="" />
<?php the_title() ?>
             <?php the_field('employee_title'); ?>
<?php the_field('employee_bio'); ?>

              <?php         }             }             else { ?>
                 <img src="<?php the_field('employee_photo'); ?>" alt="" />
<?php the_title() ?>
                 <?php the_field('employee_title'); ?>
<?php the_field('employee_bio'); ?>

         <?php } ?>


Using audio shortcode for .mp3 URLs with a query string

I'm trying to use the audio shortcode with an audio file with a query string on the end of the URL and it won't work. The reason is I'd like to use expiring signed URLs with Amazon S3. If I use a URL like > http://bucketname.s3.amazonaws.com/audiofile.mp3 as the src in a call to `wp_audio_shortcode()` it works just fine. But if I use a URL like > > http://bucketname.s3.amazonaws.com/audiofile.mp3?AWSAccessKeyId=XXXXXXXXXXXX&Expires=1234567890&Signature=XXXXXXXXXXXXXXXXXX then `wp_audio_shortcode()` just spits out an HTML link instead of the audio embed and player code. In my tests it appears the shortcode requires a file extension of .mp3 be at the end of the URL. Is there a way to make the short code work with a query string on the URL? Any other solutions to suggest?


How to stop $wpdb from prepending database name

When I run an UPDATE query using $wpdb, WP prepends the database name associated with the WP installation to whatever is passed in the table name argument. This isn't desirable as my app passes the full path to the table (ie. databasename.table). In the end, what happens is the table name ends up looking like databasename.databasename.table, causing my query to fail. Is there a way to stop this? I realize I can open a new $wpdb connection to run queries on a different database but I want to use the same connection. SELECT work fine this way, it's annoying that the behavior for UPDATE is different.               $wpdb->update(          "database.table",          array(              'm_title' => $post->post_title,         ),          array( 'id' => $game->id ),          array(              '%s',          )     );


Installing WordPress in a subdirectory

I am trying to install wordpress into a subdirectory of a website. I simply want to build the client's new site in this subdirectory, so a separate and new WP install in this subdirectory, and then when complete, delete the current (old) site and move the new wp website from the subdirectory to the root. I've uploaded the wordpress into the subdirectory, I've completed the wp- config file, created my database... and I have double-checked and triple checked that my database name, user and password are the same in my config file as in my database. Reading the codex it appears I need to change the path in the index.php file, which I've done:               require( dirname( __FILE__ ) . '/subdirectory_name/index.php'       when I go to the subdirectory to complete the WP install I get the following error message: > Fatal error: require() [function.require]: Failed opening required > '/home/user/public_html/subdirectory_name/index.php' > (include_path='.:/usr/lib/php:/usr/local/lib/php') in > /home/user/public_html/subdirectory_name/index.php on line 17 Any suggestions as to what I am doing wrong? Does it matter that the client's current site is a Joomla site? Help is very much appreciated!


Post and featured image have the same name, why is the attachment (image) is showing and not the post?

How do I get the actual POST to display - and not the thumbnail of the image? I have tried to redirect the attachment to the parent post, but that gets caught in a redirect loop. For an example - right now, until this is fixed, go here: http://www.festivalsinpa.com/city/ford-city/ - and you will see one festival listed. If you click the listing, it defaults to the thumbnail and not the post. --Thanks


Is there a limit to the length/size of serialized data that can be stored as user meta?

I tried to store an array containing about 50000 keys and respective values to the user meta using update_user_meta. Since, this was only a test, I ran a for loop to generate the array.               $test = array ();     for ($i = 0; $i <= 50000; $i++) {         $test[$i] = $i;     }     update_user_meta($user_id, 'test', $test);      I ended up getting the error `WordPress database error: [MySQL server has gone away]`. Eventually, I was able to get it working with an array size of 48000 keys. Since update_user_meta converts arrays to serialized data before storing, is there a limit to the serialized data that user meta or post metas can handle? Or does this happen due to some other issue? I tried the timeout fix suggested here. But I am not sure if it is supposed to work for WP 3.3.1. or whether if at all it is solution to my problem. Please note I am using a local dev install using MAMP.


FaceBook fan-block in a text-widget

I want to add a facebook-fanbox on a wordpress-page. I can go about this in the following matter: I take the test from the facebook-developer site. Initialize the JavaScript SDK using this app: books-page...

       Include the JavaScript SDK on your page once, ideally right after the opening `<body>` tag. Or do I need to include this?

      Which text has to be added into a text-block widget? Any suggestions


I can't add more pages to menu - menu delete pages

Two days ago I decided to add three more pages to the menu on my site. I already had like 140 pages in the menu, so this is something I know how to do. But I hadn't done it in some months, so maybe something has changed. Anyway, when I pressed "save menu", two thing happened.   * All pages after page number 89 (yes, I have counted) got deleted from the menu. In fact, on my site you can see that the right part of my menu is all empty.   * The menu was no longer the primary menu, so I had to go back in and save it as primary menu again. So now I have a menu with only 89 pages. If I add a page number 90, it disappears when I press save menu. And besides I will have to go in and save the menu as primary menu again. If I add a page called A as page number 90, and then switch place with another page called B (so the page B now is number 90), then it's the page B that disappears when I press save menu. So all pages after page 89 gets deleted from the menu when I press save menu. That's a bit frustrating. Why is this happening? What can I do?


Custom Gallery HTML only working when images are attached to post/page

I have changed my gallery html using the posts_gallery hook in the same way as shown here:How to customise the output of the WP image gallery shortcode from a plugin? I've copied the latest code from wordpress and changed the $output variable to modify my html. The problem is it only works for images that are attached to the page in question. I want to use images from other pages or that have already been uploaded in galleries. The galleries are generated with the short code using the media window and look like: [gallery ids="1,2,3,4,5"]. I've tried replacing ids with include but that doesn't work and I get some default code other than my custom html output. Here is my custom gallery output:               function my_gallery_shortcode( $output = '', $atts, $content = false, $tag = false ) {     $return = $output; // fallback          // retrieve content of your own gallery function     $my_result = get_my_gallery_content( $atts );          // boolean false = empty, see http://php.net/empty     if( !empty( $my_result ) ) {         $return = $my_result;     }          return $return;     }          add_filter( 'post_gallery', 'my_gallery_shortcode', 10, 4 );                    function get_my_gallery_content ( $atts ) {          global $post;     // We're trusting author input, so let's at least make sure it looks like a valid orderby statement     if ( isset( $attr['orderby'] ) ) {         $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );         if ( !$attr['orderby'] )             unset( $attr['orderby'] );     }          $html5 = current_theme_supports( 'html5', 'gallery' );     extract(shortcode_atts(array(         'order'      => 'ASC',         'orderby'    => 'menu_order ID',         'id'         => $post ? $post->ID : 0,         'itemtag'    => $html5 ? 'figure'     : 'dl',         'icontag'    => $html5 ? 'div'        : 'dt',         'captiontag' => $html5 ? 'figcaption' : 'dd',         'columns'    => 3,         'size'       => 'thumbnail',         'include'    => '',         'exclude'    => '',         'link'       => '',     ), $attr, 'gallery'));          $id = intval($id);     if ( 'RAND' == $order )         $orderby = 'none';          if ( !empty($include) ) {         $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );              $attachments = array();         foreach ( $_attachments as $key => $val ) {             $attachments[$val->ID] = $_attachments[$key];         }     } elseif ( !empty($exclude) ) {         $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );     } else {         $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );     }          if ( empty($attachments) )         return '';          if ( is_feed() ) {         $output = "\n";         foreach ( $attachments as $att_id => $attachment )             $output .= wp_get_attachment_link($att_id, $size, true) . "\n";         return $output;     }          $itemtag = tag_escape($itemtag);     $captiontag = tag_escape($captiontag);     $icontag = tag_escape($icontag);     $valid_tags = wp_kses_allowed_html( 'post' );     if ( ! isset( $valid_tags[ $itemtag ] ) )         $itemtag = 'dl';     if ( ! isset( $valid_tags[ $captiontag ] ) )         $captiontag = 'dd';     if ( ! isset( $valid_tags[ $icontag ] ) )         $icontag = 'dt';          $columns = intval($columns);     $itemwidth = $columns > 0 ? floor(100/$columns) : 100;     $float = is_rtl() ? 'right' : 'left';          $selector = "gallery-{$instance}";          $gallery_style = $gallery_div = '';          /**      * Filter whether to print default gallery styles.      *      * @since 3.1.0      *      * @param bool $print Whether to print default gallery styles.      *                    Defaults to false if the theme supports HTML5 galleries.      *                    Otherwise, defaults to true.      */     if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {         $gallery_style = "         \n\t\t";     }          $size_class = sanitize_html_class( $size );     $gallery_div = "
";          /**      * Filter the default gallery shortcode CSS styles.      *      * @since 2.5.0      *      * @param string $gallery_style Default gallery shortcode CSS styles.      * @param string $gallery_div   Opening HTML div container for the gallery shortcode output.      */     $output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );          $i = 0;     $first_image = reset($attachments);     $output .= '';     $output .= wp_get_attachment_image( $first_image->ID, array(470,365), true, false );     $output .= '';          $output .= '
';          foreach ( $attachments as $id => $attachment ) {         if ( ! empty( $link ) && 'file' === $link )             $image_output = wp_get_attachment_link( $id, $size, false, false );         elseif ( ! empty( $link ) && 'none' === $link )             $image_output = wp_get_attachment_image( $id, $size, false );         else             $image_output = wp_get_attachment_link( $id, $size, true, false );              $image_meta  = wp_get_attachment_metadata( $id );              $orientation = '';         if ( isset( $image_meta['height'], $image_meta['width'] ) )             $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';              $output .= $image_output;     }          if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) {         $output .= "
";     }          $output .= "
\n
\n";          return $output;     }


get Options value in "external" page

I've create a really small plugin. This plugin add one filter :               add_filter('the_content', 'BlueSteelAPI', 5);      BlueSteelAPI is calling my API. I've create an admin page for register the secret key password. That's Ok. But, in my plugin directory, i've this other page :               <?php     include('class.api.v1.php');          $blapi = new blapi($secretKey);     $call = $blapi->MakeRequest("addCommand", $_POST);     if ($blapi->IsThereAnError() == 0){         header("location:" . $call->urlpaiement . "?bl_methode=" . $call->methode . "&bl_refcmd=" . $call->refcmd);     }     else //Error...     {         print_r("Description : " . $call->description . " / Code : ". $blapi->getCode());     }          ?>      The goal of this page is to receive some Post Data and send it to my API for get a reference for a command. But, "$secretKey" is in the "Options" table of wordpress. How can I get this data? I can make a query like "select option_value from options where option_name = 'secretKey'" But, is there a better way to get this data? EDIT : I've find this solution but i think, it's not really nice. I've put it in the top my other page...               //include('class.api.v1.php');     require( '../../../wp-blog-header.php');          $option = $wpdb->get_results('SELECT * FROM '. $wpdb->prefix.'options where option_name in (\'bluesteel_secretkey\', \'bluesteel_sitekey\')');     $secretKey = $option[0]->option_value;     $apiKey = $option[1]->option_value;


How to get custom category's link?

I have created a custom post type and custom category for that post. There are some categories in that custom category. now I want to get the links for each category I have in that list. I just want to get the link form its tag id. how can I do that


using WPalchemy to output custom metabox from homepage template

I am new to php and I am using wpalchemy to create a custom metabox. I want to output the info from the metabox on a template page, not inside a loop. I have tried the following to no avail per the documentation on wpAlchemys site. Side note I want to create a custom metabox with the ability to upload multiple images is wpalchemy a good starting point to do this.               <?php         global $custom_metabox;         $custom_metabox->the_meta();         $custom_metabox->the_field('name');         $custom_metabox->the_value();     ?>


Custom Meta Box Upload Image Problem

Ran into a problem with an image upload part of a theme feature. The code uploaded at http://pastebin.com/Qnn2D36N (that's the entire script for adding the meta boxes) generates custom meta boxes on posts and pages, one of which has a media upload button. On some installs it works as expected, on others going through the process works until clicking the "Insert into Post" button on the pop up media uploader. Goes back to the post, but the URL to the image isn't added to the form. On a localhost install I have multiple WordPress installations for testing and some work, others don't. On live sites on the same server, some work and some don't. I don't know why, on a clean install with no plugins installed it didn't work. The code can be added to the TwentyEleven function.php file and it works with the same problems as I'm experiencing in the theme (Stallion) I develop, which suggests the problem is within the code. With Debug mode on the media upload pop up window after clicking Media Library shows the following notice:               Notice: Undefined index: post_id in C:\wamp\www\0000000000\wp-admin\includes\media.php on line 1755      I get this notice on live sites, both sites that work and don't so it might not be the issue. Viewing source of where the notice is located shows the post_id isn't part of the code, I see this:               <input type="hidden" value="0" name="post_id"/>      When viewing source of the media uploader when using the media uploader as part of the post (to add an image to a post normally) the post_id is located within value="". I'm trying to remove this PHP notice to rule it out as the cause, I've tried adding "global $post_id;" in various parts of the script but no joy. I'm stumped what to try next. David


Tell WP to use a specific template file in posts

I've searched everywhere and tried a couple plugins with no success. I'm using WP 3.9.1. I have to create different ways to show my posts. If they are "standard" they use the single-post.php. That's ok. If they have an image gallery, I want to change the whole structure. Same thing if they contain a video. I want to change the html structure. So, instead of creating different custom post types, a thing that creates other problems down the line to take care of, I just want to be able to say to wp "hey, use this template file". How can I be able to do that? I guess it's about making wp asking the editor "for this post, what template you want to use?" in admin.


Replace single_template filter with what for default posts?

I was going through a tutorial on Justin Tadlock's blog but it uses the single_template filter, which was removed in 3.4. The codex says to use {$type}_template but if I use "post_template" with the code on that page it doesn't work.


SEO - Two WordPress websites on same domain name

Would there be any negative SEO effects for having a wordpress website at example.com and having another website at example.com/anothersite?   1. Would the site "anothersite" be indexed in search engines (assuming I did all the seo strategies for them)?   2. Any negative effects for either site? Thanks in advance


How to fix the IE9/WordPress Twenty Ten Header Image Display Problem?

Just loaded IE9. Looks good. Impressive stats on what works on IE9. One thing that does not work. On any site that uses Twenty Ten, the default graphic is shifted to the right and is only partly visible. I saw no resolution, just a bunch of opinions at wordpres.org. Does anyone actually know if this an IE9 problem or a WordPress problem? And is there a solution. I've tried other themes and they seem to work fine.


List of Default Translated Phrases

With `<?php _e('Save Changes') ?>`, I know the phrase, "Save Changes" can be translated automatically if the user's locale is set to a different language. I'd like to know if there is a list of those already translated WordPress default messages. What else can I use?


what is template-name.php

A while back I found that there was a reason to name a template like so template-name.php For the life of me, I can't remember what it was for. I thought it was so that WordPress would automatically pick up that template so that you would not have to set the page template when creating the post. I have been looking in the codex for an hour and can't find it. Do you know what the logic is behind this?


How can I json_encode the output of my function?

How can I json_encode the output of this function I use to get all attached images of a post?               <?php     function get_all_images($postid=0, $size='bigger', $attributes='') {         if ($postid<1) $postid = get_the_ID();         if ($images = get_children(array(             'post_parent' => $postid,             'post_type' => 'attachment',             'numberposts' => -1,             'orderby' => 'menu_order',             'post_mime_type' => 'image',)))             foreach($images as $image) {                 $attachment=wp_get_attachment_image_src($image->ID, $size);                 ?><img src="<?php echo $attachment[0]; ?>" alt="" /><?php             }     }?>      Everything is already setup for admin-ajax.php.


remove term from custom taxonomy list

I have the terms of a custom taxonomy presented in a list like this:                       <?php $taxonomy = 'categories'; $tax_terms = get_terms($taxonomy); ?>
             <?php foreach ($tax_terms as $tax_term) {             echo '
' . 'name ) . '" ' . '>' . $tax_term->name.'
';             }?>
      There are a number of terms to this taxonomy (print, digital, type, etc...) however, one of them, called "archive", id like to not display in this list. Is there any way to exclude it from the above code?


What filter or action hook to use in order to load some code before the template begins printing in BuddyPress?

I would like to load some code before the template begins printing in BuddyPress. What filter or action hook should I use? I tried a number of them (such as `bp_head`, `bp_include`, `bp_init`), but none of them seem to work. My code is simply never loaded. The list of filters and action hooks is hundreds of entries long, which is a bit overwhelming to me, since I am fairly new to BuddyPress. So any help would be greatly appreciated. I am trying to tell BuddyPress to use a different template if certain conditions are met. So I have some code in bp-custom.php and I would need the appropriate filter or action hook to get it working. Preferably one that accepts a `$template` variable as an argument. EDIT: I've tried with different action priority numbers (or without) and nothing seems to work. Still need help with this!


Sort CPT by first letter of a meta field in a specific range

'I'm working on a way to display member profiles (Custom post type) sorted by the first letter of their last name in a given range. For example all members with a last name starting with 'A' up to 'I', 'J' up to 'S' and 'T up to 'Z'. Displaying all members alphabetically by their last name, which is a meta value, was easy to do. But how can I split that query in three ranges based on the first letter of their last name? In the Codex I can only find examples to do this when the meta value is a number, date, time or field value. My current query is this:               $args = array(                  'posts_per_page'=> -1,                  'post_type'     => 'members',                 'meta_key'      => 'lastname',                 'orderby'       => 'meta_value',                 'order'         => 'ASC',             );      Based on the examples on the Codex i've tried this query               $args = array(                  'posts_per_page'=> -1,                  'post_type'     => 'members',                 'meta_key'      => 'lastname',                 'orderby'       => 'meta_value',                 'value'         => array( 'a', 'i' ),                 'type'          => 'CHAR',                 'compare'       => 'BETWEEN',                 'order'         => 'ASC',             );      But that doesn't do anything different and still show all members profiles. I've found quite a few tutorials and even plugins to create an A-Z index but that's not what I'm looking for as there aren't enough members to display them in such way.


Custom Event for Wordpress Cron Job Not executing

Method to Execute at Certain Interval               function informant_main_action(){         die('working');     }      Custom Schedule for Cron Job               function my_cron_definer($schedules){           $schedules['weekly'] = array('interval'=> 120, //604800             'display'=>  __('Once Every week')               );           return $schedules;     }     add_filter('cron_schedules','my_cron_definer');      Register schedule on plugin activation               register_activation_hook( __FILE__, 'informant_run_on_activation' );          function informant_run_on_activation(){         if(!wp_next_scheduled('informantweeklynewsletter')){             wp_schedule_event(time(), 'weekly', 'informantweeklynewsletter');         }     }      Calling my method to be executed on custom event               add_action('informantweeklynewsletter','informant_main_action');      I have installed a plugin Cron Gui for viewing scheduled cronjob and it is listing my event correctly as i put the recurrence for every two minutes the cron gui shows the correct result i.e its updating the time +2 minutes. But my method `informant_main_action()` is not working. Whats the mistake i am making. ? Thanks


WP white screen of death after duping a site that works fine on same server

I have simply duped a site that runs absolutely fine on a separate domain into a sub directory of another domain for development purposes. I have zipped the /httpdocs/ directory excluding cache and uploads directories (they are >4gb large) and mysqldump'ed the database. There were **no errors** during the import of files or database. Worth noting, the destination domain runs a separate WP installation in a different sub directory that should not have an effect on my installation. The domain contains a non-CMS site in the root with a .htaccess file, but there's nothing striking about it - just rewrite rules and caching configuration (I have tried removing it). What happens is that I am presented with a blank page with no page-source. ## I have tried:   * Messing up DB connection intentionally to see if I can get some sort of error.   * Turning on WP Debug and PHP error reporting (nothing).   * Increasing memory limit to 512mb.   * Disabling all plugins.   * Changing permissions of entire installation to 755. It seems to me that WP is just not being run by Apache? Can anyone suggest something to try and find the root of the problem at least? _Many thanks!_


implement separate templates for 1 post type

* I have a custom post type 'courses', with a course description as post_content, and number of attachments   * I also have a custom post type 'course units', linked to the courses with a custom field 'course-id'   * I created a template file for the course dashboard, showing a list of the units, and a couple of links - to the course description, and to an archive of the attachments. My (pretty generic) question:   * I'm stuck at how to create/implement the seperate 'pages' for the description, and the attachment archive - can't get my head around it. Some additional info:   * I'm not using 'pretty permalinks' (because of some plugin conflicts), so the URL of the course dashboard is just http://www.example.com/?course=slug-of-the-course   * Ideally the description should be available on something like http://www.example.com/?course=slug-of-the-course&showdesc=1, and the attachments on http://www.example.com/?course=slug-of-the-course&showatt=1 - both URLs should forward to a specific template file in my theme folder. Any ideas / suggestions?


Separating Custom Template logic

Our site displays athletic race results, and each runner has a specific wordpress user account. We have custom plugin to handle building the html elements. A specific runners page can be seen via this link               [http://bhaa.ie/runner/?id=7713][1]      I've implemented this page by using the wordpress custom template hook and the logic for rendering the page can be seen at this github link. There is a mix of presentation and business logic in the template. The custom template basically uses $_GET('id') to grab the runners id from the URL.               [https://github.com/emeraldjava/bhaawp/blob/master/public/views/runner.php][2]      I want to refactor the page, so that the business logic and layout are separated. I'd prefer that a UI design could work with a standard wordpress page, and use custom shortcodes to display the name, results and other elements that are specific to the user. In my head, the UI design should be able to reference a simple shortcode such as               [bhaa_runner_results]       under the hood the logic for the shortcode can then grab the parameter value from the URL. If the UI designer want to include a specific runners results on the homepage they would just override the id attribute with a specific value               [bhaa_runner_results id="7713"]      the code would then use the 'shortcode_atts()' to extra the parameter value. At the moment the 'id' value is passed as a GET parameter to the custom template but how i can access this 'id' value when the UI design is working on a standard page, such that it can be passed as a parameter to the shortcode. I've read that 'query_args' can be registered by a plugin but this seems overkill since i've not changing the main WP_Query. Is there a recommended standard pattern for wordpress plugins to register their own parameter names with the core wordpress API?


JS of plugin conflicting with my default JS of my custom wordpress theme

I have converted a site to WordPress coded in bootstrap Css. The problem is when I installed a plugin named Easy Bootstrap shortcode for my editor ,my responsive menu doesn't seems to work.I have checked and found its the problem of JS conflict. Is there any way out so that plugins required .js doesn't conflict with my default .js of my theme ? Please suggest in great trouble


Change the default video URL in a post to shortcode format

I want to add video from youtube/vimeo to my post.Whenever i add a video to my post ,there will display a link like https://www.youtube.com/watch?v=dsUXAEzaC3Q in my admin(Add new post ),and in the front end it will display the video.But the problem is, i want to show the video like a shortcode example [video url=”https://www.youtube.com/watch?v=dsUXAEzaC3Q”][/video]in the place of original video.That is show the shortcode like above instead of the video in front end.How can it possible.Please help me.


Assign Menus to Theme Locations with theme activation

A site is using "child1" named child theme. When this site switches to other child theme named "child2", their widgets are moving too but theme locations are not moving. How can i auto assign menus to theme locations on theme activation? I found this solution from http://wordpress.org/support/topic/how-to-assign-a- wordpress-3-menu-to-primary-location-programmatically               $theme = get_current_theme();     $mods = get_option("mods_$theme");     $key = key($mods['nav_menu_locations']);     $mods['nav_menu_locations'][$key] = $menu_id;     update_option("mods_$theme", $mods);      Is there any better wordpress way to fix this? (Related trac topic: http://core.trac.wordpress.org/ticket/18720 )


get_terms that have custom sticky field checked

I was able to add a extra custom field, named `sticky`, to a custom taxonomy, using the wp taxonomy meta plugin, like this:               function YOUR_PREFIX_register_taxonomy_meta_boxes()     {         // Make sure there's no errors when the plugin is deactivated or during upgrade         if ( !class_exists( 'RW_Taxonomy_Meta' ) )             return;              $meta_sections = array();              // First meta section         $meta_sections[] = array(             'title'      => 'Sticky',             // section title             'taxonomies' => array('tvr_amenity'), // list of taxonomies. Default is array('category', 'post_tag'). Optional             'id'         => 'sticky',                 // ID of each section, will be the option name                  'fields' => array(                             // List of meta fields                 array(                     'name' => 'Show in home filters',                     'id'   => 'sticky',                     'type' => 'checkbox',                 ),             ),         );         foreach ( $meta_sections as $meta_section )         {             new RW_Taxonomy_Meta( $meta_section );         }     }      ![enter image description here](http://i.stack.imgur.com/aEn7N.png) Now I'm trying to get all the taxonomies that has this value checked, like this:               $types = $types = get_terms( 'tvr_amenity', array(         'parent'    => '0',         'hide_empty' => 1,         'sticky' => 1      ) );      But the filter is ignored (all the parent taxonomies are shown), it returns the exact same than:               $types = $types = get_terms( 'tvr_amenity', array(             'parent'    => '0',             'hide_empty' => 1          ) );      Any idea what I'm missing, here?


How to use page metadata while using wp_list_pages()?

I'm creating my pages links in wordpress, using `wp_list_pages()`. each link contains an `<i>` tag which displays retina icons. I want to set a different class for each link in order to display a different retina icon. my code so far is this:               <?php wp_list_pages('link_before=&link_after=
'); ?>       How can I do that using pages meta data?or other ways?


How to add custom CSS (theme option) to TinyMCE?

I'm trying to add custom CSS (set via theme options) to the TinyMCE visual editor in WordPress. On the front end, the theme generates this CSS and outputs it on the `wp_head` hook. The problem I'm running into is being able to add that CSS output to the editor. This can't be done with `add_editor_style( 'editor-style.css' )` because we need to use PHP to access the theme option. As an example of how it works on the front end:               add_action( 'wp_head', 'my_custom_colors' );          function my_custom_colors() {         $color_1 = get_theme_mod( 'color_1', 'cc4a00' );              echo "<style type='text/css'>a { color: #{$color_1}; }";     }      I need a method for getting that custom style into the visual editor. Any help would be greatly appreciated.


How to "orderby" the first array in a meta_query that uses multiply keys?

My query is currently sorting by end date. How can I make it so it will sort by the start date?               $args = array ('post_type'      => 'events',                'meta_query'     => array(                     array(                        'key'        => 'start_date',                        'value'      => $min_date,                        'compare'    => '>'                     ),                     array(                        'key'        => 'start_date',                        'value'      => $max_date,                        'compare'    => '<'                     ),                     array(                        'key'        => 'end_date',                        'value'      => $current_date,                        'compare'    => '>'                     )                 ),                'orderby'        => 'meta_value',                'order'          => 'ASC'               );


wp_get_archives custom function broken since upgrading to WP 3.7.1

I've upgraded a site I'm working on to the latest WP, but it appears the function I wrote for splitting wp_get_archives() into years is now broken and I can't find out why. I've turned on debugging, but not getting any errors. Can anyone see what's wrong please?               Class OSUYMArchives     {         public static function init()         {             /*-----------------------------------------------------------------------------------------------*/             /* GET MONTHLY ARCHIVE DIVIDED TO YEARS */             /*-----------------------------------------------------------------------------------------------*/             /*              * splits:              *
$Year
              *
              *
$MonthName $Number posts
              *
              */                  function get_by_year($sql, $args) {                 global $wpdb;                 return $sql .= $wpdb->prepare(" AND YEAR(`post_date`) = '%s'", $args['year']); // modify the sql query based on year             }                  function osu_ym_archive() {                 $archiveString = wp_get_archives('type=yearly&echo=0');                      // Find our strings to match                 preg_match_all("#title='(\d{4})'#", $archiveString, $matches);                      foreach ($matches[1] as $year):                     echo "
" . $year . "
";                     add_filter('getarchives_where', "get_by_year" , 666, 2);                          // Set args for new wp_get_archives();                     $args = array(                         'type'              => 'monthly',                         'echo'              => 0,                         'before'            => '• ',                         'show_post_count'   => 1,                         'year'              => $year                     );                     $monthlyArchives = preg_replace('#(.+)(\s\d{4})(</.+>)#', "$1 $3", wp_get_archives($args));                           // Add span with class to post count numbers                     $monthlyArchives = str_replace( '(', '(', $monthlyArchives );                     $monthlyArchives = str_replace( ')', ')', $monthlyArchives );                          // Spit out monthly archives                     echo "
" . $monthlyArchives . "
";                     remove_filter('getarchives_where', 666);                 endforeach;             }         }          } // End OSUYMArchives Class          // Load Class     OSUYMArchives::init();


WordPress Not rendering short code properly?

So I have other short codes that are built in this fashion and I cant figure out what i did between them and this one, This short code is used as such: `[code code="function(){}"]` to wrap your input in `<code></code>` tags, great for something super simple. the issue is:               function aisis_inline_code($atts, $content = null){         extract (             shortcode_atts (                 array (                     'code' => 'test?'                 ),                 $atts             )         );           return '<code>'.$code.'</code>';     }          add_shortcode( 'code', 'aisis_inline_code');      The above renders out `test` wrapped in code tags instead of the content I put in which is: `[code code="function(){}"]` How do we debug these? This was working pre WordPress 3.7.1, not it seems all it wants to do is out put `test?`. I checked the spelling of the short code spelling a hundred times. ...


Including category-base in a post permalink results in 404

I have static front-page and separate page `/news/` as the Posts page. I would like to have the single-post URLs like this:               www.example.com/news/categoryname/subcategory/postname/      and for the category archives:               www.example.com/news/categoryname/      What I've tried already:   * If I add `news` as my category base and `/news/%category%/%postname%/` as the custom permalink structure, I get the desired URLs but also **404** error for single posts (both with `news/` in URL and without it). All other pages (e.g. category archives, pages etc.) are accessible.   * If I leave category-base empty and permalinks as `/news/%category%/%postname%/`, there are **no 404** errors, but category URLs additionally contain the default `category` slug, like so: `www.example.com/news/category/categoryname/`   * If I use plugins to remove the default category base or just set category base to `.` it's removed together with the `news` part   * If I set permalinks as `/%category%/%postname%/` and add only the category base `news`, there are also **no 404** errors, but links to posts don't start with `news`: `www.example.com/categoryname/subcategory/postname/` There are some similar unanswered questions: Posts not showing with custom categorybase and subcategories and wordpress permalinks tweeks


WordPress Post Format If Statement?

Right now my excerpts are doubling when I use post formats. I would like to have a default excerpt when no post format is selected. Checkout an example: http://themeforward.com/demo2/ For my excerpts, to call post formats I am using this code:               <?php     if ( has_post_format( 'aside' )) {         ?>                  <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                  Posted <?php the_time("F j, Y"); ?> by <?php the_author_posts_link(); ?> in <?php the_category(', ') ?>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php the_excerpt();     }     if ( has_post_format( 'chat' )) {         ?>                  <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                  <?php the_time("F j, Y"); ?>  /  <?php the_author_posts_link(); ?>  /  <?php the_category(', ') ?>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php the_excerpt();     }     if ( has_post_format( 'gallery' )) {         ?>                  <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                           <?php the_author_posts_link(); ?>  /  <?php the_category(', ') ?>  /  <?php the_time("F j, Y"); ?>                  <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php the_content(); ?>         <?php comments_number( 'no responses', 'one response', '% responses' );     }     if ( has_post_format( 'image' )) {         ?>                  <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                  <?php the_time("F j, Y"); ?>  /  <?php the_author_posts_link(); ?>  /  <?php the_category(', ') ?>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php the_excerpt();     }     if ( has_post_format( 'link' )) {         ?>
<a href="<?php  echo $first_link = catch_that_link(); ?>"><?php the_title(); ?>
         <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                  <?php the_time("F j, Y"); ?>  /  <?php the_author_posts_link(); ?>  /  <?php the_category(', ') ?>         <?php comments_number( 'no responses', 'one response', '% responses' );     }     if ( has_post_format( 'quote' )) {         ?>                  <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                  <?php the_time("F j, Y"); ?>  /  <?php the_author_posts_link(); ?>  /  <?php the_category(', ') ?>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php the_content();     }     if ( has_post_format( 'status' )) {         ?>                  <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                  <?php the_time("F j, Y"); ?>  /  <?php the_author_posts_link(); ?>  /  <?php the_category(', ') ?>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php the_excerpt();     }     if ( has_post_format( 'video' )) {         ?>                  <?php the_time("F j, Y"); ?>  /  <?php the_author_posts_link(); ?>  /  <?php the_category(', ') ?>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php the_content();     }     if ( has_post_format( 'audio' )) {         ?>                  <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'thmb-index' ); } ?>                  <?php the_time("F j, Y"); ?>  /  <?php the_author_posts_link(); ?>  /  <?php the_category(', ') ?>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php the_content();     }     ?>      ...when a post format isn't selected I would like to grab this instead:

              <?php if ( has_post_thumbnail() ) { ?>                 <a href="<?php the_permalink() ?>">         <?php the_post_thumbnail( 'thmb-index' ); ?>                       <?php } ?>         <div class="excerpt_content<?php if ( has_post_thumbnail() ) echo ' with-thumbnail'; ?>">         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>     By <?php the_author_posts_link( ); ?> | <?php the_time('F j, Y'); ?> | <a href="<?php the_permalink(); ?>/#commentlist"><?php comments_number( 'No comments', 'One comment', '% comments' ); ?>              <?php the_excerpt(); ?>


Skip 5 latest post while paging?

In the `index.php` page, I need to skip 5 posts (the last 5 posts in the blog). I use the WP-Paginate plugin, but all pages show the same. I'm using `offset=5`, this is my code:               <?php  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;?>     <?php   $additional_loop = new WP_Query("offset=5&paged=".$paged);               if ($additional_loop->have_posts()) :                  while ($additional_loop->have_posts()) : $additional_loop->the_post();             the_title();?><br/>             <?php the_content();?>             <?php endwhile;endif;?>             <?php if(function_exists('wp_paginate')) {         wp_paginate('range=4&anchor=2&nextpage=Next&previouspage=Previous');     } ?>


custom headers for static home page and posts page

have a site w/a static home page and a posts page and then a number of other static pages - i set up a custom header for the home page and then another all other pages like this in the header               <?php     if(is_home()){     include(TEMPLATEPATH.'/header_front.php');}          else {     include(TEMPLATEPATH.'/header_default.php');}          ?>      it works perfectly except that the posts page is displaying header_front.php instead of header_default.php so i guess im asking how i get wordpress to realize that the posts page isnt the home page


Creating a plugin with dependencies

I am trying to extend the functionality of another plugin. I need to get data from it into an array to use in a different manner than the original plugin. (In this case, WPMUDev Categories and Listings plugins). Is there something in the Codex? How can I create a plugin that can use another plugins functions? Can I extend them and construct the parent nodes functions? I am not sure if these plugins are using classes or just straight functions. I am just trying to get data from the plugin into a sidebar widget (in a form option element), but eventually I will be using this for the content area as well by using custom shortcodes. For now I just need a place to get started.


How do I show a different homepage to logged in and non-logged in users?

Basically, I want to show non-logged in users a page that says 'register or log in.' But I want to show logged in users a standard homepage will all my posts.


Indenting Category list

I am using the get_categories() function combined with a foreach loop, to create a list of all the catgorys in a form. like so:               $args = array(                     'type'                     => 'post',                     'hide_empty'               => 0, //<--IMPORTANT!!                     'hierarchical'             => 1,                     'taxonomy'                 => 'category',                     'pad_counts'               => false );                     $categories = get_categories($args);                     foreach($categories as $category) {                              echo '
';                             echo "$category->name	";                             echo "<input type='text' name='$category->cat_ID'/>	";                             echo '
';                         }      However, what I need is for all the sub categories to be indented, but I cannot work out how. After looking at the documentation Here it seems that $category->parent parameter, may be helpful, but I cannot get it working. Any help would be appreciated.


Wordpress query by category, sorted by custom field

I have three custom fields set for each of the posts in the events category — year, month, and day. I am already querying for the events category, and now I'd like to sort the posts by the custom fields. I assume that I just need to insert something into the query_posts section of the code, but I'm not sure what. Any suggestions?               <?php query_posts('category_name=events&showposts=6'); ?>     <?php while (have_posts()) : the_post(); ?>

                 <?php echo get_post_meta($post->ID, 'month', true); ?>/<?php echo get_post_meta($post->ID, 'day', true); ?>                 <?php echo get_post_meta($post->ID, 'year', true); ?>

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

     <?php endwhile; ?>      I can explain more: the date the post was created is unimportant, but I want to sort first by the "year" custom field, then by the "month" custom field, and then by the "day" custom field


WPML Get url without outputting

I am in the process of migrating from qTranslate to WPML to handle my languages. With qTranslate, I had a very simple way to get an url to a page or post knowing it's slug: `$url = get_language_url(home_url($slug));` Now with WPML I can't find a way to do that... There's the `icl_link_to_element` function but it directly outputs the link in a a tag.. Besides, you need to know the post ID. Any way I can get a link to a post in the correct language, knowing it's slug?


javascript errors on mobile browser, not on desktop

I'm building an application based on the wordpress backend. The app is working correctly on desktop, but on my ipad I noticed the javascript broke. I made some investigations and I discovered that the problem was both on chrome and safari in either ipad or iphone. I used the service http://transmog.net/iphone-simulator/ to simulate a galaxy S3 and problem persisted. Transmorg allows me to see the javascript console and i found a couple of errors, one in the dashboardo and one in a custom post manage page. In the dashboard I found:               Uncaught TypeError: Object #<Text> has no method 'getElementsByTagName' jslib:412      And in the other page:               Uncaught TypeError: Cannot read property 'className' of undefined load-scripts.php=3fc=3d1=26load=255B=255D=3dhoverIntent,common,admin-bar,he…p-ajax-response,jquery-color,wp-lists,postbox,post,thickbox=26ver=3d3.6:36     postboxes._pb_edit load-scripts.php=3fc=3d1=26load=255B=255D=3dhoverIntent,common,admin-bar,he…p-ajax-response,jquery-color,wp-lists,postbox,post,thickbox=26ver=3d3.6:36     postboxes._pb_change load-scripts.php=3fc=3d1=26load=255B=255D=3dhoverIntent,common,admin-bar,he…p-ajax-response,jquery-color,wp-lists,postbox,post,thickbox=26ver=3d3.6:36     postboxes.init load-scripts.php=3fc=3d1=26load=255B=255D=3dhoverIntent,common,admin-bar,he…p-ajax-response,jquery-color,wp-lists,postbox,post,thickbox=26ver=3d3.6:36     postboxes.add_postbox_toggles load-scripts.php=3fc=3d1=26load=255B=255D=3dhoverIntent,common,admin-bar,he…p-ajax-response,jquery-color,wp-lists,postbox,post,thickbox=26ver=3d3.6:36     (anonymous function) load-scripts.php=3fc=3d1=26load=255B=255D=3dhoverIntent,common,admin-bar,he…p-ajax-response,jquery-color,wp-lists,postbox,post,thickbox=26ver=3d3.6:37     c load-scripts.php=3fc=3d1=26load=255B=255D=3djquery-core,jquery-migrate,utils=26ver=3d3.6:4     p.fireWith load-scripts.php=3fc=3d1=26load=255B=255D=3djquery-core,jquery-migrate,utils=26ver=3d3.6:4     x.extend.ready load-scripts.php=3fc=3d1=26load=255B=255D=3djquery-core,jquery-migrate,utils=26ver=3d3.6:4     q load-scripts.php=3fc=3d1=26load=255B=255D=3djquery-core,jquery-migrate,utils=26ver=3d3.6:4      (sorry for the poor formatting) Should I suppose is a wordpress error or its somehow my fault, even if I don't believe so, since I havent touched the files written above. Thanks!


extended MIT license

I'm currently developing some plugins. Due to the fact that they should also be available via the wp.org plugin repo, i need to license them properly. My decision so far is to use a modified _MIT/Expat_ license, which is compatible to the _GNU GPL_ license. I modified/extended the license in two places (bold quote parts). I now would like to know if   * This could conflict with the GNU GPL license.   * The grammar, vocabulary and else is correct. > (c) Copyright 2011 - by ... me > > **Area of jurisdication: Austria.** > > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the “Software”), to > deal in the Software without restriction, including without limitation the > rights to use, copy, modify, merge, publish, distribute, sublicense, and/or > sell copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice, **and every other copyright notice found in this > software, and all the attributions in every file,** and this permission > notice shall be included in all copies or substantial portions of the > Software. > > THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS > IN THE SOFTWARE. I'm aware that none of you is a lawyer, so it's more about your opinion. If you got additions (of any kind), feel free to tell me. Thank you! * * * **EDIT:** So far I got to the point that I   * can't write anything about "legal content" and    * the area of jurisdication says nothing about any right restrictions and therefore is ok & non conflicting with the GPL.    * About "and every other copyright notice" does not conflict, because it's no restriction. It's (in my case) mostly about css & graphics.


Change URL to filter posts

I am trying to understand how I can filter posts on a page simply by changing the URL. I tried adding this just as a test - http://mydomain.com/find- work/?orderby=title&order=ASC which does not change anything (I tried DESC as well). I basically want to have some buttons with different URL’s that will change the order of the posts displayed.


admin-ajax.php not loading anymore

I'm working on wordpress 3.6. Everything was fine but previous to launching the site the administrator changed the domain name. Everything remained in the same server. We didn't have to move any files, and all the files and folder stayed on the same relative positions they were before. To take care of the change in domain name I updated the databases with the Search & Replace DB script and everything is working well on the front end -as far as I can tell. However, there are a few problems in the back end. The one that is the most irksome is that admin-ajax.php is not loading anymore preventing us from adding/deteling/editing images and all the other tasks that require this script. This is what FIREBUG gives me when editing a post and clicking on Add Media:               GET http://wordpress/wp-admin/admin-ajax.php     Status: Aborted     Domain: wordpress     Size: 0B      Another FIREBUG error:               POST http://wordpress/wp-admin/admin-ajax.php     Status: Aborted     Domain: wordpress     Size: 0B      There seems to be an error in what wordpress thinks the location of admin- ajax.php is, it should be something like this (right?):               http://www.mydomain.com/wordpress/wp-admin/admin-ajax.php      It is ignoring, missing, the domain name in admin-ajax.php url. The question is how to fix this? and, although this is not as important as fixing the issue, how did this happen? [EDIT] I don't know if this is related, but I found another issue in the permalinks page of the dashboard: > Warning: is_writable(): open_basedir restriction in effect. File(/) is not > within the allowed path(s): (/chroot:/home:/tmp:/dev/shm:/usr/share/pear) in > /chroot/home/aerostud/mydomain.com/html/wordpress/wp-admin/options- > permalink.php on line 130 ... for what I found online I can correct this adding the proper path to `open_basedir` in php.ini.


Is it a good practice to include custom options when registering a post type?

More of an open discussion than a question, really, because I know adding custom arguments to the post type object does work, but I'm wondering if it is technically wrong in any way. Basically, when registering a post type:               $labels = array(         'name' => _x('Drews', 'post type general name'),         'singular_name' => _x('Drew', 'post type singular name'),         'add_new' => __('Add New'),         'add_new_item' => __('Add New Item'),         'edit_item' => __('Edit Item'),         'new_item' => __('New Item'),         'view_item' => __('View Item'),         'search_items' => __('Search Items'),         'not_found' =>  __('No Items found'),         'not_found_in_trash' => __('No Items found in Trash'),          'menu_name' => 'Archives'     );     $rewrite = array(         'slug' => 'drews'     );     $args = array(         'labels' => $labels,         'public' => true,         'show_in_menu' => true,          'query_var' => 'drews',         'rewrite' => $rewrite,         'has_archive' => true,          'hierarchical' => false,         'supports' => array('title','editor','author','comments'),         '_drew_made_this' => true     );      register_post_type('drews',$args);      Make note of the very last line in my $args array, '_drew_made_this' set to 'true'. This allows me to condition against this in several useful ways, sort of how you would filter against '_builtin' when using get_post_types(). Like I said, I know this works because I'm using it, but is there any potential for this to break WordPress in any weird way.


Pagination With Custom WP Query not functioning

I have the following custom query and im attempting to paginate the links of previous archive posts using the example from the wordpress codex http://codex.wordpress.org/Function_Reference/paginate_links#Basic_Example Am i inserting this in the wrong place? I inserted before the end of the query with the basic arguments, and there is just a place space at the moment. Any advice / tutorial is appreciated. Update 2: Ive now tried the change in the wp_query in the pagination piece, and still no luck.

Latest News

           <?php // custom loop query     $carouselPosts = new WP_Query('showposts=5');          // Pagination fix     $original_query = $wp_query;     $wp_query = NULL;     $wp_query = $carouselPosts;          // open loop     if ( $carouselPosts ->have_posts() ) : while ( $carouselPosts->have_posts() ) :  $carouselPosts->the_post(); ?>

Posted by <?php the_author(); ?>
<?php the_category(','); ?>
<a href="<?php the_permalink(); ?>"><?php the_date (); ?>

<a href="<?php the_permalink(); ?>">             <?php the_post_thumbnail(array(160,160)); ?>

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

         <a class="readmorelink" href="<?php the_permalink(); ?>"> Read More

     <?php endwhile; ?>     <?php endif; ?>               <?php paginate_links(  array(         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),         'format' => '?paged=%#%',         'current' => max( 1, get_query_var('paged') ),         'total' => $carouselPosts->max_num_pages         ) ); ?>          <?php wp_reset_query(); ?>