title: Wordpress links/bookmarks - need to urlencode because spaces are getting stripped

text: Wordpress is stripping spaces out of links. For example putting this into the web address of a new link:               mailto:my@email.com?subject=Hello there      and saving results in this:               mailto:my@email.com?subject=Hellothere      I know that a space is `%20` but my clients can't be expected to use this. Plus they may be uploading PDFs/Word documents with spaces in the filename and copying and pasting the link. How can I remedy this? I know I have to use urlencode, however I don't really want to edit the core wordpress admin, because on upgrading I'll have to change it again. However, I will do if its the only way (having a look I can't seem to find a hook or anything that will let me do this!), but I just can't figure out where to put it. Thanks for any/all help you can give me.


title: Allowing WordPress.org/com accounts on a self-hosted install

text: Hopefully a basic question, but one that plagues me nonetheless. I have a couple of self-hosted WordPress installs on my website. An issue that I have is that I have common users registered for each site....however some of them feel its a pain to have to go through the signup process each time, and have to juggle multiple accounts in order to comment. Is it possible to commonize accounts, for instance simply using a WP.com/org account and accessing my blogs in that manner?


title: Automatically Display Sub Menu

text: To start... I am new to Wordpress and developing themes. I've got a main menu which I've placed in my header using the following code:               <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'topNav', 'after' => '<span> </span>' ) ); ?>      I've also defined my menu like so: ![Menu Definition](http://i.stack.imgur.com/PVQ7R.jpg) It works out as I desire (well, mostly): ![Page View](http://i.stack.imgur.com/1232W.jpg) Now, I want to display a sub menu in the white page content area below. The sub menu would display just like the main menu (ContentTopNavigation). So, if the menu were set up like (demonstration purposes only): ![Sub Menu Definition](http://i.stack.imgur.com/J7ZU2.jpg) And the STORE main menu item were selected, the STORE page would have a menu at the top which shows the 3 sub menu items. How do I make this relation ship automatic? Meaning, the sub menu for the page is automatically shown based on the top level menu item shown.


title: Menu Custom link - using relative link when WP is in a subdirectory

text: I tend to develop sites in a subdirectory, and I tend to use a fair amount of custom links in my menu ( the "Custom Links" option in the WP admin Appearance > Menus section) to display archive pages. I am constantly annoyed at the fact that a relative link entered there will not take the subdirectory into account. For example, I have WP is installed in domain.com/dev. I put a custom link "/events" in the menu, but it returns domain.com/events, which is 404, instead of properly returning domain.com/dev/events. How can I change this behavior?


title: What is true chmod for WordPress?

text: For all the folders and files. Please give some explained answer.


title: How to add an RSS logo to my blogs header?

text: I have started a new site (here), I want to add the theme a RSS icon/logo on the top right of the theme (like in this theme). What is the best way for doing that? (PHP/CSS wise)


title: Hosting the WordPress website on someone else's web URL

text: Its my first attempt at any sort of web development with WordPress or otherwise. I volunteered to create a website for an Organization with whom I am temporarily working for a project. I don't want to set up the website at my end and forward the files to them (we are in different cities), since updating the web pages later on may be a hassle for me (I guess). My question, how do I achieve the following with WordPress- I keep the files at my end and host the website at a server at my end, at (say) `the-ip-address/wordpress`. But the URL of the website remains what that Organization wants it to be, say, `wwww.their-homepage/several/sub- directories/wordpress`. What all will my colleagues at the other end need to do to allow this re- direction?


title: Help me tidy up my widget code

text:
I'm a newbie in WordPress and PHP. I created a small widget to embed video's from YouTube or other video hosting. Everything works fine. I know I have messy code, therefore I would appreciate it if someone is able to tidy up my code. This is my code:               <?php     /**      * Plugin Name: Widget Name      * Author: Author Name      * Author URI: Site URL      */          class Today_video extends WP_Widget {              /**          * Widget setup.          */         function Today_video() {             /* Widget settings. */             $widget_ops = array( 'classname' => 'tm_widget_today_video', 'description' => __('Display today video on your site', 'today_video') );                  /* Widget control settings. */             $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'today_video' );                  /* Create the widget. */             $this->WP_Widget( 'today_video' , __( 'Today Video' , 'today_video' ), $widget_ops );         }              /**          * The frontend function          */         function widget( $args, $instance ) {             extract( $args );                  /* Our variables from the widget settings. */             if(isset($instance))             {                 if( isset( $instance[ 'title' ] ) ) {                     $title = apply_filters( 'widget_title', $instance[ 'title' ] );                 }                      if( isset( $instance[ 'template' ] ) ) {                     $template = htmlspecialchars_decode( $instance[ 'template' ] );                 }             }                  /* Before widget (defined by themes). */             if( isset( $before_widget ) ) {             echo $before_widget;             }                  /* Display the widget title if one was input (before and after defined by themes). */             if( isset( $title ) ) {              echo $before_title . $title . $after_title;              }                  /* Display the widget video */             if( isset( $template ) ) {              echo '
 '.$template.'
';             }                  /* After widget (defined by themes). */             echo $after_widget;              }                   /**          * Backend widget settings          */         function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  /* Strip tags for title and name to remove HTML (important for text inputs). */             $instance['title'] =            strip_tags( $new_instance['title'] );                  // htmlspecialchars to save html markup in database, at frontend we use htmlspecialchars_decode             $instance['template'] =         htmlspecialchars($new_instance['template']);                  return $instance;         }              /**          * Displays the widget settings controls on the widget panel.          *          * Backend widget options form          */         function form( $instance ) {             $defaults = array(                  'title' => __(  'Today Video', 'today_video'),                                  'template' => __('', 'today_video'),                             );                  $instance = wp_parse_args( (array) $instance, $defaults ); ?>
                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'hybrid'); ?>                 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:96%;" />

                 <label for="<?php echo $this->get_field_id( 'template' ); ?>"><?php _e('Embed Code:', 'hybrid'); ?>                 <textarea id="<?php echo $this->get_field_id( 'template' ); ?>" name="<?php echo $this->get_field_name( 'template' ); ?>"  style="width:100%;height:100px;"><?php echo $instance['template']; ?></textarea>
              <?php         }     } //Add function to widgets_init that'll load today_video     add_action( 'widgets_init', create_function( '', 'register_widget( "Today_video" );' ) );     ?>      Thank you.


title: Displaying the Name of the Queried Taxonomy Term on a Term Archive Page?

