Updating custom post meta with ajax

This AJAX function gets called on a click:               $.ajax({                 url: 'site/ajax.php',                 data: {id: $('section#single article input:last-of-type').attr('value'), cote: 'like'}             }).done(function(html) {}      It passes the ID of the post (which is contained in a hidden input) for function get_post_meta() that is located in ajax.php. This is what AJAX.php looks like:               $cote = get_post_meta($_GET['id'], 'cote', true);     if($_GET['cote'] == 'like') {         $newCote = $cote++;         update_post_meta($_GET['id'], 'cote', $newCote);     } else {         $newCote = $cote--;         update_post_meta($_GET['id'], 'cote', $newCote);     }      It is suppose to update the custom post's "cote" field, but the problem is that function get_post_meta() is undefined in ajax.php. This is the error message:               Fatal error: Call to undefined function get_post_meta() in /home2/electro/public_html/beta... on line 2


Can I safely remove banned names from WordPress?

The banned names list for permalinks appears to be an editable list. Can I remove any of these names? ![http://www.theguardian.com/technology/2013/oct/07/fbi-bitcoin-pranked-silk- road?INTCMP=ILCNETTXT3487](http://i.stack.imgur.com/MnY3q.png) My particular question pertains to "blog." I would like to use is as a name for a network / multisite that I am installing.


How to provide social login at bottom of posts

I have a blog at http://sahitesting.com and I want users to log in before they comment. Now everyone hates to create new account on every other website, so I wanted to provide a facility that users can log in using their social profiles. I tried a lots of plugin but their support is at two levels only. Either I put the comment form open and give the user a choice to comment with email or via social login or I ask them to login, in which case it shows that you must be logged in to post the comment. In first case, there is a lot of spam, atleast 50-100 spam comments daily. And in second case, user never knows social login is there, so he will just leave thinking that he needs to register. What I want is that at the bottom of a post, there should be buttons for login and comment form should not be displayed unless user is logged in. So when user clicks on the facebook button, he is authenticated via facebook and redirected to the post page, but now logged in and hence can post the comment. Please let me know if there is some plugin for this.


Identifying a Page Containing Shortcode at `init`

I am writing a plugin and I am having some difficulty with when to trigger specific functions of the plugin code.               /*     // Plugin information goes here     */               // ***** Area A          $GLOBALS['example_class'] = new example_class;          class example_class {              // ***** Area B              public function admin_init() {             add_menu_page(                      // ...                  );         } // End of admin_init function     } // End of example class          add_action('init', function() {         global $example_class;              // ***** Area C              if ( ?????? ) {                  // Sanitize and set the view role             $view = ( isset( $_REQUEST['view'] ) ) ? sanitize_key( $_REQUEST['ex'] ) : 'get_all';             // Manage submitted data             switch ( $view ) {                      // ...                  } // End of switch for view                  // Sanitize and set the action role             $action = ( isset( $_REQUEST['action'] ) ) ? sanitize_key( $_REQUEST['action'] ) : NULL;             // Manage submitted data             switch ( $action ) {                      //...                  } // End of switch for action              } // End of if page is being shown     });          add_action( 'admin_menu', function() {         global $example_class;         $example_class->admin_init();     });          add_shortcode( 'show_public_random', function () {         global $example_class;         // ...     });      As per suggested in a previous post, I separated the controller side of my plugin into a function called by the `init` event. However, I do not want the code contained in the `init` event function to be evaluated at every page load - I want my code to be evaluated only when the page containing the shortcode is loaded. I have tried loading a boolean class variable that initializes as false but is changed to true from within the add_shortcode function, but by that time, it's too late - the `init` event has fired, and the function's contents is not run. Please help me - which expression should I use in Area C of my code? What should I test against to ensure the `init` event function is run only when the shortcode is being used?


What are the hierarchy of filenames while initialising a WordPress plugin?

WordPress has recommended to have the filename similar to the name of the plugin. There is no other information about the hierarchy of filenames of a WordPress Plugin. Also I don't find plugins following any rule for naming the file which initialises the WordPress plugin. Most of the plugins use the filename as my-custom-plugin.php. Some plugins use the filename as my_custom_plugin.php, some as bootstrap.php and some as loader.php. And I even saw one plugin having filenames like my-custom- plugin.php and loader.php, where loader.php initialises the plugin not my- custom-plugin.php. How it works? How WordPress looks for the file which initialises the plugin?


Post where filter not working with Ajax

I am trying to add filter               "add_filter('posts_where', 'location_multicity_where_changes_ajaxin');  "      with ajax but it is not working. After i call this in > functions.php via add action it responds me nothing.               add_action('posts_where','location_multicity_where_changes_ajaxin');     function location_multicity_where_changes_ajaxin($where='')     {         echo '<pre>'; print_r($where);echo '</pre>';          die("this");     }


Custom Post Type with Nested Taxonomy and Template Files

I have a custom Post Type of "Portfolio" with a rewrite slug of `portfolio`. So the URL on the frontend is: `domain.com/portfolio`. I have a custom Taxonomy of "Categories" with a rewrite slug of `portfolio/category`. So the URL on the frontend is: `domain.com/portfolio/category/<term-slug>/` When I visit `domain.com/portfolio/` the Post Type template displays just fine. When I visit `domain.com/portfolio/category/<term-slug>/` the Taxonomy term template displays just fine. However, when I visit: `domain.com/portfolio/category/` the Taxonomy template doesn't work. I get a 404 error. I even tested on core Post Type: `post` and core Taxonomy: `category`, with the posts page set to `/blog/`. Same thing...   * `domain.com/blog/` Displays posts just fine, served from `home.php` template.   * `domain.com/blog/category/<term-slug>/` Displays just fine, served from `category.php` template.   * `domain.com/blog/category/` Displays 404 error. An alternative route I've been taking in the past is to create a "page" for those 404 errors. So for example, I have `/blog/` already creates as a "page". Then I would create `/blog/category/` as another page, so that I wouldn't get a 404 error when the user navigated to: `domain.com/blog/category/`. Is this expected behavior? Is there a work around to not have to create pages for those "Taxonomy Archives"? How can I have a nested Taxonomy URL and have the `taxonomy.php` or even `archive.php` template work?


comment-reply.js always focuses on comment textarea

When replying to an already posted comment, comment-reply.js (or the 'min' version) is used to move the comment form up to below the comment being replied to. It also gives the focus to the actual 'comment' textarea. If the person commenting is logged in, this makes sense as it is the only input needed and displayed. If the commenter is not logged in, but has previously commented, the 'author', 'email' and 'url' inputs are displayed, but already filled in, so again focusing on the comment textarea makes sense. However, on many websites, comments will generally be from casual visitors without logins who have not commented before and so need, at least, to complete the name input, but still the focus goes straight to the comment textarea which seems to be odd, counter-intuitive behaviour. First question: is there some very good reason why this is the best behaviour which I'm just failing to see? Second question (assuming the answer to the first question is 'no'): is there a straightforward way (preferably without hacking the core) to modify this, so that the focus goes to the first, non-empty, required field? (I have tested this on a vanilla WordPress installation, using the 2012 theme, so this behaviour is not the result of a theme or plugin. The comment-reply.js file is located in wp-includes/js and I can see the line which focuses on 'comment'. I have tried googling and searching here on StackExchange, but can find no-one else discussing this behaviour.)


Has register_post_type() changed for WordPress 4.0

I know it's easy to blame the system update rather than user error, but I thought I would double check if anyone else has been running into the same issue! The following register_post_type() has worked through several updates, but very recently on a 4.0 update the custom post type has "disappeared" from the wp-admin sidebar menu, and also doesn't render on the site. Do I need to update the following in any way?               function create_post_type() {         register_post_type( 'rsf_properties',                 array(                         'labels' => array(                         'name' => __( 'Properties' ),                         'singular_name' => __( 'properties' )                         ),                 'public' => true,                 'menu_position' => 2,                 'rewrite' => false,                 'supports' => array('title', 'editor', 'thumbnail')                 )         );     }     add_action( 'init', 'create_post_type' );


Having trouble with Wordpress URL Rewrites

I am using Query Vars to display content from a database in wordpress on the page. The url looks like: 192.168.92.11/~buyin/business- directory?c=shop&r=valley-towns&t=Greenville Everything from the first question mark to the end is part of the query. Like (?c=shop&r=valley-towns&t=Greenville). I want it to look like: 192.168.92.11/~buyin/business-directory/shop/valley- towns/Greenville. Can anyone help me? The below code is what I am using in the functions.php               /** (Query Vars) Sending Variable to another page */     function add_query_vars_filter( $vars ){     $vars[] = "c";     $vars[] = "r";     $vars[] = "t";     return $vars;     }     add_filter( 'query_vars', 'add_query_vars_filter' );               /** Rewrite **/     add_action( 'init', 'add_rewrites_init' );     function add_rewrites_init(){     add_rewrite_rule(     'business-directory/([a-z]+)/?$',     'index.php?pagename=business-     directory&c=$matches[1]&r=$matches[2]&t=$matches[3]',     'top' );     }     /**/          Thank you, Brian


How can i get the bg-img I set to a div to show black and white and a bit transparent

So this is the problem: I set the background image to a div containing the title and some meta like in the first answer in this thread: Default featured image set as background image. Worked like a charm.   Is there a way to make only the bg img transparent (and also black and white - this is optional) and if possible on all posts except the one with the feature tag ? jquery, css, any answer will greatly appreciated. I tried multiple bg with the second background a white slightly transparent png, but can't make it work in the inline styles.


Meta Box on Custom Post Type not saving

I have a custom post type which is working fine, however the meta box does isn't saving. Long & short, i'm stumped!               add_action('init', 'portfolio');     function portfolio() {      $args = array(       'label' => __('Portfolio'),       'singular_label' => __('Portfolio'),       'public' => true,       'show_ui' => true,       'menu_position' => 5,       'capability_type' => 'page',       'hierarchical' => false,       'rewrite' => true,       'show_in_nav_menus' => true,       'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),       'has_archive' => true      );           register_taxonomy( 'type', 'portfolio',       array(                  'hierarchical' => false,         'label' => __('Project Type'),         'query_var' => 'type',         'rewrite' => array('slug' => 'portfolio/type' )       )      );           register_post_type( 'portfolio' , $args );     }          add_action("admin_init", "admin_init");     add_action('save_post', 'save_meta_data');          function admin_init(){     add_meta_box("portfolio_text", "Main Text", "portfolio_options", "portfolio", "normal", "high");     }          /* Meta Values for Shorts */     function portfolio_options() {      global $post;      $custom = get_post_custom($post->ID);      $short_embed = $custom["portfolio_text"][0]; ?>      <textarea name="portfolio_text" cols="40" rows="1" style="width:98%; height:100px"/><?php echo get_option('portfolio_text'); ?></textarea>      <?php }               /* Save Changes */     function save_meta_data($ID = false, $post = false) {         if($post->post_type != 'portfolio')             return;         update_post_meta($ID, 'portfolio_text', $_POST['portfolio_text']);     }      Your help is appreciated! Cheers, George


Loop through custom taxonomies and display posts

While I've been able to get this working for normal WP categories I've been unable to get it working for custom taxonomies. I'd like to loop through each custom taxonomy (categories in my case) and produce a number of posts for each. An example of the output would be:               Category 1          post from category one     post from category one          read more category one               Category 2          post from category two     post from category two          read more category two      Of course it would repeat through any available taxonomy for the custom post type.


Limit get_categories to show each category once

I am trying to create a home page where it is a list of categories with an associated thumbnail for each. I would like it so it returns each category once and returns the associated thumbnail from the latest post, or even better does not require me to add a featured image to each post, but rather grabs the thumbnail from the image of the post, using post_mime_type ? I am still a ways off as it is returning the category for each post that is within that category and then associating the image with every category. Here is the function I am working with:                   function home_filter() {             if ( is_home() )             {             add_filter( 'the_content', 'home_cats' );             }         }         add_action('template_redirect', 'home_filter');         function home_cats(){             $args=array(             'orderby' => 'name',             'order' => 'ASC',             );             $categories=get_categories($args);                foreach($categories as $category) {         echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . get_the_post_thumbnail($page->ID, 'thumbnail') . $category->name.'
 ';             }      }      The home page is simply :
     <?php while ( have_posts() ) : the_post(); ?>     <?php the_content();?>     <?php endwhile; ?>
      The output is something like:

Cat A

Cat B

Cat A

Cat B

Cat A

Cat B

      Can someone please help me understand how to return each category only once and include the thumb from the latest post in that category? And even better can anyone think of a way to accomplish this without having to set the feature image every time?


Best way to reset some admin options form to default?

I got some option pages for my theme. I did this whit add_menu_page, add_submenu_page. I further got settings with register_setting and there i got add_settings_section and add_settings_field(s). The field callback functions come from a class that auto-generates my fields. I then built a form callback function (for add_(sub)menu_page like the following.               public function render() {       $this->notify();       ?>

<?php echo $this->page_title; ?>

<?php _e('The developer mode allows access to some of your most important rapid prototyping tools.', MY_TEXTDOMAIN); ?>

                 <form action="options.php" method="post">                  <?php             settings_fields( MY_OPTIONS );             do_settings_sections(__FILE__);             ?>
              <input class="button-primary" name="Submit" type="submit" value="<?php _e('Save Changes', MY_TEXTDOMAIN); ?>" />
                 </form>                 <form method="post">
              <input class="button-secondary" name="Reset" type="submit" value="<?php _e('reset', MY_TEXTDOMAIN); ?>" />              <input name="action" type="hidden" value="reset" />
            </form>

       <?php            }           private function notify() {       if ( isset($_POST['save']) ) :        ?>

<?php sprintf(__('$1$s Options update %2$ssuccessfull%3$s.', MY_TEXTDOMAIN), $this->name, '', ''); ?>

        <?php        elseif ( isset($_POST['reset']) )  :        delete_option( MY_OPTIONS );        ?>

<?php sprintf(__('$1$s Options have been %2$sdeleted%3$s.', MY_TEXTDOMAIN), $this->name, '', ''); ?>

        <?php        endif;      }      (This is all done in a class) I can set default values, change and save them and everything works out fine. But one problem stays: I can't delete my options and can't reset them to the defaults. Does anybody know how to achieve that? Thanks!


How do I make it so that the all users page is not a white screen?

I tried to up the amount of users displayed on the screen, and then after clicking 'Apply', the Users page stays white for me, and only the user page. How do I fix this?


Is there a hook for when you switch themes?

I created a plugin but I just came across a bug that I don't really know how to solve. When you activate my plugin, it creates a file in the active theme directory and when you deactivate it, it deletes that file. The problem is, if you activate the plugin, and then switch the theme, the files won't exist in the new theme's directory. Is there a line of code I can add in my plugins functions file to deactivate the plugin before the theme is switched, and then activate it after the new theme has been activated? Thanks, this is a great community so I know I'll get a great answer. :)


How do you get the current-menu-item ID?

Im trying to get the id of the menu item that has be class called "current- menu-item". Not the current page id, but the nav item id. Please help


get_pages not returning any results or error when get_posts works

I have a code sample that works with get_posts but I now need do with get_pages so I can get grandchildren in the results set:               $attachments = get_posts( array(             'post_type' => 'attachment'             ) );              if ( $attachments ) {             foreach ( $attachments as $attachment ) {                 $class = "post-attachment mime-" . sanitize_title( $attachment->post_mime_type );                 $thumbimg = wp_get_attachment_link( $attachment->ID, 'thumbnail', true );                      echo '

' . $thumbimg . '

';             }              }      When I substitute get_posts with get_pages (all else the same) there are no results. Does anyone know what I'm doing wrong or why this should be? Thanks!!! Steve


Is it possible to use pages to apply static content to each taxonomy level?

I'm thinking of using a taxonomy archive template to list out my taxonomies and entries (I'm using a hierarchical structure) and then combining this with the WordPress pages module to apply static content to each taxonomy level. Each level will essentially have its own page and will list either its children or entries (posts). The idea I had was to create a page with the same slug as my taxonomy and then assign the taxonomy archive template to this page. Just wondered if anyone had done this before, or if its even possible.


Does the functions.php file ever get called during an AJAX call? Debug AJAX

Trying to figure out an issue a fellow programmer is having. I was wondering if the `functions.php` file get called at all when you do admin side AJAX? I know that when you do an AJAX call a part of WP gets loaded up to process the call and send back a response. Is the `functions.php` file included in that? The reason I'm asking is because he's using the class from the Meta-Box` plugin and loading it as part of a theme instead. There is some AJAX in that class that only returns empty responses and I think its because the code that handles the response doesn't get loaded. Is there any documentation to what gets loaded when WP handles AJAX?


List.js inside WordPress widget

I am trying to implement `list.js` (http://listjs.com/) inside my WordPress widget, so far with no success. At first I have tried it in a simple index.html file outside the WordPress environment just to see if I did things right - it worked.   But when I put the code inside my widget it didn't anymore. This is the code of my working `index.php`:
              <input class="search" />         Sort by name         Sort by city

Jonny

Stockholm

Jonas

Berlin

                If you click on "name" or "city" you will see the list getting ordered. **Edit - code of the widget:**                   <?php         /*         Plugin Name: pageLoopWidget         Plugin URI: ******         Description: pageLoopWidget         Author: ******         Version: 1.0         Author URI: ******         */         class pageLoopWidget extends WP_Widget {           function pageLoopWidget() {             $widget_ops = array('classname' => 'pageLoopWidget', 'description' => 'Displays the pageLoopWidget.' );             $this->WP_Widget('pageLoopWidget', 'pageLoopWidget Widget', $widget_ops);           }              function form($instance) {           $instance = wp_parse_args( (array) $instance, array(               'title' => '',               'listPages' => '',               'pageLoopWords' => '',               'pageLoopColor' => '',               'CustomCSS' => ''             ));           $title = $instance['title'];           $listPages = $instance['listPages'];           $pageLoopWords = $instance['pageLoopWords'];           $pageLoopColor = $instance['pageLoopColor'];           $CustomCSS = $instance['CustomCSS'];         ?>
<?php include 'codeBackend.php'; ?>
 <?php /* this contains the exact code pasted upside */ ?>              <?php           }              function update($new_instance, $old_instance) {           $instance = $old_instance;           $instance['title'] = $new_instance['title'];           $instance['listPages'] = $new_instance['listPages'];           $instance['pageLoopWords'] = $new_instance['pageLoopWords'];           $instance['pageLoopColor'] = strip_tags($new_instance['pageLoopColor']);           $instance['CustomCSS'] = $new_instance['CustomCSS'];           return $instance;         }              function widget($args, $instance) {           extract($args, EXTR_SKIP);                echo $before_widget;           $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);                if (!empty($title))             echo $before_title . $title . $after_title;              ?>              <?php include 'codeFrontend.php'; ?>              <?php           echo $after_widget;           }          }         add_action( 'widgets_init', create_function('', 'return register_widget("pageLoopWidget");') );


wordpress widget missing jquery

I have live score website and it is not wordpress based i build a widget for pure php websites but now i want to offer the widget to wordpress users problem is when i tried the widget i get three errors and to be honest i am not wordpress expert so i hope to be helped here . this is my link for users:

           and here is the error:   1. Uncaught ReferenceError: $ is not defined   2. Uncaught ReferenceError: jQuery is not defined    3. Uncaught TypeError: Cannot call method 'ajax' of undefined  and this is my part of my widget code:               (function() {          // Localize jQuery variable     var jQuery;          /******** Load jQuery if not present *********/     if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.8.3') {         var script_tag = document.createElement('script');         script_tag.setAttribute("type","text/javascript");         script_tag.setAttribute("src",             "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js");         var script_tag1 = document.createElement('script');         script_tag1.setAttribute("type","text/javascript");         script_tag1.setAttribute("src",             "http://localhost/aaa/include-js/jquery_timer.js");              if (script_tag.readyState) {           script_tag.onreadystatechange = function () { // For old versions of IE               if (this.readyState == 'complete' || this.readyState == 'loaded') {                   scriptLoadHandler();               }           };         } else { // Other browsers           script_tag.onload = scriptLoadHandler;         }         // Try to find the head, otherwise default to the documentElement         (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);         (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag1);     } else {         // The jQuery version on the window is the one we want to use         jQuery = window.jQuery;         main();     }          /******** Called once jQuery has loaded ******/     function scriptLoadHandler() {         // Restore $ and window.jQuery to their previous values and store the         // new jQuery in our local jQuery variable         jQuery = window.jQuery.noConflict(true);         // Call our main function         main();      }          /******** Our main function ********/     function main() {         jQuery(document).ready(function($) {         /******* Load CSS *******/         var css_link = $("<link>", {                  rel: "stylesheet",                  type: "text/css",                  href: "http://localhost/aaa/widget/blue.css"             });             css_link.appendTo('head');             var txt;             txt='
';             txt=txt+'
';             txt=txt+'
Hepsi
';             txt=txt+'
Canlı
';             txt=txt+'
Bitmiş
';             txt=txt+'
Başlamamış
';             txt=txt+'
Ertelenen
';             txt=txt+'
Oyunlarım (0)
';             txt=txt+'
';             txt=txt+'
';             txt=txt+'

';             txt=txt+'

';             txt=txt+'

';             txt=txt+'

';             txt=txt+'

';             txt=txt+'

';             txt=txt+'
';             txt=txt+'
';             $('#widget-container').html(txt);         });     }     })(); // We call our anonymous function immediately      and for the third error i used ajax request like this:               function get_All_Today_Matches()//this function used to get all the matches of today for all countries & comptions (live, finished, program) on the main page     {         $.ajax({//ajax function to get the xml data (faster)         type: "POST",//we use POST method beacuse we should send a 'home' to the proxy page to get the right xml url         url: "http://localhost/aaa/proxy.php",//proxy page         data : {country : 'home'},//parameters         dataType: "xml",//returned data type         success: parseToday//the function on success      });     }      EDIT: 4.Uncaught TypeError: Property '$' of object [object Object] is not a function


different contents and same sidebar approach?

I have a static header, sidebar and footer and then a varying content for single.php. What is the right approach to put contents in the div=content part? Say I have 3 different pages (article, stuff, registration) with this template. Can I save them in a php file and then call them like how "get_header()" functions?                   <?php get_header(); ?>

         SOME DYNAMIC AND VARYING STUFF HERE

              <?php get_sidebar(); ?>              <?php get_footer(); ?>      Thanks.


admin end post published time display not working correctly

I have the inconsistency in post published time. For example, as I published a post on April 20nd 9pm and it is April 20nd 9:30, wordpress shows it is published one minute ago in the admin end. Also in case, a post is published like 18 hours ago, wordpress says it is published only an hour ago. (it display correct time as it passed a day) Accordingly(perhaps) my code below does not work correctly.               function filter_where( $where = '' ) {         $where .= " AND post_date > '" . date('Y-m-d',strtotime('-1440 minutes')) . "'";         return $where;     }     add_filter( 'posts_where', 'filter_where' );          This code supposed to query posts within a day time frame, but it actually displaying posts within 37 hours time frame. I have set a server time and wordpress time zone correctly and consistently but have no good result back.


Parent/child pages and link structure the right way

I've always wondered what's the best way to achieve the following with pages. Say I have a (part of a menu) that looks like this: **What we do**   * Design websites    * Develop websites   * SEO The 'What we do' menu item is a custom one created with a # as link just to display the three sub items below on hover. It's not an actual page. To achieve the desired link structure ( mywebsite.com/what-we-do/design- websites ) I would created an empty 'What we do' page, the parent, and the other three pages that are a child of the 'What we do' page. The problem with this method is that the mywebsite.com/what-we-do link just shows an empty page. It's even worse when you're dispaying breadcrumbs on the site. It will show the parent page in the breadcrum with a clickable link but that just shows an empty page. It's easier to solve with posts and using categories/taxomities as the 'What we do' part will be an archive showing all the related posts. But with pages? What's the best way to handle with this situation?


Wordpress API to get galleries?

Is there a way to get with wordress API the created galleries? The main idea would be to create galleries as normal wordpress pages or posts on and use those images in a wordpress widget.


Weird behaviour on Edit Menus screen

I am running WP 3.9.1. Fresh install. ACF and Gravity Forms are the only two plugins running. Perhaps someone had this issue before... On the edit menu screen I have a tab called "View All" where I can see all pages and children pages under them. That's where you would typically check each box and make your menu. However in some cases the children pages are showing up as parent pages. It makes no sense. I know that this does not affect where the pages go in the actual menu. But it's an issue nonetheless. Screenshot: Actual parent page and children pages: ![enter image description here](http://i.stack.imgur.com/67KTD.png) Pages showing in the edit menu screen correctly (but missing 3): ![enter image description here](http://i.stack.imgur.com/xVxhV.png) Pages showing in the edit menu screen as parent pages instead of children ![enter image description here](http://i.stack.imgur.com/oIDtX.png) Any ideas? I checked each page again and in the edit page screen they do indeed show as child page. This is just one example, it happens with other pages and child pages too.


Bringing Ajax Loading Feature on Category Pages

Following this post -- Showing all the posts in one page? -- I was able to create a tag and category page with all posts. Example: http://blogote.com/apple/ The link contains over 200+ posts. Is there a way to show only 30-50 posts at a time and add a Twitter-like or Facebook-like "Load More" option? Probably we already have a plugin for this? Appreciate your response. Suggestions are welcome. Thanks!


How to upload prc file type?

When I try to upload a `*.prc` file type, I get this error: > Sorry, this file type is not permitted for security reasons. How can I fix this?


Your thoughts on the interaction with one custom database table from WP?

Short version:   * Step 1/ i am using contact form 7 to collect some user data and i insert the data into a custom database table.   * Step 2/ only the custom table needs to be altered/updated. In fact at the moment only one column needs to be updated by hand The client wants a very simple UI to update the data. The client doesn't want/need full access to WP-admin. So i was thinking of creating a password protected wp-page with the UI for the one db table. Just spitting out all data and let the column be editable. What are your thoughts?? regards


page wordpress add extra unwanted stuff

i want to add this part to wordpress page but every time i add it wordpress add extra stuff that stop it from working properly this is my code

server

program

      this is how wordpress make it

server


Search Limited to Categories Not Working

I am trying to limit my search to specific categories. my code is as below searchform.php                       <form id="searchform" action="<?php echo home_url( '/' ); ?>" method="get" class="form-stacked">                      <fieldset>

                     <input type="search" name="s" id="s" placeholder="<?php _e("Search","bonestheme"); ?>" value="<?php the_search_query(); ?>" />                     <button type="submit" class="btn btn-success"></button>
                     <input type="radio" value="all" name="search_type" id="searchOptionsAll" checked="checked" /> Search All                         <input type="radio" value="books" name="search_type" id="searchOptionsBooks" /> Books                        <input type="radio" value="blogposts" name="search_type" id="searchOptionsArticles" /> Articles

                 </fieldset>                       </form>      functions.php               function SearchByFilter($query) {       if ($query->is_search or $query->is_feed) {         //everything         if($_GET['search_type'] == "all") {           $query->set('post_type', 'post');         }         //recipes         elseif($_GET['search_type'] == "books") {           $query->set('post_type', 'post');           $recicategories=  get_categories('child_of=47');            foreach($recicategories as $recicategory) {              $cat_ids = wp_list_pluck($recicategories,'term_id');           }           $ccatsearch2 =  implode(',',$cat_ids);           $query->set('cat',$ccatsearch2 );         }         //articles         elseif($_GET['search_type'] == "blogposts") {           $query->set('post_type', 'post');           $blogcategories=  get_categories('child_of=42');            foreach($blogcategories as $blogcategory) {              $cat_ids = wp_list_pluck($blogcategories,'term_id');           }           $ccatsearch =  implode(',',$cat_ids);           $query->set('cat',$ccatsearch );         }       }       return $query;     }     //jump into the loop and arrange our results before they're returned     add_filter('pre_get_posts','SearchByFilter');      somehow , above code is not working and with my limited knowledge, I am not able to understand where I am making the mistake. Please help. Regards


How to insert post into a page?

i created a custom_post_type:                add_action('init', 'event_register');          function event_register() {          $labels = array(       'name' => _x('Pacotes', 'post type general name'),       'singular_name' => _x('pacote', 'post type singular name'),       'add_new' => _x('adicionar', 'pacote'),       'add_new_item' => __('Adicionar novo Pacote'),       'edit_item' => __('Editar Pacote'),       'new_item' => __('Novo Pacote'),       'view_item' => __('Ver Pacote'),       'search_items' => __('Procurar Pacote'),       'not_found' =>  __('Não encontrado'),       'not_found_in_trash' => __('Nada encontrado no lixo'),       'parent_item_colon' => ''     );          $args = array(       'labels' => $labels,       'public' => true,       'publicly_queryable' => true,       'show_ui' => true,       'query_var' => true,       'rewrite' => true,       'capability_type' => 'post',       'hierarchical' => false,       'menu_position' => 5,       'supports' => array('title','editor','thumbnail')     );          register_post_type( 'pacotes' , $args );     }      when i create post it does not appear in the page. is there any code that calls for the posts? thank you.


Data won't save if metabox within conditional in admin. What am I missing?

What is wrong with this setup? Metaboxes inside this conditional will not get saved.               // Only shows for the admin front-page assigned page.     $front_page_id = get_option( 'page_on_front' );     $post_id = (empty($_GET['post'])) ? NULL : $_GET['post'];          if (is_admin() && $front_page_id == $post_id) {         ........     }         _Background:_ The idea of this setup is to have only on the static front page(Settings -> Reading) meta fields for the user to upload images that will be use on the slider.


How do I add custom fields to Gravity Forms?

I'm trying to create a custom check box with a text field after it like: [ ] option 1 [ ] option 2 [ ] option 3 [ ] other **___ __**


Category custom fields - checkbox not updating

/*      ** Category custom fields     */     add_action ( 'edit_category_form_fields', 'extra_category_fields');     function extra_category_fields($tag) {            $t_id = $tag->term_id;         $cat_meta = get_option("category_$t_id");     ?>
     <?php _e('Alt view'); print_r($cat_meta)?>	                      <input type="checkbox" name="Cat_meta[alt_view]" id="Cat_meta[alt_view]" class="checkbox" <?php checked($cat_meta['alt_view'], '1'); ?>>
     <?php     }     // save extra category extra fields hook     add_action ( 'edited_category', 'save_extra_category_fileds');     // save extra category extra fields callback function     function save_extra_category_fileds( $term_id ) {         if ( isset( $_POST['Cat_meta'] ) ) {             $t_id = $term_id;             $cat_meta = get_option( "category_$t_id");             $cat_keys = array_keys($_POST['Cat_meta']);                 foreach ($cat_keys as $key){                 if (isset($_POST['Cat_meta'][$key])){                     $cat_meta[$key] = $_POST['Cat_meta'][$key];                 }             }             //save the option array             update_option("category_$t_id", $cat_meta);         }     }      So this is mine code, for some reason value of checkbox is not updating in the database. If i use same code with 'text' input, instead of 'checkbox', then everything works fine.


admin-ajax.php slow, how to speed it up?

admin-ajax seems incredible slow compared with an own and custom service entry point (site.com/wordpress/wp-content/myplugin/rpc.php?....). In our custom service entry, we actually load only : wp-config.php & wp- load.php and then our RPC handler = 120ms for a RPC request. When going over admin-ajax.php its 950ms for the same request. Is there anything we can do to speed it up ? IE, can we disable filters, plugins which have nothing to do with our request? We'd like to switch to admin-ajax but with this performance its simply aweful for user experience. well, any idea is welcome. thank you!


Display list of users who have made at least 1 post

What I would like to do is have a list of users who have contributed at least one post. I need to show the following: **[User photo] | [User Name] | [User post count]** e.g. **[photo] Joe Bloggs(8)** I made a start and went down this route:               <?php        $blogusers = get_users( 'orderby=post_count' );           foreach ( $blogusers as $user ) {           echo '<li>' . esc_html( $user->display_name ) . '</li>';        }     ?>      However, this seems to just return all users registered to the blog rather than those who have contributed so I'm certainly not doing it correctly. I am new to wordpress and PHP so all help would be appreciated.


Need help restoring my Wordpress blog

I installed wp-cache to help with site speed. Shortly afterward, I was unable to access the site. Included below are the browser errors I receive. The site is hosted by GoDaddy. I asked them to restore my site from a nightly backup, which they tried to do but it did not work. They recommended I reinstall Wordpress and restore the database from a backup. I did both but the only database I have to backup is from today, after the problem started. I'm no expert regarding databases but if you are restoring a bad database, the site still going to have problems, right? I researched wp-cache plugin problems and found solutions that worked for some but not for me. Maybe the problem is not coming from the plugin. But my site is completely down. I need help. Desperation set in a long time ago. Here's the error when visiting the home page: Fatal error: Call to undefined function: wp() Error when visiting /wp-admin Fatal error: Call to undefined function: get_option() Error when visiting /wpadmin/upgrade.php Fatal error: Call to undefined function: timer_start()


How to show multiple post types on taxonomy archive?

On a taxonomy archive, how does one create multiple loops for different post types that share that taxonomy? I'm using taxonomy-themes.php so that it applies to all three of the terms in the 'themes' taxonomy (climate change, governance, peace building). On each term's archive page, I want to output the main taxonomy loop (posts), and then I want to create loops for each of 'events', 'resources' and 'staff' (all of which are custom post types). I'm assuming that I create new wp_query for each of the post types, but how do I tell that query which term I want it to get 'events' from (ie. the current archives' term)?


Widget & storing a Select box choice

I am creating a simple widget which displays all of the pages on the website. The trouble I am having is how to store the user's choice and display it on the front end. At the moment, when saving my widget options, the select box reverts back to the first page listed. I think I need to use WordPress' selected function? Here is my code:                       <p>             <label for="<?php echo $this->get_field_id('select'); ?>"><?php _e('Choose A Page:', 'check_avail_widget'); ?></label>             <select name="<?php echo $this->get_field_name('select'); ?>" id="<?php echo $this->get_field_id('select'); ?>" class="widefat">                       <?php                    $pages = get_pages();                        foreach ( $pages as $page ) {                         $option = '<option value="' . get_page_link( $page->ID ) . '">';                             $option .= $page->post_title;                             $option .= '</option>';                             echo $option;                   }                  ?>                  </select>         </p>      What do I need to add in order for this to work? Thanks in advance


pagination broken - clicking next displays "page not found"

I'm a newb at Wordpress, but my HTML/CSS is ok. My site is: http://www.modernfuture.net/wordpress been working on it this for quite some time & I'm done with the headaches, need to get some answers from the pros! My Problem: When I click on "next" or "2" to get to the next pagination page. Instead of showing the remaining posts in the loop, what's displayed is "page not found" My Speculation: I'm not sure at all, but my hunch is that it has something to do with the loop.php (as the permalinks settings, functions.php, and pagination.php have remained untouched) anyway here's the code:
      <?php query_posts('posts_per_page=1&cat=4'); ?>      <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
             <?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                     <?php the_post_thumbnail(array(287,250), array('class' => 'featuredThumb')); // Declare pixel size you need inside the array ?>                                        <?php endif; ?>
                                          <?php endwhile; ?> <?php wp_reset_query(); ?>
               <?php      $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('showposts=6&cat=1'.'&paged='.$paged);     ?>                    <?php if ($wp_query -> have_posts()): while ($wp_query -> have_posts()) : $wp_query -> the_post(); ?>                  <?php $column = ($column == '') ? 'first' : (($column == 'first') ? 'middle' : (($column == 'middle') ? 'last' : 'first' )); ?>                  <article  <?php post_class($column); ?> id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                               <?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                     <?php the_post_thumbnail(array(120,120),array('class' => 'loopThumb')); // Declare pixel size you need inside the array ?>                                        <?php endif; ?>

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

                        <?php endwhile; ?>          <?php else: ?>

<?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?>

                   <?php endif; ?>      I have two loops going. One that makes the featured post appear, and the other makes the normal posts appear. I'm not sure what's causing the problem but I hope this helps. Any help appreciated! Thanks in advance!


Htaccess redirect from '/%postname%.html' to '/%postname%'

I have a Drupal 5.x based travel review site which I'm moving over to Wordpress 3.x (same domain name). The Drupal site is structured like this:   * `www.example.com/travel-guides` (these are top-level pages) - these are only a handful.   * `www.example.com/<filename>.html` (filename is the name of a place / attraction etc). - makes up for bulk of the content in the site. In WordPress the setup is fairly straightforward. All content follows a simple permalink:               www.example.com/postname      How do I set a rule in .htaccess to bulk redirect all the pages? There are over 600 pages and I don't want to manually set redirect rules for all of them.


Woocommerce showing images blurry in description page

I am doing an E-commerce website using Woocommerce plugin. Most of the things working fine with little bit changes. But I am facing a problem regarding images. I have uploaded the image for featured image which will be shown in product gallery which is showing good but when I am going to the product description just by clicking on the product image it is showing image with blurry. To know the reason I google and I got some solution in this page. But I don't understand the solution. How to work with it. Here with I am attaching my scrren shot for product category, Product description image screen shot and the settings for the images in plugin settings.Any help and suggestions are highly welcome for this question. **Product category image** ![enter image description here](http://i.stack.imgur.com/xoX8r.png) **Product description image** ![enter image description here](http://i.stack.imgur.com/PZuzk.png) **Image settings from the woocommerce plugin** ![enter image description here](http://i.stack.imgur.com/RZvMx.png)


unregistered user can write in blog page - possible? how to?

I'm working on a site wherein the owner wants people(potential real estate clients) to be able to write their home-owning hopes, dreams, desires, etc. I'm thinking something similar to the functionality of comments, like a live- feed testimonials page? My question is how do I facilitate this? I'm not too concerned with spam right now, just want to know how to/if it's possible. Thanks.


Create Cross Promoting Categories in Wordpress Using 'pre_get_posts'

# What am I trying to do? Assign more than 1 category to a post so that it would appear in each category template without 1 main category in the URL. WP's default behavior when you select more than one category for a post is to assign the post to the category with the lowest ID. For example: If "Apple" category has an ID of 6 and "Peach" category has an ID 4. If the post is added to the Apple category, then the permalink will be /apple/post-title (pretty permalinks). If the post is added to Apple and Peach categories, then the permalink will be /peach/post-title. # Constraints   1. Category must appear in the permalink   2. Permalinks cannot change if additional categories are added # What I've tried First, I create a new taxonomy called "crosscategory". This will allow me to create a second set of categories with the same name as the main categories. So that I could select Apple as the category and Peach as the "cross category."               function crosspromote_taxonomies() {         $crosscatlabels = array(             'name'              => _x( 'Cross Promote Categories', 'taxonomy general name' ),             'singular_name'     => _x( 'Cross Promote Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Cross Promote Categories' ),             'popular_items'     => __( 'Popular Cross Promote Categories' ),             'all_items'         => __( 'All Cross Promote Categories' ),             'parent_item'       => __( 'Parent Cross Promote Category' ),             'parent_item_colon' => __( 'Parent Cross Promote Category:' ),             'edit_item'         => __( 'Edit Cross Promote Category' ),              'update_item'       => __( 'Update Cross Promote Category' ),             'add_new_item'      => __( 'Add New Cross Promote Category' ),             'new_item_name'     => __( 'New Cross Promote Category' ),         );         register_taxonomy(              'crosscategory',              array(                 'post'             ),              array(                  'hierarchical'      => true,                  'labels'            => $crosscatlabels,                 'show_ui'           => true,                 'query_var'         => true,                 'rewrite'           => false,             )         );     }      Now I need to create a filter that only runs on the category.php template. If I navigate to /apple/ I need to see all posts in the Apple category as well as any posts in another category that was also cross-promoted in Apple.               function cross_category_filter($query){         // only run this filter on the actual category page         if ( is_admin() || $query->is_home() || !$query->is_main_query() || $query->is_singular || !$query->is_category )             return;              $category_name = $query->query_vars['category_name'];              // Required to include posts from category-x used for cross-promoting posts in other categories without changing the URL         $query->set(              'tax_query',              array(                 'relation' => 'OR',                 array(                     'taxonomy'  => 'crosscategory',                     'field'     => 'slug',                     'terms'     => array($category_name),                     'operator'  => 'IN'                 )             )          );     }     add_action( 'pre_get_posts', 'cross_category_filter', 1 );      **The Problem** It simply doesn't seem to work at all. When I navigate to /apple, I either see a tag page (instead of a category template -- not sure why) or I may see no posts at all. The header.php, sidebar.php and footer.php would load but where the posts should be is empty as if the has_posts() has no posts. The output of the $query object looks like:               WP_Query Object     (         [query_vars] => Array             (                 [category_name] => apple                 [error] =>                  [m] => 0                 [p] => 0                 [post_parent] =>                  [subpost] =>                  [subpost_id] =>                  [attachment] =>                  [attachment_id] => 0                 [name] =>                  [static] =>                  [pagename] =>                  [page_id] => 0                 [second] =>                  [minute] =>                  [hour] =>                  [day] => 0                 [monthnum] => 0                 [year] => 0                 [w] => 0                 [tag] =>                  [cat] =>                  [tag_id] =>                  [author_name] =>                  [feed] =>                  [tb] =>                  [paged] => 0                 [comments_popup] =>                  [meta_key] =>                  [meta_value] =>                  [preview] =>                  [s] =>                  [sentence] =>                  [fields] =>                  [menu_order] =>                  [category__in] => Array                     (                     )                      [category__not_in] => Array                     (                     )                      [category__and] => Array                     (                     )                      [post__in] => Array                     (                     )                      [post__not_in] =>                  [tag__in] => Array                     (                     )                      [tag__not_in] => Array                     (                     )                      [tag__and] => Array                     (                     )                      [tag_slug__in] => Array                     (                     )                      [tag_slug__and] => Array                     (                     )                      [tax_query] => Array                     (                         [relation] => OR                         [0] => Array                             (                                 [taxonomy] => crosscategory                                 [field] => slug                                 [terms] => Array                                     (                                         [0] => apple                                     )                                      [operator] => IN                             )                          )                  )              [tax_query] => WP_Tax_Query Object             (                 [queries] => Array                     (                         [0] => Array                             (                                 [taxonomy] => category                                 [terms] => Array                                     (                                         [0] => apple                                     )                                      [include_children] => 1                                 [field] => slug                                 [operator] => IN                             )                          )                      [relation] => AND             )              [meta_query] =>          [post_count] => 0         [current_post] => -1         [in_the_loop] =>          [comment_count] => 0         [current_comment] => -1         [found_posts] => 0         [max_num_pages] => 0         [max_num_comment_pages] => 0         [is_single] =>          [is_preview] =>          [is_page] =>          [is_archive] => 1         [is_date] =>          [is_year] =>          [is_month] =>          [is_day] =>          [is_time] =>          [is_author] =>          [is_category] => 1         [is_tag] =>          [is_tax] =>          [is_search] =>          [is_feed] =>          [is_comment_feed] =>          [is_trackback] =>          [is_home] =>          [is_404] =>          [is_comments_popup] =>          [is_paged] =>          [is_admin] =>          [is_attachment] =>          [is_singular] =>          [is_robots] =>          [is_posts_page] =>          [is_post_type_archive] =>          [query_vars_hash] => 47f5cb8591c9e310161e42fa4bffbf43         [query_vars_changed] =>          [thumbnails_cached] =>          [query] => Array             (                 [category_name] => apple             )          )      I'm using pre_get_posts to reduce the number of queries and to do it the proper way. It should find all posts in the Apple category and any posts that is in the crosscategory Apple as well. I assume even if there are no posts in the crosscategory Apple, it should still find posts in the Apple category. Neither of which is happening and I'm stumped at this point.


Error when adding custom taxonomy to wp nav menu

I have the plugin CustomPress from wpmudev. I know longer have my membership there as it was just to pricey. I am also using there theme wpmu_dixi with some of my own customizations and tweaks. None of those tweaks where to its cor files i just added some new widget locations and messed with the css. Anyways when i go to add a menu item from the custom taxonomy (ie action) which is under the taxonomy type Movies it spits out the following error in the custom menu area (wp-admin/nav-menus.php)               Catchable fatal error: Object of class WP_Error could not be converted to string     path-to-site/entertain/wp-admin/includes/nav-menu.php on line 73      *i removed out my path I am using wordpress in network mode and have tried creating a tag that was far off and still nothing. The tag action appears on another sub-site but since i tried using a random tag this should not be the problem. I have searched on a few articles and the closest i could find is this one http://premium.wpmudev.org/forums/topic/custompress-error-adding-custom-post- type-via-taxonomies-to-menu


Buddypress send admin notification email when new subscriber registers

I am running a Buddypress site, but I am not getting emails when a new subscriber registers. I have used a code in my functions.php that removes the activation email the user would receive (I want them auto activated and I am using a mailchimp auto responder to contact them upon registering instead). I don't see where this code would disable the email that I should receive when they register, but I am a very novice wordpress user. Can anyone see something that I can change to allow me (the admin) to be notified when a user registers, but not send an activation email to the user?               function disable_validation( $user_id ) {       global $wpdb;       $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 0 WHERE ID=%d", $user_id ) );     }     add_action( 'bp_core_signup_user', 'disable_validation' );     function fix_signup_form_validation_text() {       return false;     }     add_filter( 'bp_registration_needs_activation', 'fix_signup_form_validation_text' );          function disable_activation_email() {     return false;     }          add_filter( 'bp_core_signup_send_activation_key', 'disable_activation_email' );      Thanks in advance.


How Can I Always Display A Particular Post First Using WP_Query?

My apologies if this question has already been asked somewhere else, I searched but couldn't find anything. I am working on a tours website, there will be individual package pages that show some text, images and some other stuff. On the right hand side of my single package pages I have a comparison table which is merely a custom WP_Query pulling out all packages from the database using the following code:               // Package fetching arguments     $pargs = array(         "numberposts" => -1,         "post_status" => "publish",         "post_type" => "packages",     );          // Get out packages     $cpackages = new WP_Query($pargs);      I however would like the first item of this comparison table to be the current package the visitor is viewing. Say for example the user is viewing a package called "Tour A" on the right hand side I would like to pull out all packages but make sure that Tour A is at the beginning and highlighted then the other posts displayed. I've looked into sticky posts, but they don't really apply to what I am wanting to do, because if someone is on Tour B, then it needs to be displayed first in the comparison table and then so on.


How to force jQuery to load as a first script in header in frontend?

How to force jquery to load as a first script in header? Right now it's the last ;( like:               <link type="text/css" rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" />     <link type="text/css" rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.6.0/jquery.selectBoxIt.css" />     <link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css" />          <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>     <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.6.0/jquery.selectBoxIt.min.js"></script>                         <script type='text/javascript' src='http://localhost/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script>      and I want them to be in this order:               <script type='text/javascript' src='http://localhost/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script>                         <link type="text/css" rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" />     <link type="text/css" rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.6.0/jquery.selectBoxIt.css" />     <link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css" />          <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>     <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.6.0/jquery.selectBoxIt.min.js"></script>      And my head looks like this:               <head>     <meta charset="<?php bloginfo( 'charset' ); ?>" />     <meta name="viewport" content="width=device-width" />     <title><?php wp_title( '|', true, 'right' ); ?></title>     <link rel="profile" href="http://gmpg.org/xfn/11" />          <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />     <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>     <!--[if lt IE 9]>     <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>     <![endif]-->          <?php wp_enqueue_script("jquery"); ?>          <link type="text/css" rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" />     <link type="text/css" rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.6.0/jquery.selectBoxIt.css" />     <link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css" />               <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>     <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.6.0/jquery.selectBoxIt.min.js"></script>          <?php wp_head(); ?>          </head>


Integrating Html5Boilerplate's Builder into a WP Theme

So Im planning to use Html5Boilerplate as a base to build a new WP Theme on. The Boilerplate comes with the Builder, a handy Tool for minifiying, concatenating and compressing ones Website for obvious reasons: speed/performance-gain, easier mobile access and so on. I would very much like to use this feature with my theme. Problem: The builder outputs the processed files into a subdir /publish. Without WP one could use a .htaccess rule to reroute the base domain, e.g. mysite.net to mysite.net/publish. This is the method proposed by Html5Boilerplate. Since I can't possibly use this approach in a Theme, I would need a way to tell WP to go looking for the Theme's files in the /publish subdir of the actual Theme dir. Anyone know a way to do that? Alternatively, is there a way to tell The build script to look for the source Files in a subdir, and to subsequently publish the files into the theme root?


Display a widget on a specific type of archive

I have two sidebar widgets, I need to display 1 widget on the archive pages for the standard post categories and the other widget needs to show on just the archive pages for a specific custom post type. If I use the conditional tag is_archive() then both widgets will show up on both archive pages. How can I determine which archive page the widgets should be displayed on? I'm using the plugin 'Widget Logic' Thanks in advance


Populate meta select box with child pages

I'm trying to populate a drop down select meta box with a list of child pages of that page. I am using the wp_list_pages function to retrieve the list of child pages, no problem there. The problem is that the list is return as li items. What is the best way to get these into an `<option>` format suitable for a dropdown box?


If Specific Post, Link Elsewhere

I would like to create a conditional statement that checks the loop for a specific post ID, then if true, it outputs a link elsewhere. This is what I have so far:               <?php query_posts('post_type=team&orderby=title&order=ASC'); ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                  <div class="post grid" id="<?php echo get_the_ID(); ?>">
                                               <?php if ( is_singular( '2295' ) ) : ?>                         <?php the_post_thumbnail('team-thumb'); ?>                     <?php else : ?>                         <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail('team-thumb'); ?>                     <?php endif; ?>

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

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


Make plugin page follow standard enqueueing procedures

I am writing an administrator plugin that helps a user write some simple shortcodes. When the user clicks on a new button in the TinyMCE editor a ThickBox window appears and loads a PHP template I created with a heap of prompting fields. If I want to access new scripts or stylesheets in this window I have to hard code them into the PHP template. I.e.               <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">     <html xmlns="http://www.w3.org/1999/xhtml">         <head>             <title></title>             <script src="./scripts/myscript.js"></script>             <style src="./css/mystyles.css"></style>         </head>      I would much prefer to use best practice enqueuing methods as opposed to this method. Is there a way to make this PHP document in my plugins folder do all the normal WordPress processes (e.g. enqueue script and styles) as if it were just another page?


Remove last character in get_post_meta

I have a custom field that contains a sentence along with a punctuation mark at the end. I am looking to use this field as a title of the article on my homepage, but in doing so I would like to remove the last character of that custom field (so that the ending period of the sentence is not included in the title). **Here is the code I use to display the custom field on my homepage:**               <?php echo get_post_meta($post->ID, one_line_summary, true); ?>      I'm not great with PHP programming, so specific examples with my code would be preferred. Thanks in advance!


Sticky wp_dropdown_categories on Front End Form

I have built a front end posting form and I am trying to make the entire form sticky. I have used wp_dropdown_categories but I can not seem to figure out how to make it remember the selection if there are errors in other parts of the form after posting it. I appreciate any help/advice you can give.               <!-- post Category -->     <fieldset class="category">         <label for="cat" class="selection-title">Reason For closure and/or delay:</label>         <?php wp_dropdown_categories(array('echo' => 1, 'hide_empty' => 0, 'name' => 'cat', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('Select a reason for closure/delay'))); ?>     </fieldset>     <!-- post Content -->


Is there any reason why using the same wp-config file might not work in MAMP?

I'm not sure why but when i just want to create a copy of a site that i'm working on in MAMP, that say i just downloaded from the web. I just copy the same wp-config file from another local version that i've been working on. But when i try to go to that new htdocs directory (which is essentially just a copy of the old one) it doesn't recognize the db. Can anyone see why this might be a problem or possibly warn me of other reasons why this would be a fail? Here is my process, I'm using a hosted version because I have another team working on it. I prefer to work locally so what i do is   1. download the files and images through a plugin    2. Create a new server in MAMP (titled Site2)    3. copy the contents of the backup zip (that i just downloaded from my server) into my new local server (title Site2)    4. Update the config file to be exactly like the current version that I have on MAMP (Site1) and when I go to that site I'm able to get onto the correct first page but then when I go into other pages I re-direct to the Site1 interior pages Could this be because I'm using the exact same wp-config file as Site1? Would this mean that with every copy or version of the site that I work on that I should created a new unique WP-config file? I realize that if I had worked with Git from the beginning this would be more manageable but I'm already in the site process Updated to illustrate my point: Currently in my wp-config file i have this:               // ** MySQL settings - You can get this info from your web host ** //     /** The name of the database for WordPress */     define('DB_NAME', 'wp_site1');          /** MySQL database username */     define('DB_USER', 'root');          /** MySQL database password */     define('DB_PASSWORD', 'root');          /** MySQL hostname */     define('DB_HOST', 'localhost');          /** Database Charset to use in creating database tables. */     define('DB_CHARSET', 'utf8');          /** The Database Collate type. Don't change this if in doubt. */     define('DB_COLLATE', '');


Custom taxonomy template

I make two custom post type called (movies and serials) and one custom taxonomy called (directors). When I go to `/directors/namedirector` I don't see movie. I need help to make query or template for `taxonomy-directors.php`.


Is there a way to call on just the content of a Page without actually using that Page?

The question sounds weird i know, but what i'm trying to do is add a gravity form into a template that i made. But all of their tutorials seem to be more along the lines of adding a form to a page and not so much to a template. So the idea was to use a get_content() from a specific Page that i created (called "Form" in this case) put that into it's own content-form.php file and then call a get_template_part() into the section of my template where i need it in. First off, is this too much abstraction? If it's just better to somehow call the form from this specific Form Page into my template of choice i'll do that but i'm just not sure how to go about this. Thanks.


Can a users profile be put under the dashboard menu

I was reading an article today and it covered some very valid points on user experience with WordPress. One of its points was that the profile should go under the Dashboard menu. I like this idea but not sure if it could be done.


Question about Menus on Wordpress

I have a question regarding something that is not working properly, I have a menu that is not working, currently with my theme I have 10 menus, one being the main nav and the rest are needed for special purposes, the thing is, the main one is not working, is taking the menu values from one of the other menus, but I'm sure I'm referring that menu in the right way. In my header I'm calling my menu like this:               <?php wp_nav_menu( array('menu' => 'Main', 'menu' => 'menu_center' )); ?>      And in my `functions.php` I have this:               add_theme_support('nav-menus');      if ( function_exists('register_nav_menus')) {         register_nav_menus( array(             'main' => 'Main Nav',             /* FOOTER MD USA */             'footer-opinion' => 'Footer Opinion',             'footer-noticias-economicas' => 'Footer Noticias Economicas',             'footer-consumo' => 'Footer Consumo',             'footer-empresas' => 'Footer Empresas',             'footer-noticias-actualidad' => 'Footer Noticias de Actualidad',             'footer-suplementos' => 'Footer Suplementos',             'footer-finanzas' => 'Footer Finanzas',             'footer-spotlight' => 'Footer Spotlight',             'footer-otras-publicaciones' => 'Footer Otras Publicaciones'         ) );     }      But the main nav menu is not working is displaying one of the footer menus and this is driving me crazy, any idea guys what I'm doing wrong? Thanks!


Display of comment_date within get_comments?

Any way to change how the date is displayed with get_comments..? I have the following..                <?php            $comments = get_comments( array(            'post_id' => $post->ID,            'number' => 4,            'status' => 'approve'            ) );                 foreach($comments as $comment) :            echo "
            {$comment->comment_content}            {$comment->comment_date}            By {$comment->comment_author}
";            endforeach;          ?>      Comes out with something like.. 2012-02-20 17:09:07 when i just want something like 6th January 2011


Keep Logged in Users out of Admin Panel

So I'm creating user registration. Just simply `<?php wp_register(); ?>` but then it gives them a link to the admin panel, which in my situation they really don't need. How do I remove the "Site Admin" link and redirect a subscriber if they try to access the admin panel? I guess once they log in I will need to redirect them to a certain page also.


Emailing Authors only when a CUSTOM POST TYPE post is published- not when edited later

I have the following function that emails authors of a **custom post type** when the post is published which is great, but I would like it so that it does not email them on any future edits after that to avoid sending them loads of emails by accident. This is the function I have at the moment:               //email authors     function authorNotification($post_id) {        $post = get_post($post_id);        $author = get_userdata($post->post_author);             $message = "Hi ".$author->display_name.".     A document for you, ".$post->post_title." has just been published or edited and requires your attention.      You will be taken to the document after you log in from this link: ".get_permalink( $post_id ).".        ";        wp_mail($author->user_email, "An online document has been made or edited for you.", $message);     }     add_action('publish_portaldocuments', 'authorNotification');      I'm wondering if it has something to do with the The {$old_status} _to_ {$new_status} and {$new_status}_{$post->post_type} hooks as on this page: Post publish only hook? Could someone help please as I'm not sure how I would implement it WITH A CUSTOM POST TYPE. Thanks :-) **Update** : This worked for me:               // SEND EMAIL TO AUTHOR OF A CUSTOM POST TYPE ONCE POST IS PUBLISHED          function authorNotification($post_id) {         if( ( $_POST['post_status'] == 'publish' ) && ( $_POST['original_post_status'] != 'publish' ) ) {      $post = get_post($post_id);        $author = get_userdata($post->post_author);             $message = "Hi ".$author->display_name.".     A document for you, ".$post->post_title." has just been published or edited and requires your attention.      You will be taken to the document after you log in from this link: ".get_permalink( $post_id ).".        ";        wp_mail($author->user_email, "An online document has been made or edited for you.", $message);         }     }          add_action( 'publish_portaldocuments', 'authorNotification' );


Notification to Admin or Author upon new post

I am using a custom function with 'publish_post' hook for a notification to the author when the post has been published but the issue I am facing right now is that the notification is being sent out twice and as well when the post is updated. Here is how my function looks.               function authorNotification($post_id) {        $post = get_post($post_id);        $author = get_userdata($post->post_author);             $message = "           Hi ".$author->display_name.",           New post, ".$post->post_title." has just been published at ".get_permalink( $post_id ).".        ";        wp_mail($author->user_email, "New Post Published", $message);     }     add_action('publish_post', 'authorNotification');      am I missing something here?


Filter causing loss of _wp_attachment_metadata

A while back I asked this question: Save camera info as metadata on image upload? Long story short, it works in that the custom field is saved into wp_postmeta and I can access that value. But as I'm revisiting the project, I've noticed a side-effect. With the following code in place to save the extra photo metadata, _wp_attachment_metadata no longer gets saved to the database. This obviously leads to several issues with image sizes and the image editor in WP:               add_filter( 'wp_generate_attachment_metadata', 'mvt_save_photo_credit', 10, 2 );          function mvt_save_photo_credit( $metadata, $attachment_id ) {         add_post_meta($attachment_id, '_mvt_credit', $metadata['image_meta']['credit'], true);     }      I can't figure out why _wp_attachment_metadata no longer gets saved with this filter in place. Everything seems to line up as it should, and the filter itself successfully writes the data it's meant to. Removing the filter returns the expected functionality (_wp_attachement_metadata is correctly saved to the DB), so I know the issue has to do with this filter. Any help would be greatly appreciated. Thanks.


Automatically Facebook Debug Posts on Publish

I am looking to do something similar to this plugin which adds an "FB- Debugger" link on the admin of pages/posts: http://xlino.com/projects/facebook-debug-link-wordpress-plugin/ However, I'd like to make this even more automated by sending the post url directly to the Facebook Debugger on publish or re-publish by opening the debugger in a new browser tab with the results for the url. This seems pretty possible because the url that would be passed to the debugger looks like http://developers.facebook.com/tools/debug/og/object?q=mysite.com/my-post I guess my question is how can I automatically open up a new tab with: http://developers.facebook.com/tools/debug/og/object?q=[ **post-url** ] a second or two after the post is published or changed (there would need to be time delay for FB to find the post) ? I know a little PHP and it seems like a pretty simple command, but what core WP file would I edit? Im using WP 3.3.1 . I've done some frontend template tweaking but nothing that changes or adds on to the admin. Thanks!


Migration: Copying database content to a different server

I'm migrating our WordPress site from one server to another. I need some hint on how to deploy a database dump (which I have) from the original server to the new one. There is no phpmyadmin (at least I don't have access to it), so I need to copy the dump using console. Or maybe there is some WordPress plugin for this? Thanks in advance!


How to disable "insert into post" only when selecting the Featured Image?

I wish to restrict the user from putting inline images in the article. I am using the Wordpress Attachments plugin to allow the user to attach images, which I then position and stylize the way I want. I also managed to remove the Upload/Insert link from the post through adding a hook to my functions.php of my theme. (Thanks to an answer here.) However, I noticed that the "Insert into post" link is still there when the user presses the "Set Featured Image" link. I want to allow him to set a featured image but not insert into post. I tried another solution I found (inverting the logic here) and added this function:               add_filter( 'get_media_item_args', 'force_send' );     function force_send($args)     {        $args['send'] = false;        return $args;     }      Which does the job and disables the "Insert into post" button, but on the other hand it also stops the Attachments plugin from working (the Attach button disappears) and also other plugins using the same image uploading dialog stopped working. Is there any way I can detect that the "Set featured image" link was clicked in the function `force_send()` above so that I only disable the button when the user clicks the set featured image? Alternatively, is there any better way to stop the user from putting images in the WYSIWYG editor? There doesn't seem to be any permission setting anywhere to stop a user from doing so. **UPDATE (ACTUAL SOLUTION)** Just want to post my solution, based on the answer below, just for completeness in case anyone needs it. It also hides the "Insert into Post" button.               add_filter( 'get_media_item_args', 'force_send' );     function force_send($args)     {       // for the media upload popup we get the Post ID from the $_GET URL parameter list       $post_id = $_GET['post_id'];            // with post ID in hand we now get current post_type              $post_type  = get_post_type($post_id);            // define list of our restricted post_types       $restricted = array('post', 'page');            // check current post_type against array of restricted post_types       if (in_array($post_type, $restricted))        {         // if our current post_type as returned from get_post_type is in array          // we return false to void inserting image into post editor         $args['send'] = false;       }             return $args;     }


Can't Get 'tag' Page To Display only Tagged Posts

I made a tag.php under my theme folder in order to style all of the tagged post pages from urls like 'www.mywebsite.com/tag/kittens'. However, if I go to 'www.mywebsite.com/tag/kittens' it displays all of my posts, even the ones that are not tagged 'kittens' or at all. I used the the standard loop, and I can't find a way to alter it to grab the tag page name and only return those posts without making a separate 'tag-kittens.php' type page for every single tag. Help? * * *               <?php         get_header();         query_posts( 'posts_per_page=5' ); ?>          <?php the_tags( $before, $sep, $after ); ?>           <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                 <?php the_time('F jS, Y') ?>
         <?php the_content(); ?>

            <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
      <?php endif;         get_footer();      ?>


Nested Admin panel sub menus in single menus

i know how to add custom menu in the admin panel and how to add multiple sub menus in the custom menu. But i want to know can we add nested sub menus in the custom menu (WordPress admin panel)? Means Custom Menu-->submenu 1 --> submenu 1.1--> and goes on.


Hide Meta Boxes for Non-Admins

I have a review based wordpress site where I have a page for each different company where there users can review them. The theme I use adds a custom post type called "review" and I have used Press Permit to create limited user accounts that can modifying some parts of these review pages. I wanted to hide some of the Meta Boxes that they should not have access to such as Yoast SEO, GD Star Ratings, etc. I followed the instructions from some other posts on this website, however it does not hide the meta boxes as it should. I have added the following code at the end of the "functions.php" in my Theme directory as per the instructions at WordPress SEO by Yoast: Hide Meta boxes in posts for non-admins               add_action('add_meta_boxes', 'hide_yoastseo_metabox', 99);          function hide_yoastseo_metabox()     {         if (!current_user_can('activate_plugins'))         {             remove_meta_box('wpseo_meta', 'review', 'normal');         }     }


Removing taxonomy base using WP rewrite

I´m trying to create the following URL structure:               example.com/attractions                     <-- post type archive     example.com/attractions/taxonomy_term       <-- taxonomy archive     example.com/attractions/van-gogh-museum     <-- custom post type      Unfortunately this isn´t possible by default: WordPress needs the taxonomy base in the URL, as SE user sanchothefat wrote in his answer to this question: > _...if you don't want the taxonomy-slug to be there then you're out of luck, > you can't have the same slug as your post type or another taxonomy as it > won't know what term is from which taxonomy and what's a post._ In other words, WordPress needs this permalink structure:               example.com/attractions/taxonomy_base/taxonomy_term      **My question:** Is there a way to make this work using WordPress rewrite API? I suppose it involves 2 steps:   1. Removing the taxonomy base from the URL    2. Tell WordPress what post type it needs to display * * * ## Update #1 I found a code snippet that should remove the taxonomy base from the URL:               global $wp_rewrite;     $wp_rewrite->extra_permastructs['taxonomy_base'] = array('%taxonomy_base%', EP_NONE);      (Source - see last answer on bottom of page) This isn´t the complete solution though, since WordPress can´t tell if the post is a taxonomy archive or a post type... * * * ## Update #2 The author of this great article on _Advanced Taxonomy Queries with Pretty URLs_ wrote me: > _What you're asking isn't too difficult, but it could be a bit tricky. The > rewrite rules need to know what type of thing the second term is(..) That's > why the category/tag/taxonomy name prefix is prepended. You could create a > rewrite so that _everything_ after /attractions/ is treated as a taxonomy > URL, but doing both gets a little tricky._ * * * ## Update #3 For anyone having the same issue, have a look at this discussion on WordPress Answers. Especially MikeSchinkel´s plugin code might help. Here´s an interesting example of WPCandy combining the taxonomy base and term in the URL: `http://wpcandy.com/pros/experienced/with-multisite`


get_template_directory_uri() and other URL tags not working in theme

So, I'm trying to add get_template_directory_uri or bloginfo() to my header.php file to create relative paths for the CSS and JS files in the theme. E.g.,                   <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/style.css">      In theory this should show                   <link rel="stylesheet" href="http://mysite.com/wp-content/themes/myTheme/css/style.css">      Problem is, when I view the `<head>` tag in source all I see is:                   <link rel="stylesheet" href="/css/style.css">      All the other template tags work in my files (get_permalink(), the_title(), etc.), but this one isn't. `echo get_bloginfo('url')` Also works. I was thinking of messing with the `wp-config.php` file and doing something like:               define('WP_HOME','http://example.com/blog');     define('WP_SITEURL','http://example.com/blog');      ...but, I'm not sure if that's the best practice for rewriting the URL. Am I missing something?


wp_mail and BCC headers

I'm using WP 3.3.1 I am trying to add BCC onto the headers of an email I'm sending out, but the BCC is not being added.               public $from = "sender@example.com";     public $replyTo = "sender@example.com";     public $bcc = "bccaddress@example.com";          $headers['From']    = "From: ".$this->from;            $headers['Reply-To'] = "Reply-To: ".$this->replyTo;     $headers['Bcc'] = "Bcc: ".$this->bcc;          wp_mail("example@example.com", "My Subject Line" , $html, $headers);      I've looked at this article, which says the problem was suppose to be fixed in WP 3.2...but for me, it's still not working. I am using a local SMTP server application called Papercut to monitor the emails that are being sent. **Related:** wp_mail not recognizing cc and bcc headers


Editing Wordpress Permissions in LAMP - Ubuntu 11.10

I'm hosting a local version of my wordpress theme on Ubuntu 11.10. However, LAMP is installed in a directory that requires sudo privileges. When I try to add images or any outside content to my theme, it fails because it cannot create a folder/write to a folder. How do I edit the permissions to allow Wordpress the access it needs?


How to process shortcode on post save and update only

Below is a simple shortcode I have so that in an article, I can simply link keywords to **tag taxonomy** pages in my site. So if I were to wrap the term `Web Service` like this `[taglink]Web Service[/taglink]` then the function below would replace the space with a `-` to make `Web- Service` which would be my **tag taxonomy** so I could then link to that page. **This...**   `[taglink]Web Service[/taglink]` **Becomes this...**   `<a href="/tag/web-service" title="Web Service tagged articles">Web Service</a>` **The code**               function taglink_func($atts, $tag='') {         $formattedTag = str_replace(' ', '-', $tag);         $formattedTag = strtolower($formattedTag);         return '' .$tag. '';     }     add_shortcode('taglink', 'taglink_func');      * * * This solkution works fairly well but to improve performance even more, I would like to run this function when I create a new article and when I edit and article, so basicly only when an article is saved, I would like to run this function on any tags in the article and then replace the `[taglink]Web Service[/taglink]` in the actual database with the result. So instead of running this on each page view, it will be ran on page save and simply replace the code in the database with the URL link. Does anyone know how I can do this?


Display sidebar that created in functions.php

I'm currently using Wordpress theme for my website. Decide to create my own sidebar, but the styling of it must be remain the same one as original sidebar. I'm had create a new sidebar in functions.php using register_sidebar. How my theme create sidebar was just `<?php get_sidebar(); ?>` nothing else. In my theme folder, there is not extra sidebar php file created. I'm try to use `<?php dynamic_sidebar( $index ); ?>` but it does not works for me. I just want to **add new widget to my second sidebar that I created and the style will be default.** **Functions.php**               if (function_exists('register_sidebar')) {     register_sidebar(array(     'name'=>'Sidebar-Aries',     'id' => 'sidebar-aries',     'description' =>'Display all the contents of sidebar at Aries page.',     'before_widget' => '',     'after_widget' => '',     'before_title' => '',     'after_title' => '',     ));     }      **Using dynamic sidebar,**               <?php dynamic_sidebar('sidebar-aries'); ?>


Extra richtext admin textfield for custom posttype with toolbar tabs?

I am trying to add an extra rich text input field (like so, http://wordpress.org/support/topic/how-can-i-use-the-tinymce-editor-for- fields-in-my-custom-post-type) So just by adding the class class="theEditor", brings up tiny mce for my extra textfield. So far so good, but 1/ how do i add the editor toolbar with the wysiwyg/HTML tabs for the newly created textfield? 2/ As i am using the plugin qTranslate i also like to add the language tabs Any tips? regards


Insights into WordPress Multi-Site, Domain Mapped, and Multilanguage site using WPML

I have a project with WordPress for a multi-language, multi-country site. I want to have a structure like:   * domain.com     * domain.com/es     * domain.com/de     * domain.com/fr   * domain.es     * domain.es/en   * domain.fr     * domain.fr/en   * domain.de     * domain.de/en I was wondering if anyone had any useful articles, tips or insights. The idea is that the .com site be the 'parent' site. The other satellite sites would be in their native language by default, but might have other languages available. Ideally, each individual satellite site could have some leeway to have styles/content that would be different than the parent site. I also want the parent site to use canonicalization, so that the 'satellite' (country-specific, top-level-domain) sites have priority. I guess I'm most curious to know about: Domain mapping and compatibility with WMPL Thanks


Using pre_get_posts with WP_Query

I was reading Stephen Harris's excellent answer to this question regarding the use of WP_query(), query_posts() and pre_get_posts. He says "pre_get_posts is a filter, for altering **any** query. It is most often used to alter only the 'main query'." It is possible to use pre_get_posts to filter **only** a specific secondary query created with WP_Query? eg.               $my_secondary_loop = new WP_Query(...);     if( $my_secondary_loop->have_posts() ):         while( $my_secondary_loop->have_posts() ): $my_secondary_loop->the_post();            //The secondary loop         endwhile;     endif;     wp_reset_postdata();      Any help much appreciated.


How To Remove The Author(s) From Certain Posts

There are certain posts on the website I'm developing, that don't need the author(s) by-line. (such as press releases) Is there any method, that allows me to remove the author (and co-authors) for certain posts?


What is generating my meta og:description?

My site has Facebook social graph meta tags in its page:               <meta property="og:title" content="First Look at Dwarves from The Hobbit"/>     <meta property="og:description" content="Movie"/>      The only Facebook-related plugin I have installed Facebook Page Publish. Why is it only picking up the category of the post? There are no options to configure the og meta tags of this plugin. **UPDATE** I now figure I can use the post excerpt as the value for og:description, but whenever I use either of these functions:   * get_the_excerpt();   * the_excerpt(); the page outputs the following code:               <!-- AddThis Button Begin -->     <script type="text/javascript">var addthis_product = 'wpp-261';     var addthis_config = {"data_track_clickback":true,"ui_508_compliant":true};</script>      <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4df74bc61d613ae9"></script>"/>      I then configured the AddThis Wordpress plugin to remove Add This from the post excerpt, but the same code is still spat out by the excerpt functions.


Post publish date

if I have more than one posts that publish in the same day, `the_date()` function does not print publish date. How can I fix it? thanks I solve this by: "`the_time(get_option('date_format'));`"


WordPress | Date not always appear

> **Possible Duplicate:**   >  WordPress the_date() not working I try to create a theme. In that theme I have create a custom post type and I quering the WordPress by using the wp_query to get the posts from that post type with the code that following :               $args = array(         'post_type'         =>  'portfolio',         'posts_per_page'    =>  18     );          $projects = new WP_Query($args);          while($projects->have_posts())     {         $projects->the_post();     ?>
<?php the_title(); ?>
     <?php the_date(); ?>     <?php     }          wp_reset_postdata();      the problem is, that while I get the title for all of my posts, I do not get the date for all of my posts. Some posts have the date, other they don't Any idea for that issue ?


Sort on meta value but include posts that don't have one

I've been modifying the built in WP search using the `pre_get_posts` filter, allowing the user to sort the posts (including a bunch of custom post types) by different fields. The problem I'm having though is that when I tell WP to sort by a meta value it will exclude all posts that don't have that meta value set. This causes the number of results to change if you change sorting from say "Price" to "Date" because "Posts" don't have "Price" set but "Items" do. This is not what I want, so I'd like to know if there's a way to include ALL posts - even those that lack the meta value I'm sorting on - and put the one's without the value last. I know how to sort on more than one field but that doesn't help. Thanks Seems I'm not the only one with this question: Way to include posts both with & without certain meta_key in args for wp_query? but there's no solution there. **Update** I've tried the answer but not sure if I understood correctly, here's what I have right now:               <?php     function my_stuff ($qry) {         $qry->set('meta_query', array(array(             'key' => 'item_price',              'value' => '',              'compare' => 'NOT EXISTS'         )));              $qry->set('orderby', 'meta_value date'); # Sorting works with meta_value as well as meta_value_num - I've tried both         $qry->set('order', 'ASC DESC');         $qry->set('meta_key', 'item_price');     }      The meta value is a number (it is used to store a price as the name suggests) **Update 2** I've commented out the order-stuff and all I have now is this:               <?php     $qry->set('meta_query', array(array(         'key' => 'item_price',          'value' => '',          'compare' => 'NOT EXISTS'     )));      With this code the query seems to return all posts that don't have the `item_price` key and none of the posts that have it. I.E. the problem is now reversed. If I add in the order-code as well I get 0 results.


When creating a WordPress page, a "-2" suffix is added to new pages' permalinks

I have noticed after deleting an original page in WordPress with lets say a permalink of `your_domain.com/contact/` and then trying to recreate the same page with the same name/slug, my WP is generating a " _-2_ " at the end of the link, like: `your_domain.com/contact-2/`. I don't understand why, since the original page was deleted. Why is WordPress treating new pages as if the original still exists? How to I clean WP caches, if such a thing even exists?   Thank you ahead of time for clearing this up for me.