text: _( **Moderator's note:** post was originally entitled "Taxonomy.php title")_ How can I display the _"Posts classified under:"_ title for the `taxonomy.php` page? For example, this code is used in `tag.php`:               printf( __( 'Tag Archives: %s', 'twentyten' ),         '<span>' . single_tag_title( '', false ) . '</span>' );


title: Get the terms of a custom taxonomy for a specific author in author template

text: I am using a custom post type in my website and a custom taxonomy for it. An author selects one or many terms before publishsing its post. My goal is to display authors pages in front end, so I am using `author.php` template file. This file is by default displaying the archive of posts written by the specific author. How can I add to this file the list of the custom taxonomy terms for the author published posts? I give the following example if I wasn't clear in my explanation:               if Author-x has published:          **post1** with term1 , term2, term3     **post2** with term2, term5     **post3** with term1               then, in Author-x page I will have : term1, term2, term3, term5.      It is exactly the same principle as in user page in stack exchange. As you can see, there is a list of tags for each user which are tags of posts the user contributed in. Thank you for your usual help.


title: Hooking into add_submenu_page

text: Ever come across a plugin that is using the `manage_options` capability for a page that... really doesn't need to be? Well, I've come across just that. This may be more of a general question about hooking into `add_submenu_page`, so not just specific to my use-case. I looked at `add_dashboard_page` which is simply a wrapper for `add_submenu_page`:               function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {         global $submenu;         global $menu;         global $_wp_real_parent_file;         global $_wp_submenu_nopriv;         global $_registered_pages;         global $_parent_pages;              $menu_slug = plugin_basename( $menu_slug );         $parent_slug = plugin_basename( $parent_slug);              if ( isset( $_wp_real_parent_file[$parent_slug] ) )             $parent_slug = $_wp_real_parent_file[$parent_slug];              if ( !current_user_can( $capability ) ) {             $_wp_submenu_nopriv[$parent_slug][$menu_slug] = true;             return false;         }              // If the parent doesn't already have a submenu, add a link to the parent         // as the first item in the submenu. If the submenu file is the same as the         // parent file someone is trying to link back to the parent manually. In         // this case, don't automatically add a link back to avoid duplication.         if (!isset( $submenu[$parent_slug] ) && $menu_slug != $parent_slug ) {             foreach ( (array)$menu as $parent_menu ) {                 if ( $parent_menu[2] == $parent_slug && current_user_can( $parent_menu[1] ) )                     $submenu[$parent_slug][] = $parent_menu;             }         }              $submenu[$parent_slug][] = array ( $menu_title, $capability, $menu_slug, $page_title );              $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug);         if (!empty ( $function ) && !empty ( $hookname ))             add_action( $hookname, $function );              $_registered_pages[$hookname] = true;         // backwards-compatibility for plugins using add_management page. See wp-admin/admin.php for redirect from edit.php to tools.php         if ( 'tools.php' == $parent_slug )             $_registered_pages[get_plugin_page_hookname( $menu_slug, 'edit.php')] = true;              // No parent as top level         $_parent_pages[$menu_slug] = $parent_slug;              return $hookname;     }      It honestly doesn't look like there's anything I can actually plug into with an existing dashboard page to change the capability. So I'm trying to decide if I'm better off using `remove_submenu_page` and then attempt to redeclare that same submenu. I know there will be things I need to look out for (if the display function used for the page has anything that is additionally checking for the capability or displaying anything vital to the site). Always helpful to have a second pair of eyes on these so I don't over complicate things. Thanks all! # Update Thanks to both @toscho and @userabuser here's what I got:               function wpse_71303_change_menu_cap()     {         global $submenu;         foreach ($submenu['index.php'] as $dashboard => $key) {             if ($key[0] == 'Analytics360°') {                 $submenu['index.php'][$dashboard][1] = 'analytics';             }         }     }     add_action( 'admin_head', 'wpse_71303_change_menu_cap' );      If I run a `print_r($submenu) I do see the new capability - but I still can't access the menu item under the client role I created (with the`analytics_360` capability) (used the Members plugin to create). Possibly firing too late? Definitely a bit odd. Thanks as always! **The code from _Update_ works for anyone that comes across this. It was an unneeded check around `add_dashboard_page()` giving me the issue.**


title: numberposts not showing specific number

text: I'm using List Category Posts plugin to show up the specific posts from a category on a page. It works well, but if I'm trying to reduce the number of my latest posts to 3, for example this way:               [catlist id=13 numberposts=3]      It shows up all the posts from that category. Am I doing somwthing wrong?


title: How to enable WPML in BuddyPress Multilingual Plugin in a single website?

text: There is a plugin called BuddyPress Multilingual version 1.4.0. I installed this plugin in wordpress. But I can't see it anywhere in the admin panel nor in plugins. There is very little documentation else where on the website. **Where are the options for that plugin?** If this is a broken plugin then **what is the alternative to implement multilingual option?** I prefer to make a blog in wordpress which can support multilanguages. It's better if a plugin is able to translate the post or page after selecting a language on the wordpress editor.


title: Changing search terms results a 403 - dsIDXpress Pro plugin

text: I face an issue with the dsIDXpress Pro SEARCH. Everytime I try to change the search terms the site gives a 403 error. http://lagunaagent.com/idx/city/laguna-niguel/ From the error.log               [Wed Nov 07 10:51:30 2012] [warn] [client ******.46] mod_fcgid: stderr: PHP Warning:  Cannot modify header information - headers already sent by (output started at [****]/httpdocs/wp-includes/class.wp-styles.php:92) in [****]/wp-content/plugins/dsidxpress/client.php on line 407, referer: http://lagunaagent.com/idx/city/laguna-niguel/?idx-q-BedsMin=4&idx-q-ImprovedSqFtMin=2500&idx-q-PropertyTypes=545      `/dsidxpress/client.php` line 407 :                   // track the detail & result views, do this at the end in case something errors or w/e         $views = intval(@$_COOKIE["dsidx-visitor-$action-views"]);         setcookie("dsidx-visitor-$action-views", $views + 1, time()+60*60*24*30, '/');              if (isset($seo_keywords) || isset($seo_description) || isset($seo_title)) {             $dsidxpress_seo = new dsidxpress_seo($seo_title, $seo_description, $seo_keywords);             add_action('wp_head', array($dsidxpress_seo, 'dsidxpress_head_action'));             add_filter('wp_title', array($dsidxpress_seo, 'dsidxpress_title_filter'));         }      Could you kindly point me if it's something server related??? I have already done some troubleshooting changing theme (twenty eleven) and switching on/off plugins with no results.


title: How to prevent automatic redirection?

text: Wordpress has a feature whereby it will automatically redirect your URLs if it percieves them to be written wrongly. Here is an example: I have a page called `my-page` If I go to:               www.mysite.com/something/my-page/      it will immediately redirect me to               www.mysite.com/my-page/      as nothing exists at the first URL. How can I turn this feature off, and instead just get a 404 if incorrect URL's are typed in?


How i can get blog info using site url in multi-site for eg : if i give the site url as `http://a.somename.com` and this should return me the value like Site Name Site Tag line Site Database Table Prefix **Used Code**               $blog_id = get_blog_id_from_url("http://192.168.0.89/dev/sareepuram/ss/");     echo get_blog_option( $blog_id, 'blogname' );     echo get_blog_option( $blog_id, 'blogdescription' );      If i use the above code i get the details for the below link               http://192.168.0.89/dev/sareepuram/      I use wordpress multi-site The below link is the main site               http://192.168.0.89/dev/sareepuram/      And this link is the sub site `http://192.168.0.89/dev/sareepuram/ss/` **My Code Page Looks Like Below**               <?php     define('WP_USE_THEMES', false);     require('wp-load.php');          $blog_id = get_blog_id_from_url("http://192.168.0.89/dev/sareepuram/ss/");     echo get_blog_option( $blog_id, 'blogname' );     echo get_blog_option( $blog_id, 'blogdescription' );          ?>


title: Getting posts by taxonomy

text: I want to get a set of posts from a CPT based on a taxonomy term being present. I thought I'd use WP's get_posts() function: > $results = get_posts(array $options); This function works fine when I specify the CPT i'm interested in: > $results = get_posts( array('post_type' => 'my_cpt_name') ); But then I tried this with my UOM custom post type and tried to filter on the metric system which is a taxonomy called "uom_system": > $results = get_posts( array('post_type' => 'uoms', 'uom_system' => 'metric- > system' ); Sadly, the taxonomy section gets ignored and I get the full list of posts in the UOM posts table. What am I doing wrong?


title: Theme seems to have different options on wordpress.com and own-server install

text: I am trying to transfer a blog from wordpress.com to my own server. The site on wordpress.com uses the Origin theme, with a custom header image set. I have installed that theme on Wordpress on my own server, but I don't seem to have the option to select a header image. If I look at the options under Appearance, on my own site they are:   * Themes   * Widgets   * Menus   * Background   * Theme Settings   * Editor (and there is nothing under Theme Settings about a header image) but on wordpress.com the options are:   * Themes   * Widgets   * Menus   * Header   * Background   * Custom Design   * Mobile Is there any way for me to get the Header options (including the Header Image setting) for my own personal install? Alternatively, is there a simple way to edit the theme code to fix a header image in there? I would look at the theme code on wordpress.com, but of course there isn't an option to edit it there.


title: rewriting search-permalink with htaccess - search results are are "opened" automatically?

text: when typing "a" into my search field (/?s=a) I my `search.php` template is loaded and all results that match that letter are shown. If I add this to my .htacess …               RewriteCond %{REQUEST_URI} ^/$     RewriteCond %{QUERY_STRING} ^s=(.+)$     RewriteRule .* /searchmyblog/%1/? [R,L]      and then type "a" into my search the first result of my search is shown. So there is no `search.php` template shown with all the results but rather the page is redirected to "mypage.com/somecategory/amore-mio" Why is that happening? I simply want to rewrite the normal `/?s=` to `/search/` or any other custom url. Any ideas on that? I found heaps of posts online, but none of them seem to be state of the art or use some weird JS-hacks that I find unnecessary. Ideas on that?


title: Limit Contact Form 7 hook to specific form

text: I'm using a Contact Form 7 filter to take action after the email is sent. How can I limit this action to only one form? There are multiple forms on different pages, and I don't want this action to run after every form, only one specific form. I tried limiting the action to the page where the form is using an if clause, but then the "action" doesn't complete. Once I remove the if clause, then the action works.               function foo() {             if(is_page('bar') {               // some action         }     }     add_action( 'wpcf7_mail_sent', 'foo', 1 );


title: How to show list authors with at least five posts published

text: i'm wondering if there is a way to use wp_list_authors to list only the authors with at least five (or even more, but anyway more than just one or two) published post in the blog. Actually I don't see any "arg" to do that. Thanks Bye Carletto


title: Exclude uploaded files from appearing in the excerpt()

text: In a post I have some text and some media attachments and when I use the_excerpt(), it strips all the anchor tags from the attachments and shows just their file names and its causing me problems as some of the filenames are really long. Is there a way of excluding media attachment content from the_excerpt()? If not, is there a way to show the anchor tags when using the_excerpt() that wont leave unclosed tags and what not?


title: Common single page template options

text: I am developing a common theme for 25 websites, the default requirements are done. Each site has got different single post template. I need to group it as a single theme so i don't need to hard-code every time and maintain a common platform. The various single posts template are normal-blog / tab structure / List view I am now creating an option page for my theme, so that the user can create a layout on his own for the single-page without hardcoding(options might be drag and drop). I need to create certain components like tab,sidebar, list, and save templates for different categories. the values in tabs could be from a custom field,taxonomy. user can create n no of templates for various categories/tags/taxonomy and save it. For Eg: Template 1 for category sports,education. I trying to do it but i don't have any clue to it, might be the theme atuhalpa came close. how to solve it.


title: how to use Easy Docs theme to write a book?

text: I installed this theme http://shakenandstirredweb.com/theme/easy-docs but I don't understand how it works: after install I have only page menu, post menu has disappeared. Page only appears as menu not as content. So how does it work ?


title: Restore Image Title Text

text: In WordPress 3.5, when images are inserted into posts, the title attribute is not included in the image tag. The Lightbox plugin I am using requires the title tag to be present on images; besides, I like having a hover tool-tip. Is there some way to restore the previous behaviour of including the title attribute?


title: Saving fields in a drop-down in Wordpress

text: Below is code that successfully displays a drop-down menu of page templates in my Wordpress theme. I'm using this menu in a custom post type, and don't quite understand how to label it in order to make it save the chosen value after the user "updates". The value is, in fact, being saved to the database and displaying correctly to the table, it's just not maintaining the chosen value after update. I've seen some other examples of this, but my drop-down is based on a PHP function all in one line. Any suggestions would be great appreciated.               <?php _e('Page Template') ?>          <select name="page_template" id="page_template">          <option value='page_template'><?php _e('Default Template'); ?></option>     <?php page_template_dropdown($template); ?>     </select>      HERE IS THE UPDATED CALLBACK FUNCTION THAT IS SUPPOSED TO DISPLAY THE DROPDOWN:                // The Callback for Page Template Assignmets Metabox      function pagetemplate() {      global $post;      // Noncename needed to verify where the data originated      echo '<input type="hidden" name="pagetemplatemeta_noncename" id="pagetemplate_noncename" value="' .      wp_create_nonce( plugin_basename(__FILE__) ) . '" />';      // Get the title data if its already been entered      ?>     <?php _e('Page Template') ?>      <select name="page_template" id="page_template">      <option value='default'><?php _e('Default Template'); ?></option>      <?php template_dropdown($template); ?>      </select>           <?php          }                //Creates the page template dropdown menu display and functionality     function template_dropdown( $default = '' ) {      $templates = get_page_templates();      ksort( $templates );      foreach (array_keys( $templates ) as $template )          : if ( $default == $templates[$template] )              $selected = " selected='selected'";          else              $selected = '';      echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";      endforeach;      }


title: Make custom post type display as a page

text: I am trying to make my custom post type display on the front end as if it were a page. Depending on the theme, it won't have the date, author, etc... I've looked into creating a template such as 'single-<CPT>.php'. But that's too static to work for any theme design. Is it possible to somehow tell the current theme to display the custom post type in the same way it would display a normal page. Thanks!


title: How do I remove certain HTML elements with specific classes from the feed?

text:
What filters can I use to remove specific HTML elements with certain classes from the Wordpress feed? _Not remove everything inside the element_ , mind you, **but just remove the markup itself**. For example:

Yada yada bla bla whatever dummy text

      The result should be:
Yada yada bla bla whatever dummy text
           Why? We have a syndication agreement with a big web portal. They will get articles from our feed and automatically put it in their CMS. The problem is that I've used shortcodes to allow varied multi-column layouts, which won't work properly because the CSS I defined for the layouting is of course not available on the web portal. The shortcodes resolve into divs with specific classes attached to them. The trick is of course removing the trailing elements for those that have opening and closing tags, without touching the content wrapped inside. Thus I'm not sure if Regex is the best (and most efficient) approach here.


title: Capability to prevent upload of files

text: I need the ability to allow users to insert media (images) into a page / post, but not allow them to upload the files. The only capability I can see is 'upload_files', which allows a user to upload / insert files. Is there a way to prevent upload of files but still show the media manager (via the 'Insert Media' button on the Edit screen) allowing users to insert the images? My thought of how to approach this would be via jQuery - run a script when the capability is something like 'my_insert_media', which would hide the 'Upload' tab of the media uploader. Of course this could be worked around by disabling Javascript in the browser, but that's not a major concern for this project. Any other suggestions, or holes in this approach? Thanks, Dan


title: Plugin: Relative URL to images in another folder accessed inside a JS file

text: I have this Wordpress plugin file structure with "myfolder" as the main folder. There is another subfolder inside this main folder named as "resources". Inside this resources folder contains two subfolders: a) JS b.) images Inside images folder I have one image "myimage.png". Inside JS file, I have a script named "myscript.js". I would like to access the image "myimage.png" in images folder inside my javascript file "myscript.js". I have tried the following but it does not work(does not resolve):                                              Of course the absolute URL path works but I want this application to work with other sites so coding the absolute URL path is not a feasible solution. I know that Wordpress also has this magic function:               $myicons= plugins_url('resources/images/myimage.png', __FILE__ );      But that will work only inside the PHP plugin file and I'm accessing the image inside a JS file. Any ideas how to make this work without rearranging the current file structure? Is there a JS function equivalent of "plugins_url" in Wordpress? Thanks for any tips.


title: Pagination of RSS2 feed

text: How to have pagination of RSS2 feed ? My current RSS link is similar to :               http://www.example.com/?feed=rss2      I tried:               http://www.example.com/?feed=rss2&page=2      But WordPress still returns me with same set of result, given that I set 10 posts per page in > Dashboard > Settings > Reading > Syndication feeds show the most recent (of course I have more than 10 posts)


title: Refresh loop of custom posts (div) after new post is published

text: **GOAL** Wondering if following should be done, I would like to (ajax?) refresh not necessary only (custom) post type loop or div example custom post query :               <div class="refreshed posts">     <?php          global $post;          $myposts = get_posts('post_type=employer&numberposts=5&orderby=modified&offset=0');          foreach($myposts as $post) :          setup_postdata($post);          ?>     </div>      **CONCLUSION** Auto refresh posts can help my website users to see that when for example somebody submits a post type employer entry, at the same moment all online users can see all updated "employer" posts including that one submitted post. I would like to avoid using plugins. In the similar manner uses facebook etc their notifications (I believe they scheduled to refresh in minute intervals)


title: Auto Select Child categories on Multiple Dropdown - Jquery

text: I am using the wp_dropdown_categories to generate the form and select option, with multiple select jquery plugin. What I want is that, when the user selects the Parent category or (level-1) then the child categories (level-2 or level-3) should be auto selected. Since there is no grouping, can this be done by Jquery? Following is the html code.               <optgroup  label="Categories">     <option class="level-1" value="519">Parent 1</option>         <option class="level-2" value="521">Parent 1 child 1</option>         <option class="level-2" value="522">Parent 1 Child 2</option>             <option class="level-3" value="523">1st Sub Child of 2</option>             <option class="level-3" value="524">2nd Sub Child of 2</option>     <option class="level-1" value="519">Parent 2</option>             <option class="level-2" value="525">Parent 2 Child 1</option>             <option class="level-2" value="526">Parent 2 Child 2</option>             <option class="level-2" value="527">Parent 2 Child 3</option>     </optgroup>


title: Changing status of Published posts which have less Content to "Draft"

text: function draftpost(){         global $wpdb;         $prefix = $wpdb->prefix;         $wpdb->query("UPDATE ".$prefix."posts SET post_status='draft' WHERE LENGTH( post_content ) <500");     }     add_action('publish_post', 'draftpost');      This code is working Fine for changing Published Items to Draft. Issue is that this code removes my Custom Menu and make all Items in Menu to PENDING. How can I solve this?


title: Problem with caching, W3TC

text: Am using W3TC from a long time but from past few weeks am stuck, as I can't see my edits working. It was all fine in past but from a week my edits in style.css reflects back in like an hour after. http://i.imgur.com/f3LwQ.png http://i.imgur.com/rzydS.png http://i.imgur.com/bMffA.png http://i.imgur.com/XWniN.png http://i.imgur.com/6cpnf.png http://i.imgur.com/pBN0X.png http://i.imgur.com/ZrJsP.png http://i.imgur.com/4RaSj.png http://i.imgur.com/B6w3o.png


title: Including a JS source with an admin page

text: The administration part for my plugin is divided into several pages and for some pages I would like to enqueue a JS source which would add jQuery functionality to various elements. Right now this is my approach:               function admin_register_init() {           if ($_GET['page'] == 'worldexplorer_admin_location_hub')       wp_enqueue_script('worldexplorer_admin_hub', WP_PLUGIN_URL.'/worldexplorer/admin/admin_hub.js');     }     add_action('admin_init', 'admin_register_init');      However, this requires me to check the page index of the $_GET array. Is there another way to achieve what I wish to do?


title: Adding a media image without generating thumbnails

text: I'm not sure whether my request is insane or legitimate, but I would like to control how my images are stored in Wordpress, avoiding that for each of them a set of thumbnails is created. Is this feasible? How can I specify the path where images are saved? Thanks


title: List upcoming events, ordered by date in a custom field

text: I want to display a list of events with dates in upcoming order. Ex:   *     1. 23 March, 2013,    *     1. 30 March, 2013 Below is the query I'm using to filter out posts from my database:               query_posts(          'post_type=myevents&meta_key=_datepicker&orderby=meta_value&order=ASC&showposts=20'     );      But this doesn't work. I get my events listed in following order:   * 07 April, 2013,    * 18 April, 2013,    * 19 June, 2013,    * 20 October, 2013,    * 23 March 2013,    * 24 March 2013 Events happening in March are listed at last. There is no order at the start too. I'm using a custom field to store event date and the date format is `23-Mar-2013`, but I show the front end dates in the format `23 March 2013`. How can I get the correct order?


title: Get all content on a "single page" site depending on language

text: I'm developing a "single page" WordPress based site that has content in multiple languages (using the plug-in WPML) and I need to retrieve it in a more efficient manner to avoid slow page load time.      An example of the code that I'm currently using -               $query = new WP_Query();     $query->query( array( 'post_type' => 'any', 'orderby' => 'id', 'order' => 'ASC' ) );          while ( $query->have_posts() ) {         $query->the_post();              // Gather the content for the first section of the page         if( $post->ID == 100 ) {             $firstSection .= get_content();         }              // Gather next content section etc...          }      Essentially, what I'm doing right now is looping through all posts looking for a specific ID, for which I then retrieve content tied to a certain part of the page. As you may understand, this gets quite messy after a while, having to create an if statement for each section content for each language. I have around 20 statements inside the while loop currently and I'm sure there is a better way to retrieve the data. Any ideas?


title: Allow editors to post iframes

text: I just found out that editors are not allows to post iframes (e.g. YouTube videos). Is it possible to allow it somehow? I use WP Multisite.


title: How to remove_filter that filters iframes in posts?

text: Which filter if removed allows iframes to be inserted into wordpress posts?


title: How can I control an external php (with external database) page with WordPress?

text: I need to control an external page designed and developed in php that takes values from an external database. What I actually need is to edit and change some hardcoded content of the page with wordpress. How can this be done?? Any sugestions?


title: Custom Post Types relationships

text: I have a custom post type for my videos. I need do related it with other post category. And i have 10 category Like this :               Post Category - Video Category     Tech            Tech     Marketing       Marketing     News            News     .....................      I want to do for this. I have a post Category Tech and I have custom post type Category(Taxonomy) Tech.. When I currently viewing Tech (Post) Category, How can i list (on sidebar) Tech videos?


title: Fatal error in comments.php

text: I am using customized theme for my development. The site was working fine and in last few days started seeing this error > Fatal error: Call to a member function is_singular() on a non-object in > /home/content/29/11116929/html/studyus/wp-includes/comment.php on line 2399 The error is on line 2399 which is               if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) )     return $posts;      comments.php is wordpress file and we have not changed anything. This is what I have done so far a) upgraded to latest version 3.9.1 b) disabled all plugins c) checked comments.php in my theme's file, reverted to base version and still same issues. This is my site and this is where search query is being executed


title: Adding labels to Setting titles with API

text: If I add a setting using `add_settings_field()`, it doesn't create a `<label>` around the title so that it can be clicked to focus on the field. Some of the core settings do this, but they just add it in the raw HTML rather than using the settings API. Is there any way to add labels with the settings API?


title: Init hook for header send

text: I am working on a checkout proces where if I submit the checkout I get an error "headers already send" because I use a PHP header() function to send the customer to my payment provider url. My idea is now to put the checkout code in a Wordpress 'init' hook, do you think this will resolve the problem? This is the handling code:               // Include Mollie     include "initialize.php";          if( isset( $_POST['submit'] ) ) {              $order_id = time();              // Create payment         $payment = $mollie->payments->create( array(             'amount'        => $data['price'] * ( $vat + 1 ),             'description'   => __( 'Splashback order' ),             'method'        => $_POST['sbg_payment'],             'redirectUrl'   => site_url( '/success/?order_id=' . $order_id ),             'metadata'      => array(                 'order_id'  => $order_id,             ),         ));               // Json product composition         $composition = json_encode( $data );              // Check fields and json         $fields = array(             'name'      => array( 'req' => false ),              'street'    => array( 'req' => false ),              'number'    => array( 'req' => false ),              'zipcode'   => array( 'req' => false ),              'city'      => array( 'req' => false ),              'country'   => array( 'req' => false ),              'email'     => array( 'req' => false ),             'phone'     => array( 'req' => true ),             'payment'   => array( 'req' => false ),         );              foreach( $fields as $key => $val ) {             if( isset( $_POST['sbg_' . $key] ) ) {                 if( $val['req'] === false ) {                     if( empty( $_POST['sbg_' . $key] ) ) {                         $errors = true;                     } else {                         $customer[$key] = $_POST['sbg_' . $key];                         }                 } else {                     $customer[$key] = $_POST['sbg_' . $key];                     }             }         }      I have tried to make a function in the init hook of the piece below, but cannot get it work, because I give some arguments to the function to fill the variables I get errors for all the empty variables. Can anyone help me with this?                   if( ! $errors ) {                  // Json customer details             $customer = json_encode( $customer );                  // Insert transaction to database             $wpdb->insert( $wpdb->prefix . 'mollie_transactions',                 array(                     'transaction_id'        => $payment->id,                     'order_id'              => $order_id,                     'amount'                => $data['price'] * ( $vat + 1 ),                     'composition'           => $composition,                     'customer_details'      => $customer,                     'date'                  => current_time( 'mysql' ),                      'status'                => __( 'Progress' ),                 )             );                  // Redirect             header( "Location: " . $payment->getPaymentUrl() );              }          }


title: Where to add the permalink in this function?

text:
Below is a function that displays the latest 4 approved comments on my homepage, I wrote this almost a year ago, and for the life of me, it's gone completely from my head, All i want to do is add a permalink to where the comment is located. How do I, and where do I add this?               function showLatestComments() {       global $wpdb;         $sql = "        SELECT DISTINCT comment_post_ID, comment_author, comment_date_gmt, comment_approved, SUBSTRING(comment_content,1,100) AS com_excerpt         FROM $wpdb->comments         WHERE comment_approved = '1'        ORDER BY comment_date_gmt DESC         LIMIT 4";        $comments = $wpdb->get_results($sql);        $output .= '
Latest student perspectives

';        foreach ($comments as $comment) {         $output .= '
'. $comment->comment_author . ' said : "' . strip_tags($comment->com_excerpt). '..."
';        }      $output .= '
';        echo $output;       }          //end function


title: Ordering a mysql style datetime stamp with meta_query

text: I have a custom post type field that I am storing data in called football_game_datetime. Example format and values for this field are examples like: "2013-10-31 14:00:00", "2013-09-16 20:00:00", "2013-09-30 22:00:00". The code I am using is the following, but it isn't doing what I thought it should be doing:               $mypost =     array(         'post_type' => 'football_games',         'meta_query' => array(                array(                     'order'=>'DESC',                     'orderby' => 'meta_value_num',                     'meta_key' => 'football_game_datetime'                )         )     );     $loop = new WP_Query( $mypost );


title: MediaElement audio tag not visible

text: Audio tag works normally if I include it in the page. Like this:               [audio src="URL_TO_MP3_FILE"]      Than another case: I'm trying to make an "audio player" with window.open. I needed two days to do that right and to bypass popup blockers, but just when I achieved that, audio shortcode stopped working. During this two days it was working and it still works on other areas of my website... just not in this popup. I checked the popup html with "view page source":               <audio class="wp-audio-shortcode" id="audio-4-1" autoplay="on"         preload="none" style="width: 100%; visibility: hidden;" controls="controls">         <source type="audio/mpeg" src="[URL_TO_MP3_FILE]?_=1">                      [AGAIN_THE_SAME_URL_TO_MP3_FILE]              </audio>      It for sure looks weird, but I'm not the one to question that. I added this to the popup "page".                     If I check the page source now it looks like the visibility is set to visible, but still I don't see the player.               <audio class="wp-audio-shortcode" id="audio-4-1" autoplay="on"         preload="none" style="width: 100%; visibility: visible; display: block;"         controls="controls">         <source type="audio/mpeg" src="[URL_TO_MP3_FILE]?_=1">                      [AGAIN_THE_SAME_URL_TO_MP3_FILE]              </audio>      Pure pain. I read all this but still I have no solution: http://codex.wordpress.org/Audio_Shortcode http://wordpress.org/support/topic/audio-embed-shortcode-not-working-ver-222 http://wordpress.org/support/topic/audio-player-not-showing-1


title: Wishlist Content

text: I am using the Wishlist plugin for my membership site. My content is divided into 12 modules corresponding to 12 months. When a member upgrades from one level to the next,he has access to current Level plus the previous Level(s) content, so for example if he is on Level 2 he has access to Level 2 plus Level 1 content;if on Level 3 he has access to Level 3 plus Level 2 plus Level 1 content and so on... The problem is that each membership level can see the content from the Level that they are currently on which is all okay with Level 1 but as a member moves on to the next Level, say Level 2, he can only "see" Level 2 content. What I want to do is to somehow show the Level 2 content when the member is logged in to that Level as well as the Level 1 content; I would like to do the same for all the other Levels. Also I would like to highlight the "old" content in some way from the current content. Is there any way out? Can someone help me with this?


title: display specific term based on custom post type in custom taxonomy metabox

text: I am using a custom taxonomy 'Categories' for more than one custom post types. While adding/editing a post in one of the custom post type, I want to show only specific TERMS under custom taxonomy 'Categories' metabox based on that custom post type.


title: How to keep theme layout the same when admin gray bar is present?

text: When I am logged in, there is a gray admin bar on top. My theme layout got distorted by the bar. How to solve the layout problem? Is there a function that can detect user is logged in or not, or use CSS can solve the problem ? The theme demo is at: http://raptor.hk/dev/theme and below is the screenshot when the gray bar is there. p.s. I use `WordPress 3.2.1` & plugin `Theme Test Drive` ![when the gray bar is present...](http://i.stack.imgur.com/Ew9dD.png)


title: Wordpress multisite in subdirectory, not root, and remove base folder from url

text: I might be misreading but I can't find a solution to the following need: I want to install Wordpress in a subfolder of my `www` directory, let's say `www/wp`. I then want to add two blogs to the multisite network called `foo` and `bar`. When I do so, they end up with the URL:               http://mysite.com/wp/foo     http://mysite.com/wp/bar      I would instead like them to be located at:               http://mysite.com/foo     http://mysite.com/bar      _But_ I do _not_ want a WP site running at the home/root:               http://mysite.com/      because I will be running a different application there (otherwise I would just install WP att the root and be done) with it! How do I configure this?


title: Using pagination with get_posts on page type

text:
Is there a way to use pagination on a page query like with posts? Here is the code I'm using:                   $listingPages = get_posts(          array(         'cild_of' => '7',             'meta_key' => 'Type',             'post_type' => 'page',             'post_status' => 'publish',             'orderby' => 'meta_value',             'order' => 'ASC',         'posts_per_page' => '20',         'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),         )     );      I can add /page/2 /page/3/ and etc to the URL and see the next set of 20 however when I add in my pagination code nothing shows up.               <?php wpbeginner_numeric_posts_nav(); ?>      Here is the function.php part of this:               function wpbeginner_numeric_posts_nav() {          if( is_singular() )         return;     global $wp_query;          /** Stop execution if there's only 1 page */     if( $wp_query->max_num_pages <= 1 )         return;     $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;     $max   = intval( $wp_query->max_num_pages );          /** Add current page to the array */     if ( $paged >= 1 )         $links[] = $paged;          /** Add the pages around the current page to the array */     if ( $paged >= 3 ) {         $links[] = $paged - 1;         $links[] = $paged - 2;     }          if ( ( $paged + 2 ) <= $max ) {         $links[] = $paged + 2;         $links[] = $paged + 1;     }     echo '

' . "\n";          /** Previous Post Link */     if ( get_previous_posts_link() )         printf( '
%s
' . "\n", get_previous_posts_link() );          /** Link to first page, plus ellipses if necessary */     if ( ! in_array( 1, $links ) ) {         $class = 1 == $paged ? ' class="active"' : '';         printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );         if ( ! in_array( 2, $links ) )             echo '
…
';     }          /** Link to current page, plus 2 pages in either direction if necessary */     sort( $links );     foreach ( (array) $links as $link ) {         $class = $paged == $link ? ' class="active"' : '';         printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );     }          /** Link to last page, plus ellipses if necessary */     if ( ! in_array( $max, $links ) ) {         if ( ! in_array( $max - 1, $links ) )             echo '
…
' . "\n";         $class = $paged == $max ? ' class="active"' : '';         printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );     }          /** Next Post Link */     if ( get_next_posts_link() )         printf( '
%s
' . "\n", get_next_posts_link() );     echo '

' . "\n";      }


Hello I don't know how but now I am getting this error > Notice: wp_enqueue_style was called incorrectly. Scripts and styles should > not be registered or enqueued until the wp_enqueue_scripts, > admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging > in WordPress for more information. (This message was added in version 3.3.) > in wp-includes/functions.php on line 3049 > > Notice: wp_enqueue_script was called incorrectly. Scripts and styles should > not be registered or enqueued until the wp_enqueue_scripts, > admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging > in WordPress for more information. (This message was added in version 3.3.) > in wp-includes/functions.php on line 3049 > > Warning: Cannot modify header information - headers already sent by (output > started at wp-includes/functions.php:3049) in wp-login.php on line 415 > > Warning: Cannot modify header information - headers already sent by (output > started at wp-includes/functions.php:3049) in wp-login.php on line 427 This is what I get, when I try to log in... On other sites I have only two first errors. I try to fix it but I can't. Any suggestions?


title: Random order of posts on each request

text: I want my testimonials to be shuffled everytime someone clicks on my testimonials page so that it is not the same one on top all the time. How can I do this? Where should I put the code? I am building using Thesis for WordPress. Also, i assume that each testimonial will need to be inside a div and I will give an ID to each div so that they can be shuffled? I still want them all to be on the page, I just want the order they appear in to change.


title: Use MarkItUp as editor and not the default

text: Does anyone know if it is possible to use this editor as my WordPress editor and not the default. If so, how?


title: Are un-sanitized theme options more vulnerable to malicious scripts than the theme editor?

text: I'd like to put text areas in a theme options area to allow users to easily add analytics code, scripts, and css. Is it silly to worry about malicious code being inserted via un-sanitized theme option text areas when, theoretically, a user could add malicious code just as easily via the standard wordpress theme editor? These types of theme options would be so helpful, but I'm struggling with the lack of sanitation/validation that comes with implementation.


title: How to use jQuery on widget admin page

text: I have a lengthy form config for my widget so I thought about using radio buttons to hide and show the relevant input fields instead of having them all after each other. But it doesn't seem to work. I suppose it is because the form is loaded with ajax? Is there a way to get it to work? Take a look at the code here: http://jsfiddle.net/JmVL3/


title: trying to get paginate_links to work but the query before is not working with multiple categories

text: I am trying to make this paginate_links work. The thing is I cant use category__and in my query. If I write 'cat' => array(3, 4, 24), It works but I get a message saying it needs a string, not an array. I cant use an array at all. It works with 'cat' for single categories.               $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;                               $the_query = new WP_Query( array(                         'category__and' => array(3, 4, 24),                         'posts_per_page' => 15,                         'paged' => $paged,                     ) );      Rest of the code:               global $the_query;                          $big = 999999999; // need an unlikely integer                          echo paginate_links( array(                         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),                         'format' => '?paged=%#%',                         'current' => max( 1, get_query_var('paged') ),                         'total' => $the_query->max_num_pages,                         'show_all'     => False,                         'end_size'     => 2,                         'mid_size'     => 2,                         'prev_next'    => True,                         'prev_text'    => __('« Föregående'),                         'next_text'    => __('Nästa »'),                         'type'         => 'plain',                     ) );


title: default value not getting displayed in input field

text:
I have written code for creating theme options but default values not getting displayed in text field Also settings saved message also not getting displayed                   <?php          // Default options values     $xyz_options = array(             'footer_copyright' => '© ' . date('Y') . ' ' . get_bloginfo('name'),             'facebook'=>'http://www.facebook.com/'         );          if ( is_admin() ) : // Load only if we are viewing an admin page              function xyz_register_settings() {         // Register settings and call xyz initiation functions             register_setting( 'xyz_theme_options', 'xyz_options', 'xyz_validate_options' );         }              add_action( 'admin_init', 'xyz_register_settings' );              function xyz_theme_options() {         // Add theme options page to the admin menu             add_theme_page( 'Theme Options', 'Theme Options', 'edit_theme_options', 'theme_options', 'xyz_theme_options_page' );         }              add_action( 'admin_menu', 'xyz_theme_options' );              // Function to generate options page         function xyz_theme_options_page() {             global $xyz_options;                  if ( ! isset( $_REQUEST['updated'] ) )                 $_REQUEST['updated'] = false; // This checks whether the form has just been submitted. ?>
                      <?php screen_icon(); echo "
" . get_current_theme() . __( ' Options' ) . "
";                 // This shows the page's name and an icon if one has been provided ?>                      <?php if ( false !== $_REQUEST['updated'] ) : ?>

<?php _e( 'Options saved' ); ?>

                 <?php endif; // If the form has just been submitted, this shows the notification ?>                      <form method="post" action="options.php">                          <?php $settings = get_option( 'xyz_options', $xyz_options ); ?>                          <?php settings_fields( 'xyz_theme_options' );                 /* This function outputs some hidden fields required by the form,                 including a nonce, a unique number used to ensure the form has been submitted from the admin page                 and not somewhere else, very important for security */ ?>

                                                              Facebook url                             	                                                  <input id="facebook" name="xyz_options[facebook]" type="text" value="<?php esc_attr_e($settings['facebook']); ?>" />

                                                              Footer Text 1                             	                                                  <input id="footer_copyright" name="xyz_options[footer_copyright]" type="text" value="<?php  esc_attr_e($settings['footer_copyright']); ?>" />

                         <input type="submit" class="button-primary" value="Save Options" />
                 </form>
              <?php         }              function xyz_validate_options( $input ) {         global $xyz_options;              $settings = get_option( 'xyz_options', $xyz_options );              }          endif;  // EndIf is_admin()


title: Jetpack Infinite scroll conflicting with theme's pre_get_posts custom posts_per_page

text: I have the current function on my theme using `pre_get_posts`, currently right at the bottom of my theme's functions.php file:               function mytheme_portfolio_archive_pages( $query ) {         if ( is_admin() || ! $query->is_main_query() )             return;              if ( is_post_type_archive( 'mytheme_portfolio' ) ) {             // Display 20 posts for a custom post type called 'mytheme_portfolio'             $query->set( 'posts_per_page', 20 );             return;         }     }     add_action( 'pre_get_posts', 'mytheme_portfolio_archive_pages', 1 );      It means I have 20 posts per page if the current archive is of the post type `mytheme_portfolio`, instead of the default 5 for the blog pages (the number 5 is being set in "Blog pages show at most __ posts" in Settings -> Reading). The above function is working fine when Jetpack Infinite Scroll is deactivated. Problem is I want to use Jetpack Infinite Scroll with the 'mytheme_portfolio' archive. And with it activated, the above function stops working and the Infinite Scroll uses the "Blog pages show at most 5 posts" number from Settings -> Reading when it loads new posts. The Infinite Scroll is otherwise working fine but I need to show 20 posts per page, not 5, if I'm on a `mytheme_portfolio` archive page! My Jetpack setup code is as follows, just for reference:                   function mytheme_render_infinite_scroll() {             while ( have_posts() ) : the_post();                     if ('mytheme_portfolio' == get_post_type() && !is_search()) :                         get_template_part( 'content', 'archive-portfolio' );                     elseif ( is_search() ) :                         get_template_part('content','search');                     else :                         get_template_part( 'content', get_post_format() );                     endif;             endwhile;         }              function mytheme_jetpack_setup() {             add_theme_support( 'infinite-scroll', array(                 'container'      => 'content',                 'footer_widgets' => 'footer-widgets',                 'type'           => 'click',                 'render'         => 'mytheme_render_infinite_scroll',                 'wrapper'        => true,                 'posts_per_page' => false             ) );         }         add_action( 'after_setup_theme', 'mytheme_jetpack_setup' );      Thanks so much for any help anyone can give! **EDIT:** I found the line in the Jetpack plugin code that's conflicting, in `jetpack/modules/infinite-scroll/infinity.php`, line 26...               function __construct() {         add_action( 'pre_get_posts',                  array( $this, 'posts_per_page_query' ) );         ...      which corresponds to lines 449 - 452 in the same file:               function posts_per_page_query( $query ) {         if ( ! is_admin() && self::archive_supports_infinity() && $query->is_main_query() )             $query->set( 'posts_per_page', self::get_settings()->posts_per_page );     }      If I comment line 26 out my function works. Obviously I don't want to go changing the plugin's files, is there a way I can make sure my theme's `posts_per_page` argument (initial code block above) is the one that's used, and not Jetpack's?


title: Bootstrap Error in WordPress plugin

text: I am creating a plugin that generates advanced search queries. All of the UI is done in bootstrap, and the results are displayed via modal (bootstrap.js). On the production site Greenlane SEO I get the JS error: `Uncaught TypeError: Object [object Object] has no method 'modal'`. I cannot figure out for the life of me what is causing this as I installed this on another WP site and the plugin works seamlessly (minus the styling).


title: Error, when i install new theme

text: I'm getting following error when I install emphaino theme in WordPress. ![enter image description here](http://i.stack.imgur.com/1OGza.png) The default themes (Twenty Eleven 1.3, Twenty Ten 1.3) are working good. Other themes are also working good. I am already using same theme in another site. That's working good. But my new site makes this problem. Where is Wrong?


title: Copy Root Multisite Site

text: I have a Multisite installation created in WordPress hosted at `example.com` with websites at `example.com/site1`, `example.com/site2` etc. Is it possible to create an exact copy of `example.com` at `example.com/site3`? Blog Copier and NS cloner don't allow you to ever create a copy of the root site for some reason. What would the technical limitations behind this be?


title: Adding define('WP_MEMORY_LIMIT', '64M'); by default?

text: Before installing a big plugin I'm always scared of the blank page so I usually add define('WP_MEMORY_LIMIT', '64M'); to wp-config.php beforehand. I was thinking I could add it immediately after any WordPress install. Does this have potential downside?


title: Wordpress PHP plugin - Settings page error

text:
Writing a PHP plugin for Wordpress. It was an external PHP script. But now I'm having a problem. When I click submit on the page it redirects saying there are no permissions to go to that page. Edit: Completely different query all together. I have permission errors following some of the changes advised below. (View edits to see revisions). Here is my code:                           <?php                 /*                 Plugin Name: ProfileDT-JobBoard                 Plugin URI: http://profiledt.co.uk                 Description: ProfileDT-JobBoard                   Author: Bradly Spicer                 Version: 0.0.2                 Author URI: http://profiledt.co.uk                 */                      /*Installation of Plugin */                 /* What to do when the plugin is activated? */                 /*register_activation_hook(__FILE__,'JobBoard_install');*/                 register_activation_hook('jobboard-settings','JobBoard_install');                      /* What to do when the plugin is deactivated? */                 /*register_deactivation_hook( __FILE__, 'JobBoard_remove' );*/                 register_deactivation_hook('jobboard-settings', 'JobBoard_remove' );                      function JobBoard_install() {                 /* Create a new database field */                 add_option("JobBoard_data", 'Testing !! My Plugin is Working Fine.', 'This is my first plugin panel data.', 'yes');                 }                      function JobBoard_remove() {                 /* Delete the database field */                 delete_option('JobBoard_data');                 }                      /*Admin Menu of Plugin*/                 add_action('admin_menu', 'JobBoard_admin_menu');                 function JobBoard_admin_menu() {                 /*add_options_page('Plugin Admin Options', 'JobBoard Settings', 'manage_options',__FILE__, 'JobBoard_options_page');*/                 add_options_page('Plugin Admin Options', 'JobBoard Settings', 'manage_options','jobboard-settings', 'JobBoard_options_page');                           }                 /*Content inside the admin page*/                 function JobBoard_options_page()                  {                 ?>                      <?php                      if(isset($_POST['submit_delete'])) {                               $id=$_POST['ID'];                             $sql= (mysqli_query($con, "Delete FROM details WHERE ID = '$id'"));                             if($sql)                             {                            echo "Data Deleted";                         } else {                            echo "Data Not Deleted";                 }                 } elseif(isset($_POST['submit_add'])) {                      // Get values from form                      $value_Employer = $_POST["Employer"];                     $value_LearningProvider = $_POST["LearningProvider"];                     $value_ContractedProvider = $_POST["ContractedProvider"];                     $value_LearningDeliverySite = $_POST["LearningDeliverySite"];                     $value_VacancyDescription = $_POST["VacancyDescription"];                     $value_VacancyTitle = $_POST["VacancyTitle"];                     $value_EmployerDescription = $_POST["EmployerDescription"];                     $value_VacancyLocation = $_POST["VacancyLocation"];                     $value_WorkingWeek = $_POST["WorkingWeek"];                     $value_WeeklyWage = $_POST["WeeklyWage"];                     $value_NoVacancies = $_POST["NoVacancies"];                     $value_VacancyRefNumber = $_POST["VacancyRefNumber"];                     $value_ClosingDateForApplications = $_POST["ClosingDateForApplications"];                     $value_InterviewBeginFrom = $_POST["InterviewBeginFrom"];                     $value_PossibleStartDate = $_POST["PossibleStartDate"];                     $value_TrainingToBeProvided = $_POST["TrainingToBeProvided"];                     $value_LearningProviderDescription = $_POST["LearningProviderDescription"];                     $value_ContactDetails = $_POST["ContactDetails"];                     $value_VacancyType = $_POST["VacancyType"];                     $value_ApprenticeshipFramework = $_POST["ApprenticeshipFramework"];                     $value_SkillsRequired = $_POST["SkillsRequired"];                       $value_PersonalQualities = $_POST["PersonalQualities"];                        $value_ImportantOtherInformation = $_POST["ImportantOtherInformation"];                        $value_Website = $_POST["Website"];                      // Insert data into mysql                  $sql="INSERT INTO $tbl_name(Employer, LearningProvider, ContractedProvider, LearningDeliverySite, VacancyDescription, VacancyTitle, EmployerDescription, VacancyLocation, WorkingWeek, WeeklyWage, NoVacancies, VacancyRefNumber, ClosingDateForApplications, InterviewBeginFrom, PossibleStartDate, TrainingToBeProvided, LearningProviderDescription, ContactDetails, VacancyType, ApprenticeshipFramework, SkillsRequired, PersonalQualities, ImportantOtherInformation, Website)VALUES('$value_Employer', '$value_LearningProvider', '$value_ContractedProvider', '$value_LearningDeliverySite', '$value_VacancyDescription', '$value_VacancyTitle', '$value_EmployerDescription', '$value_VacancyLocation', '$value_WorkingWeek', '$value_WeeklyWage', '$value_NoVacancies', '$value_VacancyRefNumber', '$value_ClosingDateForApplications', '$value_InterviewBeginFrom', '$value_PossibleStartDate', '$value_TrainingToBeProvided', '$value_LearningProviderDescription', '$value_ContactDetails', '$value_VacancyType', '$value_ApprenticeshipFramework', '$value_SkillsRequired', '$value_PersonalQualities', '$value_ImportantOtherInformation', '$value_Website')";                 $result=mysql_query($sql);                      // if successfully insert data into database, displays message "Successful".                  if($result){                 echo "Successful";                 echo "
";                 }                      else {                 echo "ERROR";                 echo $sql;                 }                           } elseif(isset($_POST['submit_update'])) {                     // code for updating                 }                      ?>                           <?php screen_icon(); ?>
ProfileDT JobBoard Settings
                      <?php                         // Connect to our DB with mysqli_connect(<server>, <username>, <password>, <database>)                             $con = mysqli_connect("localhost", "profiled_job","ZH8liJnG5pZR", "profiled_jobboard") or die(mysql_error());                        // mysqli_select_db($con,"jobboard" ) or die(mysql_error());                                   //update                             $sql_update = "SELECT ID,Employer FROM details";                             $result_update =mysqli_query($con,$sql_update);                         //delete                             $sql_delete = "SELECT ID,Employer FROM details";                             $result_delete =mysqli_query($con,$sql_update);                 ?>

 Add User

                      <form method="post" action="<?php echo admin_url('options-general.php?page=jobboard-settings'); ?>"/>                 <?php                 echo "Employer                                   <input type=\"text\" name=\"Employer\" />

" .                 "Learning Provider                  <input type=\"text\" name=\"LearningProvider\" />
" .                 "Contracted Provider                  <input type=\"text\" name=\"ContractedProvider\" />
" .                 "Learning Delivery Site:                   <input type=\"text\" name=\"LearningDeliverySite\" />
" .                 "Vacancy Description:                  <textarea rows=\"5\" Cols=\"22\" name=\"VacancyDescription\" style=\"display: inline-block; margin-left:10px;\"/> </textarea>
" .                 "Vacancy Title:                  <input type=\"text\" name=\"VacancyTitle\" />
" .                 "Employer Description:                  <textarea rows=\"5\" Cols=\"22\" name=\"EmployerDescription\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Vacancy Location:                  <input type=\"text\" name=\"VacancyLocation\" />
" .                 " Working Week Hours:                  <input type=\"number\" name=\"WorkingWeek\" />
" .                 "Weekly Wage:                  <input type=\"text\" name=\"WeeklyWage\" />
" .                 "Vacancies:                  <input type=\"text\" name=\"NoVacancies\" />
" .                 "Reference Number:                  <input type=\"text\" name=\"VacancyRefNumber\" />
" .                 "Closing Application Date:                  <input type=\"date\" name=\"ClosingDateForApplications\" />
" .                 "Interview Start Date:                  <input type=\"date\" name=\"InterviewBeginFrom\" />
" .                 "Possible Start Date:                  <input type=\"date\" name=\"PossibleStartDate\" />
" .                 "Training to be provided:                  <textarea rows=\"5\" Cols=\"22\" name=\"TrainingToBeProvided\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Learning Provider Desc:                  <textarea rows=\"5\" Cols=\"22\" name=\"LearningProviderDescription\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Contact Details:                  <textarea rows=\"5\" Cols=\"22\" name=\"ContactDetails\" style=\"display: inline-block; margin-left:10px;\"/> </textarea>
" .                 "Vacancy Type:                  <input type=\"text\" name=\"VacancyType\" />
" .                 "Apprenticeship Framework:                  <input type=\"text\" name=\"ApprenticeshipFramework\" />
" .                 "Skills Required:                  <textarea rows=\"5\" Cols=\"22\" name=\"SkillsRequired\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Personal Qualities:                  <textarea rows=\"5\" Cols=\"22\" name=\"PersonalQualities\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Other Information:                  <textarea rows=\"5\" Cols=\"22\" name=\"ImportantOtherInformation\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "<input type=\"text\" name=\"Website\" />
" .                 "<input type=\"submit\" value=\"Add Vacancy\" name=\"\" />";                 ?>

 Delete User

                     Warning: Once deleted it is gone forever                 <form method="post" action="<?php echo admin_url('options-general.php?page=jobboard-settings'); ?>"/>                     <select name='ID'>                          <?php                          while ($data=mysqli_fetch_assoc($result_delete)){ ?>                            <option value ="<?php echo $data['ID'] ?>"><?php echo $data['Employer'] ?></option>                     <?php } ?>                              </select>
                             <input type="submit" value="Delete User" name='submit'>
                      </form>

 Update User

                 <form method="post" action="<?php echo admin_url('options-general.php?page=jobboard-settings'); ?>"/>                     <select name='ID'>                          <?php                          while ($data=mysqli_fetch_assoc($result_update)){ ?>                            <option value ="<?php echo $data['ID'] ?>"><?php echo $data['Employer'] ?></option>                          <?php } ?>                              </select>
                             <input type="submit" value="Update User" name='submit'>
                      </form>

                 <?php } ?>


title: Posts 2 Posts - Filtering site search with connected post types

text: I would like to utilise the WordPress search facility to create the site search. Once the search has been complete I would then like to be able to filter it down based on the posts 2 posts connection. Is it possible to extend the site search to include p2p connection?


title: Yet another wp_insert_post infinite loop. What is wrong?

text: I am writing a plugin that enables subscribed users to submit posts of a custom type, and I am trying to implement this feature via shortcodes. Now the problem is that instead of inserting one post, my code inserts hundreds of them, until PHP runs out of memory... Here is an ultraminimal code that reproduces the issue:               add_shortcode( 'occaz-ajouter', 'occasion_addedit' );          function occasion_addedit(){              wp_insert_post(array('post_title'=> 'hello',                              'post_content'=> 'Hello everybody',                             'post_author'=>1));              return "OK.";          }      (Of course, I have a page that contains the [occaz-ajouter] shortcode, and I encounter the problem when I visit this page.) I saw that several people have encountered such infinite loops, but none of the solutions provided seems to solve my issue, since I use none of the hooks that usually explain the infinite loop... Any idea? Thanks a lot, Nown


title: dbDelta support for FOREIGN KEY

text: **On PHP 5.3.13/MySQL 5.5.21 the following code doesn't work:**               if($check_custom_fields_form!=1){         $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." (                     `form_name` longtext NOT NULL,                     `field_id` bigint(20) NOT NULL,                     FOREIGN KEY (`field_id`) REFERENCES $table_custom_fields (`ID`) ON DELETE CASCADE ON UPDATE CASCADE         ) CHARACTER SET utf8 COLLATE utf8_general_ci";         dbDelta($sql);     }     if($check_subscribe_cat!=1){         $sql = "CREATE TABLE IF NOT EXISTS ". $table_subscribe_cat ." (                     `subscribe_id` bigint(20) NOT NULL,                     `cat_id` bigint(20) NOT NULL,                     FOREIGN KEY (`subscribe_id`) REFERENCES ".$wpdb->prefix."tgt_subscription (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,                     FOREIGN KEY (`cat_id`) REFERENCES ".$wpdb->prefix."terms (`term_id`) ON DELETE CASCADE ON UPDATE CASCADE         ) CHARACTER SET utf8 COLLATE utf8_general_ci";         dbDelta($sql);      }      **Thecode provider suggested a downgrade to MySQL 5.1.37 (no, thanks) or the following update:**               if($check_custom_fields_form!=1){             $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." (                         `form_name` longtext NOT NULL,                         `field_id` bigint(20) NOT NULL,                         KEY(field_id)             ) CHARACTER SET utf8 COLLATE utf8_general_ci";             dbDelta($sql);         }     if($check_subscribe_cat!=1){           $sql = "CREATE TABLE IF NOT EXISTS ". $table_subscribe_cat ." (                       `subscribe_id` bigint(20) NOT NULL,                       `cat_id` bigint(20) NOT NULL,                       KEY(subscribe_id),                       KEY(cat_id)           ) CHARACTER SET utf8 COLLATE utf8_general_ci";           dbDelta($sql);        }      Which seems like a rather dirty way to work around the problem (no cascading deletes/updates). Therefore:   1. **Do I really have to live with thatuntil dbDelta supports FOREIGN KEY?**   2. **Is it true that dbDelta only works with foreign key in a 3 year old MySQL version?**


title: How to display by default only published posts/pages in the admin area?

text: As it is, WordPress displays by default **all** the pages/posts in the pages/posts list in the admin area, no matter what their publishing status is. I have a lot of drafts, but usually I'm much more interested in editing the published pages/posts, therefore getting only to display them requires another click and full reload. Is there a way to set WordPress to initially display only published posts/pages, allowing you to click on "All" or "Draft" if you later want to?


title: How to create a post with next buttons

text: I am trying to create a post to show top 10 movies of 2013. I have created a post with the same heading. However how can I show the post with next buttons. That is position 10 movie should be first, with corresponding image and some text. Then on clicking next button go to 9th movie. like that the last screen should be the 1st movie. Is there any plugins available? or how can I achieve it.


title: One query to get posts and their taxonomy terms

text: I am building a map of posts and taxonomies to do some more intensive processing later on. Right now I am querying the posts with `WP_Query` and iterating over each one to get their taxonomy terms and then dump all of that into an array for use later. I know this isn't right from a performance and "best standards" perspective. I don't want to make database calls in a loop and I would really prefer to eagerly load all post terms on the first query with the posts. Is this possible? How?


title: How to alert users when new posts appear under search query?

text: I have been hunting the web for days for this feature, and I am kind of surprised it's so hard to find / nobody really talks about it! I have a Wordpress site with a custom post type that can be pulled by different search attributes. I am looking for a way for users to subscribe to a specific search query string, and once per week, get notified automatically via email when new posts that match their search query string appear. For example when somebody searches for www.mysite.com/?Location=California&Radius=25, a list of results come up, and if that user subscribes to this search result, then once per week he/she will be notified of new posts matching that search query I am open to paid plugins as well, it's just I haven't been able to find one that can do this. I am comfortable with capturing additional information from users when they're signing up, using jQuery and populating hidden fields' values, etc., if this would help with the end goal. Edit: I thought of an idea of users subscribing to the RSS feed for each search query, since it's automatically generated by adding /feed/ in the search query URL. But I am not sure how to alert users when new posts appear under the RSS feed, and when to fire the alert (i.e. once a week), and how to display all new posts in an email template. Any help is greatly appreciated!


title: Wordpress list child pages of custom post type

text:
Im stuck on this and any help would be appreciated. Say there is a parent page called "Stuff". And Stuff has several pages under it.   * Stuff      * more stuff     * more stuff1     * more stuff2   * It has no children   * Other with children      * etc     * etc 2 So when you click on "more stuff". That page would list all the pages under stuff ('more stuff, morestuff1, morestuff2'). Or if you click on "etc" you would see "etc, etc2" Any thoughts or help would be appreciated. I'm using the Types plugin and have hierarchical setting turned on already. **** I've used the following. Currently trying to figure out how to use ACF with the results. For example: If Advanced Custom Field"x" exists then use that instead of the title (basically use an image for the title instead depending on if that field exists and is being used)               <?php                  if($post->post_parent)                     $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&post_type=physicians");                 else                     $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&post_type=physicians");                 if ($children) { ?>

                                                                  Home
                         <?php echo $children; ?>

                 <?php }?>


title: Add Div to Comment Form

text:
I have some code that displays my comment form and my custom validation, what I'd like to do is add a div right underneath the title, but I'm not sure how to do that because that code is generated... The Code:               <?php $comment_args = array(         'title_reply' => 'Leave a Comment',          'comment_notes_before' => '',           'fields' => apply_filters( 'comment_form_default_fields', array(         'author' => '
' . '' . __( 'Name:' ) . ' ' . ( $req ? '*' : '' ) .         '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" required />
',          'email'  => '
' .         '' . __( 'E-mail:' ) . ' ' . ( $req ? '*' : '' ) .         '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" required />'.'
',          'url'    => '' ) ),          'comment_field' => '
' . '' . __( 'Comment:' ) . '' . '<textarea id="comment" name="comment" cols="45" rows="8" required></textarea>' . '
',          'comment_notes_after' => '',          'label_submit' => __( 'Post' ),         );         comment_form($comment_args);     ?>      Which Outputs:
Leave a Comment Cancel reply
          <form action="http://ourpictureshare.com/wp-comments-post.php" method="post" id="commentform" class="comment-form">
Logged in as admin. Log out?

Comment:<textarea id="comment" name="comment" cols="45" rows="8" required=""></textarea>

               <input name="submit" type="submit" id="submit" value="Post">               <input type="hidden" name="comment_post_ID" value="93" id="comment_post_ID">               <input type="hidden" name="comment_parent" id="comment_parent" value="0">
           <input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment" value="70754f57d7">     </form>      What I am looking for:
Leave a Comment Cancel reply

           <form action="http://ourpictureshare.com/wp-comments-post.php" method="post" id="commentform" class="comment-form">
Logged in as admin. Log out?

Comment:<textarea id="comment" name="comment" cols="45" rows="8" required=""></textarea>

             <input name="submit" type="submit" id="submit" value="Post">             <input type="hidden" name="comment_post_ID" value="93" id="comment_post_ID">             <input type="hidden" name="comment_parent" id="comment_parent" value="0">
       <input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment" value="70754f57d7">     </form>      Any help is appreciated. Thanks,   Josh


title: Get all attachments by custom taxonomy - term

text: I want to make custom taxonomy (gallery) and terms (name1, name2, name3...) Add images into media tab and then retrieve all images from same term. Look like simple task, but I cant manage it. I registered new (custom) tax, added some terms to image, but I cannot retrieve any of them. Searched for two days for solution, just can't put all pieces all together. I want to get list of terms first, and then get list of images from this list.


title: Wordpress Site access from other machines on same network

text: I developed a Wordpress website on my local computer using 'Wamp' server. I'm now trying to put it on a local server at our work so that others can look at it / access it from their work stations. We setup a Windows 2008 Server R2, installed Xampp (Wamp had issues installing). Apache server and MySQL are both active and running. I installed a copy of SQL DB, copied over the wordpress contents from my local workstation to C:\xampp\htdocs\'mysite' on the new server. Finished wordpress setup and I'm able to access the dashboard and the website. Now I wanted to change localhost to IP Address of this server to it can be access by other workstations. So on Wordpress Dashboard, I went into settings > General > Changed Site Address to '//IP/mysite' and WordPress Address to '//localhost/mysite' (Which was default). Made sure all the permalinks are changed to IP address. everything looks good, Website works fine on the new server, navigation links are all good. When I access the website from other workstations using '//IP/mysite'. I get the content of the website but not the same layout (Styles). Contents just stack up vertically, one below the other. I cannot seem to figure out whats going on. I've tried changing both Wordpress Address URL & Site Address URL to '//IP/mysite', when I hit save, I lose all the dashboard icons (For eg: Page icon before Pages link in the dashboard) and some of the plugins don't respond. Has anyone ever come across similar problem before? Any help would be appreciated. Thank you in advance!! PS: If you need more info, please let me know I'll provide asap


title: Redirect permalinks after creating custom post types

text: I'm in the process of reorganizing a website with many posts (~30.000) a part of which have to be migrated to a new custom post type. Since the custom posts have an added slug to the permalink, is there a way to redirect all the requests to the old links like: `www.example.com/some-interesting-article` to `www.example.com/new-post-type/some-interesting-article` ?


title: Modify my code - which takes the first sentence of the post and use it as a h2 tag - to work outside the loop

text:
My code takes the first sentence of a post and places it's content inside a variable. The problem is it works only inside the loop. I need help making this code outside the loop, becouse I want to use the posts first sentace as description in the header.php Here it is:               <? ob_start();     the_content();     $old_content = ob_get_clean();     $content = strip_tags($old_content);     $match = null;     preg_match('/(.*?[?\.!]{1,3})/', $content, $match);       $first_sentence = $match[1];        $the_rest = substr($content, strlen($first_sentence));      if ( $first_sentence != '' && $the_rest != '' ){        echo '
'.$first_sentence.'
';        echo '
'.$the_rest.'
';     } ?>      One more thing, it would be perfect to keep the posts formating in this code. Any ideea how I can do that? Ty very much, take care!


title: Is there an easy way to create a links index page?

text: Essentially I want this... http://oldtimemusic.com/otlinks.html I want to have an index of letters each pointing to a page with links for that letter along with a description. I'm wondering if there is some way I can do that with a wordpress plugin or maybe even the out of the box link functionality? I'd just rather not make it all manually.


title: Most appropriate way to display CPT's by children terms of custom taxonomies while retaining desired permalink structure?

text: Im currently building a small store section on a site of mine with the use of CPT's & Custom Tax's for the first time. So far Ive successfully got my CPT's & Tax's working as expected however since this is my first time Im still a bit stumped about the best approach to take to present this content via templates??? ### Things to note to better understand my goal-   • The store items are all using **(1) CPT** called " **Store Items** "   • The store is going to contain products that fall into a few different custom tax's, eg.   **Product Categories** - w/ children such as (Clothing, Accessories, CDs) filed under that custom tax. / **Brands** - w/ children such as (Brand 1, Brand 2, etc.) filed under that custom tax, and lastly something like **Artists** - w/ children such as (Artist 1, Artist 2, etc.) filed under that custom tax. ### Id like my URL structure to be easy to understand and follow according to what product, etc. is selected, so -   • When your visiting the store itself it will just be - www.mysite.com/store   • When your visiting a product in the store, id like it to be something like - www.mysite.com/store/clothing/mens/t-shirts   (the thing to note here is that "clothing", "mens", and "t-shirts" are children terms added to my custom taxonomy called "Product Categories") - This is the part Im hung up on and not sure how to go about...   Its just my assumption that the current approach Ive devised with 1 CPT along with my custom tax's is the best way to achieve my goal, so even if the core of how Ive approached this is in your opinion haltering my goal then Id love to know what you think. Thanks for the help!   Best,   SB


title: Loading a sidebar on an Ajax call

text: I wanted to load a custom sidebar when doing an Ajax call, so I found the way with:               add_filter( 'loop_start', 'my_sidebar_widget', 25 );      but it is showing the sidebar even in media admin panel, so I thought about doing:               if( !is_admin() ) {         add_filter( 'loop_start', 'my_sidebar_widget', 25 );     }      but it was still loaded in the media admin panel, so I tried:               add_filter( 'loop_start', 'my_sidebar_widget', 25 );          if( is_admin() ) {         remove_filter( 'loop_start', 'my_sidebar_widget', 25 );     }      but in this way, the sidebar is not loaded on the Ajax call. Any idea of how to solve it?


title: How can I call menu_class into this PHP script?

text:
For mobile navigation I would love to call menu_class and drop it in below "foreach ( (array)". Ideas? Everything I've tried won't work. New to PHP, thanks / cheers :)                   <?php                  $menu_name = 'top_nav_menu';                  if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {             $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );                  $menu_items = wp_get_nav_menu_items($menu->term_id);                  $menu_list = '

';                       foreach ( (array) $menu_items as $key => $menu_item ) {                 $title = $menu_item->title;                 $url = $menu_item->url;                 $menu_list .= '
' . $title . '
';             }             $menu_list .= '
Menu
';             } else {             $menu_list = '<select class="dropdownmenu"><option>Menu "' . $menu_name . '" not defined.</option></select>';             }              echo $menu_list;               ?>


title: "Conflict" with jQuery (or its plugins)?

text: I've been working on localhost and everything looks fine but then when I uploaded my Wordpress theme online, all of the jQuery plugin functions are undefined! One solution that worked (which I haven't tested a lot so I still don't know if it will work in the long run) is to import the javascript file from the plugin's main website or github page. I don't really prefer this "solution." Another is the solution here but I haven't tested this a lot also. My issue here is I've used jQuery in another theme and everything works using just `$`, but in my new theme it doesn't work with `$` and so I have to use `$j` instead. It's just that I'm very used to using just `$`. Can someone explain this weird phenomenon? Thank you! :)


title: Fake Single Wordpress Post (Page) Loop

text: In a plugin, I am building a custom page with               add_action('template_redirect', function(){         include(TEMPLATEPATH."/page.php");         exit();     });     add_filter('the_title', function(){ return "Virtual Page Title"; });     add_filter('the_content', function(){ ?>         <!-- HTML CONTENT -->     <?php }); ?>      But some templates wrap the `page.php` content calls in a `have_posts()` loop which I need to override for the virtual page. I have tried `query_posts('posts_per_page=1')` but that requires that there is at least one published post, which may not always be the case.


title: Excluding categories from "Manage Categories" using a get_terms filter

text: I'm using a filter on get_terms (see below) to remove a specified number of named categories from the "Manage Categories" listing. It works great, however, the excluded categories are still counted in the category count field that's displayed just under the "Search Categories" button. Is it possible that I can subtract these categories from the count?               function admin_edit_tags() {add_filter( 'get_terms', 'admin_trim_category_description', 10, 2 );}          function admin_trim_category_description( $terms, $taxonomies ){         if( 'category' != $taxonomies[0] )return $terms;         $my_categories = array('test1','test2','test3');         foreach( $terms as $key => $term)              if(in_array($terms[$key]->name, $my_categories)) { unset($terms[$key]);}             else             {             if(isset($terms[$key]->description) && $terms[$key]->description !=='') $terms[$key]->description = strip_tags(substr( $term->description, 0, 75 ))."...";             }             return $terms;         }


title: Why are some of my custom posts not showing up on my page?

text:
I have 6 posts with a custom post type in my Wordpress theme. I want to show them all on a page but I can only get a maximum of 3 to show up, regardless of how many there are. I have this code in the page:               <?php $count_posts = wp_count_posts( 'cases' )->publish;     echo $count_posts; ?>          <?php query_posts('post_type=cases'); ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
case
     <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
     <?php endif; ?>      ...and it outputs this:               6     case case case      Why are my other 3 custom posts not showing up? Thanks in advance


title: Setting multiple values to as sort_column

text: If I want to sort on 1) menu_order and if the pages weight the same I want to 2) sort them alphabetically, how? Is this the default behavior if you set menu_order? Is it?:               $args = array(         'sort_order' => 'ASC',         'sort_column' => 'menu_order, post_title'     );     $children = get_pages($args);      Or?:               $args = array(         'sort_order' => 'ASC',         'sort_column' => 'menu_order post_title'     );      Or?:               $args = array(         'sort_order' => 'ASC',         'sort_column' => 'menu_order | post_title'     );      Or?:               $args = array(         'sort_order' => 'ASC',         'sort_column' => array('menu_order', 'post_title')     );      etc... From wp_query it seems like it would be a simple space? Multiple orderby values in WP_Query Should really be in the spec.!


title: Get string from array and start loop

text:
I´m using this code to get all members of the groups, in which the logged-in user is member of. Questions: The $group_id is a string from an array. My problem is, there are more than one $value / group_id in the array. In this example group_id=5 and group_id=6 So how can I change the code to a loop (for e.g. with foreach) to list all members of all $value / group_id, in this example group_id=5 and group_id=6 ? Thank you!               <?php          $user_id = bp_loggedin_user_id();         $groups = BP_Groups_Member::get_group_ids( $user_id );                    foreach ($groups as $type => $properties) {              foreach ($properties as $property => $value) {                  $group_id = 'group_id='. ' ' .$value. ' '  .'&exclude_admins_mods=false';             }         }          if ( bp_group_has_members($group_id) ) : ?>
       <?php bp_group_member_pagination_count() ?>

     <?php bp_group_member_pagination() ?>

     <?php while ( bp_group_members() ) : bp_group_the_member(); ?>
              <?php bp_group_member_avatar() ?>       <?php bp_group_member_link() ?>       <?php bp_group_member_joined_since() ?>
     <?php endwhile; ?>
     <?php endif;?>


title: Upgraded to 3.6.1. and cannot open my website anymore

text: I upgraded to 3.6.1. and all the sudden I cannot open my site anymore. Any suggestion on how to solve this?


title: Template is different with and without comments

text: My referenced website is at http://angelopardo.com/wakeupbeast and I've built it as a child theme of twentytwelve. Pages and single posts that have comments are displaying correctly, where the sidebar is just right of the posts area. But pages and single posts that don't have comments are bumping down the sidebar below the posts area. What conditional statement outside of the loop can I use to target pages/posts that have no comments, so that it displays the sidebar correctly? I will probably place the code in single.php or page.php I've been stuck on this for ages, so any help would be appreciated. Thanks!


title: How to get video url and poster url with query in wordpress 3.9.1

text: [video width="400" height="300" src="UrlVideo" poster="UrlPoster" preload="none"][/video]      How to get UrlVideo and UrlPoster in loop query from content posts


title: cache reset button and question about deleting cache

text: I need to put a "delete cache button" on front-end pages. I am looking for plugins for it. any experience or recommendation for it? Can you recommend me a plug in when i create a reset button? What if users keep deleting cache or allow users to delete cache, is it fine or causing any problems for wordpress sites? We use super-cache and we have front end forms based on buddypress and others. After users post, it is not displaying immediately. cuz of cache. then users may need to delete cache. therefore we are trying to find a plugin for users on front-end page. Thank You.