Editor/TinyMCE - change double enter key to <br /> and single enter to nothing

I have learned over the last year on Stack Overflow that people here prefer I give all details in the beginning instead of answering 12 comments worth of this stuff later. **EDIT: If you don't want to read about WHY I want to do this, skip to the bolded Main Question section below...** **~Background:** I have been working on a site for a large client that wants a great CMS experience once the site is handed over. In other words they don't want to be paying forever for constant tickets to fix this and that or add new content... now having said that the ideal situation discussed in meetings with them and their managers would be to have a way to edit their page content seamlessly, error free. I have been programming web content for a long time now and am proficient in whatever language you can throw at me so don't be afraid to post your answers in whatever means. Because I have been programming on my own now for so long I have become accustomed to my own conventions and usually try to stick to them at all times. One of which is never EVER using CMS systems for anything more than a CMS, NOT!, as a web page IDE/Editor. I believe in making sites my own usual way with full MVC structure built around controllers and used to keep everything clean and concise and redirected through proper HTACCESS routes and handled. Therefore I decided a long time ago that all CMS usages for me would always be exactly that, a content management system. This way when I give the client their fully working system, they themselves can add extra text and images only. No styling. **~Question: Why would you do this?** Clients ALWAYS know nothing about code and consistently try to "help" by adding content and breaking whole sections because of wpautop. I want them to have a simple UI and editor to literally feed nothing but content to my actual web site which pulls WP for its content. I am using Wordpress 3.9.2 which I believe comes with TinyMCE v4+. Ok, so, down to the nitty gritty. **~Main Question:** What I am trying to do here is change the last missing piece of my CMS environment, the editor. So, **how do I change this functionality with Wordpress hooks only and not change any core functionality?** (I assume editing the TinyMCE files would be tampering with core). **~What I Have Tried:** So far I have learned an amazing amount in regards to customization of Wordpress so I don't need any suggestions that simply say turn off wpautop and force_root_block, etc. I have tried it all. **~Visual example of what I want the editor to do:** Ironically now that I am typing this I am noticing that Stack Overflow has the functionality I want. I want my CMS users to be able to hit enter and have no line spacing or p tags inserted. However if they hit enter twice I want a tag to be injected. I have looked around a lot and cannot seem to find it. In regards to my TinyMCE_init within my plugin, this is what I have...               function customize_tinyMCE($in) {         $in['remove_linebreaks'] = false;         $in['gecko_spellcheck'] = false;         $in['keep_styles'] = true;         $in['accessibility_focus'] = true;         $in['tabfocus_elements'] = 'major-publishing-actions';         $in['media_strict'] = false;         $in['paste_remove_styles'] = false;         $in['paste_remove_spans'] = false;         $in['paste_strip_class_attributes'] = 'none';         $in['paste_text_use_dialog'] = true;         $in['wpeditimage_disable_captions'] = true;         $in['plugins'] = 'tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen';         $in['content_css'] = get_template_directory_uri() . "/editor-style.css";         $in['wpautop'] = false;         $in['forced_root_block'] = false;         $in['apply_source_formatting'] = false;         $in['toolbar1'] = 'bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,spellchecker,wp_fullscreen,pastetext,wp_adv';         $in['toolbar2'] = 'formatselect,underline,alignjustify,forecolor,removeformat,charmap,outdent,indent,undo,redo,wp_help ';              return $in;          } //end function       Currently, all spaces in editor (enter key) put a `<br />` tag in and line return (shift+enter keys) wraps a p tag around the element which is fine. However, I built these clients a bunch of custom shortcodes to allow them to add full pieces of a page at a time. So when they add a shortcode like so.... `[blockSection]` ...and want to close it while wrapping content like so... `My name is joe`   `Life is gravy`   `[/blockSection]`   it will add in too many `<br />` tags to the post like so... `[blockSection]<br />`   `My name is Joe<br />`   `Life is gravy<br />`   `[/blockSection]`   causing wierd spaces in my actual site design because of the un-acconuted for, newly added, extra `<p>` or `<br />` tags. **What I want:** I want the editor to change my functionality to the functionality of making a post within Stack Overflow. **Firstly** , I want the enter key to make no change in the code and allow them to have cleanly spaced lines within the editor. **Secondly** , I was a double space (two enter key hits) to produce a `<br />` on the Wordpress side. I really want my clients to feel at home and easily build content which wont happen if they are putting in one thing in the visual editor and seeing a different thing come out to the page.


Adding paging to get_posts()

I'm trying to add paging to the query below. However, I can't seem to get the paging to work. It shows previous/next links, however, they always show the same 2 posts. There are 8 posts in this query.               //$paged = get_query_var( 'page' );     wp_reset_query();          global $post;          $args = array('posts_per_page' => 2,'paged'=>1);     $posts = get_posts($args);


Single-page wordpress theme navigation

I'm trying to build single-page theme. I want user to navigate thru menu with anchors (for example `<a href="#About">About</a>`). I've extended Walker for wp_list_pages so it outputs anchors instead of permalinks. How to bite it now? I thought I will use `query_posts` for `'post_type' => 'page'` and just style those pages but is there more flexible way of doing this? Also this query displays all pages (all I want is just depth = 1) and I don't know how to order them same way as wp_list_pages does. Maybe there is some text to read about this kind of pages on the internet?


Bootstrap with Flexslider jQuery Issue

I'm building a Wordpress theme using Twitter Bootstrap. I have registered and enqueued the bootstrap .js file (including others) and everything works fine. This is my code:               wp_register_script( 'wp-flat-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );      However, I have just integrated the Flexslider by WooThemes and I have also registered and enqueued its .js file. This is my code:               wp_register_script( 'flexslider-jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js', '', true );      Whenever, I land on the page where the Flexslider appears the bootstrap .js's file stops working, which has its effect in that the menubar drop down stops working. Does anybody know how I can use the two scripts together without having this issue?


hardcoded wp pages/plugins problems

Ok so long story short, ive been handed a WP site that amongst a few minor changes, needs two specific plugins installed ASAP for the project to be complete. the menu amongst other things is hard coded. each page is also a separate page not feeding from single/page.php"...so if he has about us page etc...its a seperate "about-us.php" page. each menu item lead to their respective "---.php" pages and what the developer did is "hooked" and styled certain parts of WordPress into each separate page. (like sidebar for eg) so it provides half dynamism and half whatever he hard coded in there. the problem is that, the plugins i need to install,(jq lightbox,and image magnify zoom thingy) dont work. no matter what i do, its just a no go. When i click on the images, they just go to a blank page. now when i install them in a sample WP site i have and use to test things b4 i implement, it works as it should. Ive also thereafter tested on my own custom wp site from a side client and plugins also worked there. My boss knows im doing the research but this is a proj that was supposed to have BEEN done. ANy ideas as to how i can add/make work these plugins in this type of wp environment?? or is it not possible if not using the single/page.php? i CAN redo the whole site in my own manner but thatll take more time than i have so is there any further troubleshooting / fixes that i can do to get these plugins working? or is there any changes i can put on these seperate pages thatll allow me to use said plugins? the link to the page the developer designed/developed is http://maglovir.com/ Any tips/links/help in general i humbly appreciate. Thanks in advanced.


How to limit user to publish post per day and per role?

I would like to know is there any way/Plugin to limit the user published post (in a given time span) by his role? Like this: >   * Role A -> 1 post per day and 30 post total. >   * Role B -> 10 post per day and 100 post total. >   * Role C -> unlimited. > I know there are some plugin out there that have these features but they only able to control either limit post per day or limit number of posts on role basic, and they are not mutually inclusive on each other. > Note: This is to prevent the _real estate_ platform from being spamed. > (Editors note) Any ideas?


Adding class to the parent of current-post-ancestor / current-menu-parent / current-post-parent

Following situation: I have a drop down menu. At the moment we are located on a single post of the category "Produkt Design" ![enter image description here](http://i.stack.imgur.com/24v6v.png) Its class in the menu is `menu-item menu-item-type-taxonomy menu-item-object- category current-post-ancestor current-menu-parent current-post-parent menu- item-145` The parent to whom I want to apply a special styling, since it is the parent of the active menu entry, has the following classes `menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has- children menu-item-151` How can I make to get a special class to show in parent? See demo of the menu here ![enter image description here](http://i.stack.imgur.com/5i6p2.png)


pre_get_posts and the blog page

I am trying to set up my new theme in a propper way. I have created a custom home page for my new theme called "template-home.php" and then I created a "blog" page. I went to settings and changed my "Reading" settings to "A static page" and I set my front page to my home template and then I set my "Posts page" to "blog". I did not assign a custom template to that page. It is my understanding that the index.php file would be used to get those posts. I have been trying to use is_page() and is_category() to say that if it's the blog page, then get the blog posts. My hope was that when turning on the theme for the first time, all posts would be displayed on the front page but if I visited the blog page, the conditionals would kick in and get only the posts on the blog page. I thought I might be able to accomplish this taks by using this code               add_action( 'pre_get_posts', 'blog_query');          function blog_query( $query ){         if ( $query->is_page('blog') ) {         $query->set( 'category_name', 'blog' );        }         }      That isn't working. That gives me an error on the front page "Trying to get property of non object" I am just not sure which method to use to set up the blog page. Should I set a custom template for it and let the index page get all posts or try using the pre_get_posts? Your input is appreciated. Thank you.


How to change H1 color only for pages

This one should be easy for you guys. As the title says, I only want to change the color for pages and not posts. I've tried this and some variations of it but no luck               .page h1 {color:#ED3709 !important;}


add_action reference a class

Is it possible to reference a class instead of a function in 'add_action'? Can't seem to figure it out. Here is just a basic example of the function in question.               add_action( 'admin_init', 'MyClass' );     class MyClass {          function __construct() {               .. This is where stuff gets done ..          }     }      So yeah, that doesn't work. I've also tried:               $var = new MyClass();     add_action( 'admin_init', array( &$var ) );      And:               $var = new MyClass();     add_action( 'admin_init', array( &$var, '__construct' ) );      And also:               add_action( 'admin_init', 'MyClass::__construct' );      Is there anyway I can do this without having to create a separate function that loads the class? I'd like to be able to just run the classes constructor through the add_action. That's all that needs to be loaded to get the ball rolling.


Add "Email Image" button with Hyperlink for individual images

I use NextGen Gallery in combination with "Share My Gallery" and "prettyphoto Media" plugins to create and display image galleries that allow visitors to share individual images. I would like to add an email button within the prettyphoto Media plugin that allows viewers to email themselves an individual image that is also hyperlinked back to the main gallery. Any help would be appreciated Here is a link to a sample gallery: http://andrewvangundy.com/index.php/amex- sandbox/#prettyPhoto


display some fields in custom post backend

I am using the following code for the custom post.But i want three fields i.e Location,Persons ,Client to permanently appear in the backend of the custom post rather than having to create and select the custom field our self. I have no idea how to do it. So please help me out.               function create_post_type() {         register_post_type( 'events',             array(                 'labels' => array(                                 'name' => __( 'Events' ),                                 'singular_name' => __( 'Event' ),                                 'add_new' => __( 'Add New' ),                                 'add_new_item' => __( 'Add New Event' ),                                 'edit' => __( 'Edit' ),                                 'edit_item' => __( 'Edit Event' ),                                 'new_item' => __( 'New Event' ),                                 'view' => __( 'View Event' ),                                 'view_item' => __( 'View Event' ),                                 'search_items' => __( 'Search Event' ),                                 'not_found' => __( 'No Event found' ),                                 'not_found_in_trash' => __( 'No Event found in Trash' ),                                      ),                 'public' => true,                 'has_archive' => true,                 'rewrite' => array('slug' => 'events'),                 'show_ui' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => false,                 'taxonomies' => array( 'Event type'),                 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'revisions' ),                  )         );     }


How do I get my nav menu to show sub pages?

http://webdesignsalemoregon.com/westernmennoniteschool/ is my website. I've got the top menu which is the one that was in the theme when I started to customize it. It's got a test drop down that works just fine. I included a secondary menu under the slider with this code               <div id="secondaryMenu">         <?php             $menuID = 'bottom-nav';             $footerNav = '';                  if (function_exists('wp_nav_menu')) $footerNav = wp_nav_menu( array( 'theme_location' => 'footer-menu', 'container' => '', 'fallback_cb' => '', 'menu_id' => $menuID, 'menu_class' => 'bottom-nav', 'echo' => false, 'depth' => '2' ) );             if ($footerNav == '') show_page_menu($menuID);             else echo($footerNav);         ?>     </div>      It works just fine, except for the fact it does NOT show drop downs? I've got 3 pages underneath "Admissions" the furthest left item, and they don't show up?


wp_get_archives() display months even if there is no posts

Hay, the example on the wp_get_archives documentation page shows how to show a list of all the posts, by months. However if there is no posts for a month, the month doesnt get displayed. So an example list could look like this               Janauary (5)     March (1)     April (1)     ...      Is there a way to force the list to display a month, even if no posts exist? Thanks


WordPress package configuration in Ubuntu Server?

So I wanted to play with some Linux-only PHP performance tools and installed Ubuntu Server 10.10 in VirtualBox (for the record I have little clue about Linux, never used it extensively). Turned out Ubuntu (Debian) has WordPress package that does some things differently then I am used to. I was especially puzzled with this instead of usual `wp-config.php`:               $debian_server = preg_replace('/:.*/', "", $_SERVER['HTTP_HOST']);     $debian_server = preg_replace("/[^a-zA-Z0-9.\-]/", "", $debian_server);     $debian_file = '/etc/wordpress/config-'.strtolower($debian_server).'.php';          if (!file_exists($debian_file)) {         header("HTTP/1.0 404 Not Found");     echo "$debian_file could not be found. The file is either not readable by this process or does not exist.
         Please check if $debian_file exists and contains the right password/username.";         exit(1);     }          require_once($debian_file);          define('ABSPATH', '/usr/share/wordpress/');     define('WP_CORE_UPDATE', false);     define('WP_ALLOW_MULTISITE', true);          require_once(ABSPATH.'wp-settings.php');      Why does it do stuff this way? Does it play well with multisite and WordPress in general? Do I understand right that I won't be able to update WordPress core of such install, other than by updating package?


Socialite WP plugin, unable to obtain API keys from FB

I've installed the Socialite plugin for my wordpress blog, this allows your posts to be included in your facebook status as you publish them. I'm trying to configure the plugin, it gives you a URL to visit in order to get your API key from facebook, but the URL it sends me to always gives an error (I've tried for several days now) This question is really borderline facebook/Wordpress, but I'm wondering if anyone else has got this plugin successfully working with facebook, or if the URL that the plugin directs you to is incorrect?


Generating a Rewrite Rule for sSecific Post-Requests from a Submitted Form?

I have a form ( method post ) which makes it possible to filter my posts by specific criterias e.g. "Most Recent", "This week", "Last week", ... It works fine but of course the URL is the same for each request. I dont want to change the send method to GET and change the URL with that trick. I'm looking for a solution where i can add a rewrite rule to the existing ones which would make it possible to have "dynamic" URLS like http://myurl.com/most-recent   http://myurl.com/last-week   http://myurl.com/category-1/most-recent   http://myurl.com/category-1/last-week   The rewrite rule which lookes for the words "most-recent", "last-week", ... at the end of the url, removes those and then falls back to the normal rewrite rules. So those prdefined Post Request would work for categories, pages, posts, ... I hope you guys can understand what i mean!


orderby in query_posts

I have the following line to change my wp query slightly. The posts are by this ordered by the value in the custom field "wpfp_favorites". The value is allways an integer. Posts with value 0-9 is sorted correctly, but when a post has value 10 (or more i guess) its not listed above posts with 9.               query_posts('meta_key=wpfp_favorites&orderby=meta_value');      What is wrong? You can see the problem in "action" here: http://hverdagskupp.no/


Manipulate list of themes in wp-admin

I'm running a multisite network with 100+ themes installed and activated. Is there a way to manipulate the list of available themes in wp-admin so that certain themes appear in the list first? (a kind of "Featured" or "recommended") After the first 9 or so alphabetical as default would be fine. Obviously Googling the words "wordpress" and "themes" has been pretty fruitless in this case.


How/where is the global variable $wp_registered_widgets filled?

I have a problem of widgets not showing up, trying to investigate why $wp_registered_widgets is empty. Can somebody tell me where it gets filled from the database? How can I find out why the default widgets are not set.


How would I create a plugin for my shortcodes?

All tutorials I have found say to add your shortcodes to functions.php in your theme. I would like to break that away from my theme and put that in a plugin so I can share these shortcodes between my network of blogs. Is there a reference or tutorial on creating these shortcodes in a plugin?


Change identical page for every site in multisite

I have an identical page on all my sites in a multisite install. I need to add a bit of text to the bottom of only that page. Is there a quick(ish) way of doing this other than going through each site in the install? The text is identical and in most cases the link is the same, though when I say _same_ I mean I'm using postname in permanent links, the IDs probably differ I would think. I would really rather not go through each site as there are a lot of sites in the install!


Change wording of admin menu item?

I'm using the plugin Jigoshop and I'd like to change the wording of the admin menu to something other than "Products": ![enter image description here](http://i.stack.imgur.com/RFxEp.png) How can I do this? What files need editing?


Using Wordpress header in a moodle site

Hello I am trying to use the wordpress header inside Moodle instead of using the menu in the theme we are using. I have tried adding it using this php code below in the header.php file of the moodle theme but that didn't work and caused the site only to load the background, I also tried adding it in the "additional HTML" area in moodle but that didn't make any difference at all and the page loads as normal. Does anyone know how this can be done as it will be really useful to make the site seamless. Any help is greatly appreciated, thank you.               <?php require('/XXX/public_html/wp-blog-header.php'); ?>     <?php require('/XXX/wp-content/themes/ourtheme/wp-blog-header.php'); ?>


Front-end form submission not creating post

I'm trying to use a front end form to create a post. I've been trying for a while now but I the post is not created. I'm using the code below, i'm not sure if i've forgot something.               <?php Starkers_Utilities::get_template_parts( array( 'parts/shared/html-header','parts/shared/header') ); ?>          <?php      function ty_front_end_form() {     ?>         <?php              if($_POST){             ty_save_post_data();         }          }          function ty_save_post_data() {              if ( empty($_POST) || !wp_verify_nonce($_POST['name_of_nonce_field'],'name_of_my_action') )         {            print 'Sorry, your nonce did not verify.';            exit;              }else{                   // Do some minor form validation to make sure there is content             if (isset ($_POST['title'])) {                 $title =  $_POST['title'];             } else {                 echo 'Please enter a title';                 exit;             }             if (isset ($_POST['description'])) {                 $description = $_POST['description'];             } else {                 echo 'Please enter the content';                 exit;             }                  if(isset($_POST['post_tags'])){             $tags = $_POST['post_tags'];             }else{             $tags = "";             }                  // Add the content of the form to $post as an array             $post = array(                 'post_title' => wp_strip_all_tags( $title ),                 'post_content' => $description,                 'post_category' => $_POST['cat'],                   'tags_input' => $tags,                 'post_status' => 'publish',                          'post_type' => $_POST['post-type']              );             wp_insert_post($post);                   $location = home_url();                   echo "<meta http-equiv='refresh' content='0;url=$location' />"; exit;         } // end IF          }     ?>
          <form id="custom-post-type" name="custom-post-type" method="post" action="">
Post Title
              <input type="text" id="title" value="" tabindex="1" size="20" name="title" />
<input type="submit" value="Publish" tabindex="6" id="submit" name="submit" />
              <?php wp_nonce_field( 'name_of_my_action','name_of_nonce_field' ); ?>          </form>
          <?php Starkers_Utilities::get_template_parts( array( 'parts/shared/footer','parts/shared/html-footer') ); ?>


Dynamically replicate custom metabox in custom post type

I'm building a custom post type in Wordpress which will be used to author and display BuzzFeed style quizzes on a clients blog. Within the custom post type there are custom meta-boxes which represent each question and selections, and another representing the potential ultimate results. So the first meta-box consists of a number input type to assign an ID, a textfield to enter the question, and another field to enter an image. To the author this would represent the first question in their quiz. If they have more than one question to enter, they would need to select the button to add another set of fields. What I'm not sure how to do is how to generate that and ensure that any added fields get saved. I'd rather not resort to a plugin or a drop in library as it's important that I learn how to do it as much as it is that I resolve it.


csv format change in wocommerece

i have made my own custom code to download the csv of order it is quite working good but i need to give one space in after each coloum i mean to say if one value is coming in A than second value should come to colum C not in B in execel sheet.. can anyone help me ? my code is below:                function NYCSV_GENERATE($getTable){     ob_clean();     global $wpdb;     $field='';     $getField ='';          if($getTable){         $result = $wpdb->get_results("SELECT * FROM $getTable");         $requestedTable = mysql_query("SELECT * FROM ".$getTable);         $fieldsCount = mysql_num_fields($requestedTable);              for($i=0; $i<$fieldsCount; $i++){             $field = mysql_fetch_field($requestedTable);             $field = (object) $field;                      $getField .= $field->name.',';         }              $sub = substr_replace($getField, '', -1);         $fields = $sub; # GET FIELDS NAME         $each_field = explode(',', $sub);                $csv_file_name = $getTable.'_'.date('Ymd_His').'.csv'; # CSV FILE NAME WILL BE table_name_yyyymmdd_hhmmss.csv              # GET FIELDS VALUES WITH LAST COMMA EXCLUDED         foreach($result as $row){             for($j = 0; $j < $fieldsCount; $j++){                 if($j == 0) $fields .= "\n"; # FORCE NEW LINE IF LOOP COMPLETE                 $value = str_replace(array("\n", "\n\r", "\r\n", "\r"), "\t", $row->$each_field[$j]); # REPLACE NEW LINE WITH TAB                 $value = str_getcsv ( $value , ",", "\"" , "\\"); # SEQUENCING DATA IN CSV FORMAT, REQUIRED PHP >= 5.3.0                 $fields .= $value[0].','; # SEPARATING FIELDS WITH COMMA             }                        $fields = substr_replace($fields, '', -1); # REMOVE EXTRA SPACE AT STRING END         }              header("Content-type: text/x-csv"); # DECLARING FILE TYPE         header("Content-Transfer-Encoding: binary");         header("Content-Disposition: attachment; filename=".$csv_file_name); # EXPORT GENERATED CSV FILE         header("Pragma: no-cache");         header("Expires: 0");              return $fields;       }     }


Import External XML

I don't know where to start with this one. I would like to create custom post type which will list properties on clients website. I would like those properties being feed from another website/software. So other website/software will be sending XML file to my Wordpress site and I would like to receive that file and convert it to my custom posts. Could anyone help me to get my head around this task, i.e. where to start? Do I need to create custom table in my database? How do I capture that XML file? Any info would be much appreciated. Thanks


New custom theme option (text input) giving index error

I am using the theme-options.php file from ThemeShaper: http://themeshaper.com/2010/06/03/sample-theme-options/ I can succesfully add new dropdown options, however when I add a new text input I receieve this error when I view it in the admin area (I added the THEME_DIRECTORY):
 Notice:  Undefined index:  cpt_sm_dribbble_handle in /[THEME_DIRECTORY]/theme-options.php on line 359
      When I change the input value to something else and save it, it works fine and never gives an error again. However I don't want this error message to appear to users. I would rather it just appear blank since there is no value inputted yet. I suspect that I'm getting this error because the database doesn't recognize this new option. And I think I need some sort of verification in my code to say if this doesn't exist set the value to null. Though I'm not sure if this really is the problem and if so how to fix it. Here's the minimized code for my options file and for a new text option (I've noted the line that is throwing the error):               add_action('admin_init', 'cpt_options_init');     add_action('admin_menu', 'theme_options_add_page');          function cpt_options_init() {         register_setting('cpt_options', 'cpt_theme_options', 'theme_options_validate');     }          function theme_options_add_page() {         add_theme_page('Theme Options', 'Theme Options', 'edit_theme_options', 'theme_options', 'theme_options_do_page');     }          function theme_options_do_page() {         global $sm_select_options;              if (!isset($_REQUEST['settings-updated']))             $_REQUEST['settings-updated'] = false;     ?>              <form method="post" action="options.php">             <?php settings_fields('cpt_options'); ?>             <?php $options = get_option('cpt_theme_options'); ?>
                 Dribbble	                                      Dribbble Username                     <input id="cpt_theme_options[cpt_sm_dribbble_handle]" class="regular-text" type="text" name="cpt_theme_options[cpt_sm_dribbble_handle]" value="<?php esc_attr_e($options['cpt_sm_dribbble_handle']); ?>" /> // THIS IS THE LINE THAT IS THROWING THE ERROR (line 359)
              </form>          <?php     }          function theme_options_validate($input) {         global $sm_select_options;              // Say our text option must be safe text with no HTML tags         $input['cpt_sm_dribbble_feed'] = wp_filter_nohtml_kses($input['cpt_sm_dribbble_feed']);              return $input;     }      Any ideas on what I'm doing wrong? Thanks for your time.


Add source URL from Feed WordPress (Syndication) plugin to a custom field in post editor

We're using the Feed Wordpress (Syndication) plugin to ingest external feeds resulting in posts published in WordPress. The plugin pulls the 'source' URL from the feed. We can display the source URL fine against the post on home and post page, but if the feed owner did not include a source URL, it does not exist. We want to be able to pull the source URL from the feed into a custom field, so that the URL populates the custom field. If the feed has no source URL, then the editor/contributor can access the post editor and add one. Is it possible to pull the source URL from Feed WordPress (or any other plugin that uses feeds) and populate a custom field with the URL if exists. If not, then the user can add one?


Thumbnail Image to go in the post aswell

I have looked everywhere but I cant see any clear answers, a lot about getting a thumbnail image. But I am after having the thumbnail which was uploaded to the post to also be in the post just made. So it automatically puts the image in the post (top left corner for example) Thank you


Non-Linear Questionnaires in Wordpress

I want to make the following happen in Wordpress   1. People answer questions in paginated or single page form.   2. Each next set of options is dependent on the option the user selects preiviously   3. At the end, the user is directed to a page which is a common ending for all questionnaire trees.   4. All this questionnaire options can be viewed/exported **Question:** How can this be done? or if there is a plugin available for a similar purpose? If not wordpress, is there another CMS that offers this?


Displaying Tags for the Page I'm On?

I currently have `<?php $comma = array( 'separator'=> ", " ); wp_tag_cloud($comma); ?>` and I thought this was solved, until going to other posts and seeing the same exact tags.. so I'm guessing this is displaying every tag possible. How do I only display the tags related to each post?


Get list of registered or enqued styles? looking for filters or actions

Where can I get the list of styles about to be printed? What i want is to either filter the list, doing what i want with each, then return empty list. Or do an action that recieves the list, then i can remove_action the print_styles. Something like that, anyway. I'm creating a css minifier concatenizer.


Make a table out of meta box

I want to display the information for my custom metabox as a table on my posts. First question is, how do I make a table out of the information, and secondly, how do I call the metabox? Also, can I have the table disappear if nothing is filled in?               $prefix = 'anime_';          $anime_box = array(         'id' => 'anime-meta-box',         'title' => 'Anime Details',         'page' => 'post',         'context' => 'normal',         'priority' => 'high',         'fields' => array(             array(                 'name' => 'Name',                 'desc' => 'Add the name of the Anime in either English or Japanese(Romanji).',                 'id' => $prefix . 'anime_name',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Genre',                 'desc' => 'Is it a thriller, action/adventure, etc...',                 'id' => $prefix . 'anime_genre',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Directed by',                 'desc' => 'Name of director(s).',                 'id' => $prefix . 'anime_director',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Music by',                 'desc' => 'Name of composer(s)',                 'id' => $prefix . 'anime_music',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Studio',                 'desc' => 'Studio which owns the anime.',                 'id' => $prefix . 'anime_studio',                 'type' => 'text',                 'std' => ''             ),              array(                 'name' => 'Licensed by',                 'desc' => 'Name of both American and Japanese license holders.',                 'id' => $prefix . 'anime_license',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Network(s)',                 'desc' => 'Networks which air the show in both Japan and the United States.',                 'id' => $prefix . 'anime_network',                 'type' => 'text',                 'std' => ''             ),              array(                 'name' => 'Original run',                 'desc' => 'Date of when the anime first aired and when it stopped.',                 'id' => $prefix . 'anime_run',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Episodes',                 'desc' => 'Number of episodes.',                 'id' => $prefix . 'anime_episodes',                 'type' => 'text',                 'std' => ''             ),              )     );          add_action('admin_menu', 'anime_add_box');          // Add meta box     function anime_add_box() {         global $anime_box;              add_meta_box($anime_box['id'], $anime_box['title'], 'anime_show_box', $anime_box['page'], $anime_box['context'], $anime_box['priority']);     }          // Callback function to show fields in meta box     function anime_show_box() {         global $anime_box, $post;              // Use nonce for verification         echo '<input type="hidden" name="anime_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';              echo '
';              foreach ($anime_box['fields'] as $field) {             // get current post meta data             $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '', $field['name'], ':	',                     '';             switch ($field['type']) {                 case 'text':                     echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />',                         '
', $field['desc'],'';                     break;                  }             echo    '',                 '
';         }              echo '
';     }          add_action('save_post', 'anime_save_data');          // Save data from meta box     function anime_save_data($post_id) {         global $anime_box;              // verify nonce         if (!wp_verify_nonce($_POST['anime_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }              // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }              // check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }              foreach ($anime_box['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }


Second tier sidebar navigation

I'm trying to create a second level navigation in WordPress. I've found lots of examples, but none of them seem to do exactly what I want. This code below has me almost there, but I want an active class or better yet a way to only show the sub navigation if I'm on it. It would be great it WordPress had a depth_start option along with depth. Example:               link1     link2 (active class)       link2-1       link2-2       link2-3     link3     link4      Code so far:               <?php          $parent = array_reverse(get_post_ancestors($post->ID));     $first_parent = get_page($parent[0]);          $args = array(         'depth'        => 0,         'child_of'     => $first_parent->ID,         'title_li'     => __($first_parent->post_title),         'sort_column'  => 'menu_order',     ); ?>          <nav class="sidebar">         <ul>             <?php wp_list_pages( $args ); ?>          </ul>     </nav>


Commas in Tag Cloud

Using `<?php wp_tag_cloud(''); ?>` to display tags on my website, how do I separate each tag with a comma but also remove the comma from the last tag?


How to filter by custom post type in taxonomy archive pages

I have two custom types. One called "Questions" and other called "Files". They both share a custom taxonomy called "Types". Everything works fine, however if I go to the "Types" link inside my Wordpress admin and click on any category, it lists all the items, both in "Questions" and "Files". Is there a way to construct a link so I could just query a specific type of one custom type instead of both? Thanks a lot!


Storing query variable and then using wp_reset_query

I want to use a pagination function with a custom posts query (to get posts from a specific category). My pagination function gets the query from `global $wp_query;` So in the following code I have assigned the original $wp_query to a temporary variable and after the query I assigned back. Finally I used `wp_reset_query()` function to reset the query. So my question is that does it make any sense to store the original `$wp_query` first and then assign it back and then reset the query? If we are resetting the query, then isn't it unnecessary? I'm asking the question because I did read about this approach in an article, and I am not sure about this.               $temp_query = $wp_query; //#1. store original wp_query     $args = array(         'cat' => 15,         'paged' => $paged     );       $wp_query = new WP_Query( $args );          while ( $wp_query -> have_posts() ) : $wp_query -> the_post();          endwhile;          my_pagination();    //call function          $wp_query = $temp_query;    //#2. assign back original wp_query          wp_reset_query();   //#3. reset query


Wordpress and SSL

I've made some changes so the blog will work using SSL (`https://`) but now I cannot access my blog anymore - every time I try to access it I'm redirected to `https://example.com`, eventhough I try to acess to `http://example.com`. I can fix it if by adding this two lines to the `wp-config.php` file:               define( 'WP_HOME',    'http://example.com' );     define( 'WP_SITEURL', 'http://example.com' );      But I can't use SSL using this fix. Why am I redirected automatically to the `https://` when I want to access the blog through `http://`? How can i change it back?


How can I emulate permalink behaviour on static pages

I am working on a Wordpress site which is displaying results from an Events API on a given page. the page is at /whats-on. I want to provide links on the page which are formatted like mysite.com/whats- on/name-of-the-event which will link to another page displaying event detail. If I just add the links, Wordpress will try and find a post with the name 'name-of-the-event' and display a 404. Is there a way to bypass this behaviour? How would I add rewrites from within a plugin? UPDATED CODE:               class SpektrixPlugin {              public function activate() {             global $wp_rewrite;             flush_rewrite_rules();             add_action('init',array($this, 'properties_add_rewrite_rules'));             add_filter('query_vars', array($this, 'properties_add_query_vars'));         }              public function properties_add_query_vars( $vars) {             $vars[] = "event"; // name of the var as seen in the URL             return $vars;         }              public function properties_add_rewrite_rules() {             //Change your_page_id with the ID of the whats-on page             add_rewrite_rule( 'whats-on/(.+)/?$' , 'index.php?p=8&event='.$matches[1] , 'top' );         }              public function spektrix_list_events() {             $api = new SpektrixApiClient();             return $api->getAllEvents();         }     }          $SpektrixEvents= new SpektrixPlugin();          register_activation_hook( __file__, array($SpektrixEvents, 'activate') );


help for user login

please help, I have to restrict some users based on the value of some metadata.for eg:if the account is not verified by admin(a metafield like "adminveri" will be zero), then the user should not login....please help me.. this is what i have done so far... add_filter('authenticate', 'check_login', 100, 3);               function check_login($user,$username,$password,$uid)      {       if(!empty($user)) $user_data=$user->data;       $adminveri=get_user_meta($uid,'admin_status');     $emailveri=get_user_meta($uid,'email_status');      if($adminveri[0]==0) or $emailveri[0]==0 )      {      return null;     }      else      {      return $user;      }      }       this code dont allow anyone to login...Also what is the difference between add_filter and add_action?


Get last post date yesterday from each categories not work & double result post

<?php     $categories1=get_categories('orderby=post_date&order=DESC');          function filter_where( $where = '' ) {     $today = date('Y-m-d', current_time( 'timestamp' ));     $yesterday = strtotime ( '-1 day' , strtotime ( $today ) ) ;     $yesterday = date('Y-m-d', $yesterday);     $where .= " AND post_date >= '" . $yesterday . "'" . " AND post_date < '" . $today . "'";     return $where;     }      add_filter('posts_where', 'filter_where');          foreach($categories1 as $category1) {     $posts=get_posts('showposts=1&cat='. $category1->term_id);     if ($posts) {      foreach($posts as $post) {     setup_postdata($post);      ?>
          <?php the_time('F j, Y , g:i a') ?>

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

     <?php }}}      remove_filter('posts_where', 'filter_where');     wp_reset_query();     ?>      my question :   1. Today date july 14 , why show up post from date july 11 ? I want get only date not time.   2. I have one post in two categories , how to show up only one post from one categories ?


confusion with add_filter

I am trying to customize the default WordPress search field. So I thought I could add a filter to remove the function and then add in a new function with the fields the way I want them. So I tried this                function savior_search(){          <form role="search" method="get" id="searchform" action="<?php echo home_url( '/');        ?>">         <input type="text" value="" name="s" id="s" />     </form>     <?php }           add_filter( 'get_search_form', 'savior_search');      It seems to work but for some reason that I don't understand, it duplicates the search field. It puts the form on the page twice. I also commented out get_search_form in the sidebar yet when I refresh my page, it's still there. I am using the filter incorrectly? My search function is in the functions.php.


File exceeds upload_max_filesize, despite max filesize being large enough

I am trying to upload a 762KB picture using the multi-file uploader at /wp- admin/media-new.php. This page reports that my maximum upload filesize is 2GB. However, once the upload progress bar gets to 100%, the upload fails with > The uploaded file exceeds the upload_max_filesize directive in php.ini. I am aware of how to set my upload_max_filesize and associated variables in php.ini, but that appears to be correct. What else could be causing this? Other potentially useful information:   * post_max_size is 3G   * max_execution_time is 600   * memory_limit is 256M   * The site is hosted on Dreamhost (shared hosting, unlimited storage). My .phprc:               upload_max_filesize = 2GB     post_max_size = 3G     max_execution_time = 600     memory_limit = 512M     max_input_time = 500


How to show a post single post in page template

Currently I've divided posts into 5 different categories, based on the categories I've created 5 page templates. all of the pages are listed into the home page navigation menu. in my home page I'm showing 5 posts in five different categories. when they clicked a post that post will shown in the single page template(that's what word press normally does) but i want to show that post into my page template. because each page template having different designs. if there is any way to set the permalink to point to the page template and show the post in to full.


How to check if post meta key exists or not in wordpress database

I want to check if post meta key exists or not, out side of the loop. Is there any WordPress function to check if post meta key exist or not in WordPress database. I have to check this outside the loop. Any help will be highly appreciated.


What syntax highlighter works best with gravityform?

I am using gravity forms and would like to use in the forms also syntax highlighting for a language that is not supported by plugins like evolved, code mirror, ... Do you have experience on how to use a syntax highlighter within gravity forms and which of these are easy to extend in order to support new languages? Some thoughts about this would really help me as newbie to get forward with this topic.


Get attachment by slug

I would like to get an image by specifying a certain slug and then echoing that address in the image src code. The slug for the image would be "book-site-header" I've looked through the get_wp_attachment and get_wp_attachment_metadata in the wordpress codex but neither makes mention of the slug. Slugs have to be unique and are saved in the DB so it must be possible to find it based on the slug and then get the related file url. ![image of slug area](http://alexleuschner.com/1038.jpg)


Can I use HTTP POSTs? Is there a better alternative?

I am use to php development in general and I am use to getting a lot done by making a `POST` to a php file. However I have not seen people using `$_POST` in WordPress. I have seen one discussion about someone wanting to create new posts on their blog using `$_POST`, and they were directed to a more secure system. (Perhaps I misunderstood the conversation though.) I would still like to use `$_POST` simply as a part of the user interface. If it is possible and not a horrible idea to use $_POST what do I need to know to make $_POST work well with WordPress? Are there rules about making a $_POST, or how redirecting so that nothing interferes with WordPress behavior? Are there any other special considerations?


Wordpress widget which displays archive tree

I'm a complete newbie, so would appreciate some help. Is there a wordpress plugin that can display all posts/archives as a part of a tree structure? With high-level parents being `year` and children being `month` Something like this,               -2012     ---Jan     ---Feb     ---Mar     .     .     .     .     -2011     ---Jan     ---Feb     ---Mar     ..


Cannot get query var 'post_type' to work

I am struggling to get the post_type query var (as referenced from http://codex.wordpress.org/WordPress_Query_Vars) to work. This is what the URL looks like:               ?s=microsoft&post_type=bg      but it just returns all results from all post types. Filtering by category works fine, e.g.               ?s=microsoft&category_name=business      Please can anyone help with this?


Use default value of wp_customizer in theme_mod output?

Is there a way to output the default value of a `wp_customize` text field type using the `echo get_theme_mod ();` without actually going in the Theme Customizer, modifying something and then saving it? I just read on another stackexchange question that the `get_theme_mod` will only show something after you save it in Theme Customizer. Not being able to output the default value of a `wp_customize` setting seems to defy the purpose of using a default value. So, back to the question: is there a way to automatically display the default value of a `wp_customize` setting in front-end?


enqueue style google fonts in functions.php in array?

I have a list of 300 fonts from google fonts and try to register in function.php via wp_enqueue_style. Is there any possibility to do this with a variable? Example:               $font_link =  $style_font_standard = array(                "none" => "Select a font",//please, always use this key: "none"                "Arial" => "Arial",                "Actor" => "Actor",                "Abel" => "Abel",                "Allura" => "Allura",                "Advent Pro" => "Advent Pro",                ...ect      );               $enque_font = implode('|', $font_link);              wp_enqueue_style( 'google-fonts', 'http://fonts.googleapis.com/css?family='. $enque_font, false, '', 'all' );      code probably is not good I need help ...


Theme Customizer - Dynamic CSS PHP File

I've recently switched over from using a custom class to enable a theme options panel to the built in Theme Customizer in Wordpress. All is going fairly well - I've got live preview working but I'm a little bit stuck on using 'get_theme_mod()' to retrieve the values in a dedicated PHP file. Using my old class, I could enqueue 'dynamic.css.php' where I would include 'wp-load.php' to enable me to use various functions to get options etc. The Theme Customizer docs show just outputting the dynamic CSS inside a custom function in the wp_head theme. I don't really want to do it this way unless necessary. So, I'm currently enueueing my 'dynamic.css.php' file and it looks like this:               <?php          header("Content-type: text/css; charset: UTF-8");          define( 'WP_USE_THEMES', false );     include('../../../../../wp-load.php'); ?>          @media all and (max-width: <?php echo get_theme_mod('nav-primary-breakpoint'); ?>) {              .drawer {             margin-top: 42px;             padding-top: 42px;             top: -42px;         }          }      This is how I previously did so I attempted basically the same thing but get_theme_mod() isn't working at all. I'm also wary of including wp-load.php again - I was hoping to use a similar methodology to before without having to actually include it. So my aims are to:   * avoid having to load wp-load.php   * have my css in a separate file   * avoid having css output my themes header I've also tried removing the wp-load.php import and including the file in the head of my theme but this puts the output into the body tag. Any suggestions on achieving my aims here?


How not to show leave a Reply to Home Page?

I have made my Front Page as a Static Page. The Page is having a Introduction Content. I am showing this content as an introduction to the site. But it displays "Leave a Reply" Box below it. I do not want the users to give comments on this content. Can somebody suggest How to suppress this for my Static Home Page for all users except Admin.


Wordpress function: limit size, only jpg, jpeg, limit of uploaded files per account

Need help with a function that will limit upload for non admins:   1. Check before upload if file is jpg, jpeg.   2. Check before upload if picture is not bigger than 700kb.   3. Limit uploaded files to 7 per normal user WordPress account. I was searching for plugin or function that will be able to do this but no luck :( Is it even possible to check the file before upload in wordpress?


How to fix my old theme so it loads jQuery properly

I have an older theme that is loading jQuery 'manually', and this conflicts with all plugins that are trying to use jQuery. The following lines are included in the theme header:               <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.3.2.min.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.inputs.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.scrollpane.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.mousewheel.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.easing.1.3.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.lightbox-0.5.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/swfobject.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/functions.js"></script>      I understand that I'm supposed to call a native WordPress hook to load these files, but I don't know the exact steps to do this. Can you help? Sorry for my noobiness.


How do I create a custom role capability?

I wish to create a custom capability for accessing the interface of my plugin.   * Should the plugin manage adding this capability to all the administrator accounts on activation?   * If so: Does WordPress manage adding the capability to all administrators of sub blogs and super administrators in multisite installations, or does that function need to be handled by the plugin?


Customizing contextual help for every page

How can i change the content of the help section for all of my admin pages? I've removed a lot of the admin that won't be used, but i want to add information to the help section for the additional pages. Like the add new page for all my custom post types and different pages that are used in the plugins i'm using. So i can explain how to do things on the specific pages. What's the best way to do this? Thanks


Add Buddypress profile and messages link to Wordpress menu

In the wordpress menu I would like to add a link to the buddypress user profile and messages. These links are dynamic based on the username like, http://buddypress.org/community/members/username/messages/, for example. I know you can get the username with php but that is not allowed within wordpress menus (wp-admin/nav-menus.php) from what I can tell. I also need to add them at a specific place in the menu, not just at the end. What would be the simplest way to add these dynamic links to the wordpress menu? Example:   Main Menu -> Human Resources -> Employee Resources -> Messages   Messages needs to link to the buddypress user's messages


Set my own password when registering a multisite user or site

I'm wondering how I can change the network admin add "new user" or "new site" form so that I can set the password instead off having it randomly generated and e-mailed to the new user. There seems to be no real option or plugin for this oddly enough. I've noticed that `user-new.php` is different for the main site vs inside /multisite but don't really know what to change. I want to make it more like the add user form on a normal installation.


WP_Query - Adding "offset" posts to the end of the loop

I'm trying to create two queries. In the first query, I will, for example, display 6 posts, in a given order. In the second query, I want to display the _same_ 6 posts, but "offset" the first 3 and then have those same 3 appear at the end. For example, Query #1 would return: 1 2 3 4 5 6 Then, Query #2 would return: 4 5 6 1 2 3 Any ideas on how I might pull this off??


Function Reference for custom link in Admin Menu Management Page

What is the function reference for the text within the URL field in the Admin Menu page? I have a PHP function that is utilizing `the_content` function reference to look for specific file paths and replace said file path with a custom path. My goal is to apply this function that is successfully changing paths within my pages/posts to changing the same type of paths when I'm adding custom links in the Admin Menu Management page. Currently this function that uses `add_filter` and `the_content` function reference is not working for the Admin Menu Management Page. I create custom menu sets and place them in sidebar's using widgets for easily management "quick links" to other pages and documents. I've been using the following codex page to find function references: Function_Reference.


Can WordPress Multisite (MU) subdirectory url/slug/permalink be changed?

I am currently working with WordPress Multisite (MU), BuddyPress, and Commons in a Box (CBOX) to create a website around a central user base which allows users to form groups and create "group blogs" associated with their groups. I posted further details about this exact situation on this question here. However, I would like to a more general question about the nature of WordPress Multisite installations, beyond the initial site or network home. My question is whether or not the default subdirectory url structure/folder can be changed at all. For instance, Multisite's current default setup is site.com/blog/sub-site/. I am curious to know if that can be changed to say site.com/blog/enter_something_here/sub-site/. Furthermore, can this structure be changed to something that is not hard-coded in such as site.com/blog/current_user_name/sub-site/? I am not looking for domain mapping and I have already seen the plugin which removes the "/blog/" from the Multisite slug. I think what I want to know is how Multisite accesses or directs to subdirectory installations. For instance, I changed the url structure passed to the creation of a new blog such that afterwards, using PHPMyAdmin, I could check that the blog registered the altered permalink structure as its url in the Multisite database. Similarly, the same url was in the link on the main site page however when I clicked on it, or tried to go to its wp-admin, I got a 404 error. Is the url structure for subdirectory sites something that can be changed? (Even if that means editing core WordPress files?)


Continuous jQuery Slider / Carousel Plugin with linkable slides [for WooCommerce]

As the title says, I'm in search of a continuous slider for my WooCommerce products I have so far tried to accomplish this using custom post types, (with not much luck, because I'm having trouble understanding how they work and how I can include the product entries pics with a link ) Here's the example of the kind of slider I want http://coolcarousels.frebsite.nl/c/57/ If somebody can give me a very basic run-down on how to use custom posts, and more specifically, how to get them to work with the following jQuery slider, that would be greatly appreciated. I'm not asking for all the answers, just someone to hold my hand as I find them myself.


child theme inherticance and php autoload

I wrote this method in a parent them that will auto load a class based on the class name, thus if the class name is: SomeFolder_Folder_Folder_Class.php then it will convert that to: SomeFolder/Folder/Folder/Class.php and load it if it exists:               public function load_class($class){         $path = str_replace('_', '/', $class);         if(file_exists(get_template_directory() . '/' . $path . '.php')){             require_once(get_template_directory() . '/' . $path . '.php');         }     }      This works in conjunction with `spl_autoload_register()` to achieve this 'auto load' functionality. So instead of having a bunch of require_once you just do: `new SomeFolder_Folder_Folder_Class()` and it auto loads it. This works great in the parent them, and even in the child theme when loading classes from the parent theme. How ever, when trying to load classes from the child theme - it fails and states it can't find said class. So I thought lets do:               public function load_class($class){         $path = str_replace('_', '/', $class);         if(is_child_theme()){             if(file_exists(get_template_directory() . '/' . $path . '.php')){                 require_once(get_template_directory() . '/' . $path . '.php');             }         }else{             if(file_exists(get_template_directory() . '/' . $path . '.php')){                 require_once(get_template_directory() . '/' . $path . '.php');             }         }     }      But then parent theme classes start freaking out moaning they can't be found, so I added a new level of complexity:               public function load_class($class){         $path = str_replace('_', '/', $class);         if(is_child_theme()){             if(file_exists(get_stylesheet_directory() . '/' . $path . '.php')){                 require_once(get_stylesheet_directory() . '/' . $path . '.php');             }else{                 if(file_exists(get_template_directory() . '/' . $path . '.php')){                     require_once(get_template_directory() . '/' . $path . '.php');                 }             }         }else{             if(file_exists(get_template_directory() . '/' . $path . '.php')){                 require_once(get_template_directory() . '/' . $path . '.php');             }         }     }      But then were back to square one where you cant find the child theme class.... So - with that said, What should do? How do I get the auto loader to work in both the parent theme and the child theme? Added level of complexity? child theme classes can extend and implement parent theme classes. Thoughts?


Passing dynamic options from backend to frontend

I have created an admin options page (using the Redux Theme Framework), in which the admin can customize the website's appearance (text color, background color, background repeat options, etc.. ). Let's suppose i want to give my user the possibility of setting a custom background for a section. Admin-side, i have a media uploader form (unique id: my_div_background_url). In the frontend, I can retrieve this option and then echo it like this:               <?php      $options = get_option('my_theme');     $section_background_url = $options['div_background_url'];          echo '

';     ?>      My question is: is this the right and best way to do this? Wouldn't it be better if all of my options were saved in a css file whenever the admin changes them, and then having this file included in my website? Or are there others methods?


Custom colors for post rows based on post meta value

I'm trying to have the post background colors change depending on a meta value for the specific post type rather than using the post status. Looked everywhere and can't find a solution. (perhaps there isn't one?) **Specifying post colors based on post-status is simple enough**               add_action('admin_footer','posts_status_color');     function posts_status_color(){     ?>     <style>     .status-draft{background: #FFFF98 !important;}     .status-pending{background: #FFFF98 !important;}     .post-*id here*{background: #FFFF98 !important;}     .status-publish{/* no background keep wp alternating colors */}     </style>     <?php     }      **How do I specify the colors based on a custom meta key/value from the post?**


How to replace all images within exported xml files to demo.jpg?

I'm going to create a demo data by exporting a site (Wordpress Export Tool) and get an xml file. I don't want my users who import my xml and get all actual images of the site. Is it possible (in not manual way) to make replace all images with my dummy.jpg image? Is there any plugin to help work on this?


qtranslate (language definition) when translation for selected language doesn't exist

I'm using qtranslate, and whenever selected language translation doesn't exists it outputs text like this: (English) This is english text. So it gives me (language) string inside the output. I'd like to get rid of this. So that if I select russian language, and text is not translated yet I see english language text but no (English) attached automatically. Any ideas how to do this? I looked in backend carefully and it doesn't seem to have any settings for this. I'd do php trim or smth else but there should be easier way to do this...


Resetting admin post form on JS validation fail

I've got a custom plugin with a metabox and dynamic form (the user can ask for more elements of the form), with jQuery Validation plugin working great. The problem is when the validation comes back false (i.e. the form doesn't pass the validation checks) the Save Draft button and its throbber don't get reset. The user can still click the Save Draft button, but it's kind of messy: it doesn't show its true state. So, how do I reset the Save Draft button, and turn off the throbber? UPDATE: Here's the code. The form:

                 Title                 <input type="text" ru-title="true" value="" name="ru-title-1">

                 Lineup                 <input type="text" ru-lineup="true" class="ru-lineup ui-autocomplete-input" value="" id="ru-lineup-1" name="ru-lineup-1" autocomplete="off">                 <input type="hidden" value="" id="ru-lineupid-1" name="ru-lineupid-1">

                 See More Label                 <input type="text" ru-seemore-label="true" value="" name="ru-seemore-1">

                 See More Link                 <input type="text" ru-seemore-link="true" class="url" value="" name="ru-seemorelink-1" id="ru-seemorelink-1">

             <input type="button" value="Delete" class="ru-delete" name="ru-delete-1" id="ru-delete-1" disabled="disabled">         <input type="button" value="More Lineups" id="ru-morebtn">

      And here's part of the validation code; it handles just the first of the four fields, but it's enough to give the idea. The others are pretty much the same sort of thing.               // Add validation to form     $('#post').validate();     $.validator.addMethod('ru-title'         , function(value, element, param) {             var counter = $(element).attr('name');             counter = counter.replace('ru-title-', '');             var title = $('input[name=ru-title-' + counter + ']').val();             var id = $('#ru-lineupid-' + counter).val();             var res;             if (counter == 1) {                 if ((title == '' && id == '') || (title > '')) {                     res = true;                 } else {                     res = false;                 }             } else if (title == '') {                 res = false;             } else {                 res = true;             }             return res;         }         , 'Title is required.'     );


HTML Excerpt causing issues

Hi I have this code to give me an HTML version of the excerpt box on the edit post screen, however when I'm in the HTML tab of the editor and switch to Visual I only see a blank page. Reloading the page fixes it. The issue is definitely caused by this code as without it everything works fine. Any idea what needs to be fixed here?               function tinymce_excerpt_js(){ ?>         <script type="text/javascript">                 jQuery(document).ready( tinymce_excerpt );                     function tinymce_excerpt() {                         jQuery("#excerpt").addClass("mceEditor");                         try {                         tinyMCE.execCommand("mceAddControl", false, "excerpt");                         tinyMCE.onAddEditor.add(function(mgr,ed) {                             if(ed.id=="excerpt"){                                 ed.settings.theme_advanced_buttons2 ="";                                 ed.settings.theme_advanced_buttons1 = "bold,italic,underline,seperator,justifyleft,justifycenter,justifyright,separator,link,unlink,seperator,pastetext,pasteword,removeformat,seperator,undo,redo,seperator,spellchecker,";                             }                         });                         }                          catch(e) {                         // ignore                         }                                             }         </script>     <?php }     add_action( 'admin_head-post.php', 'tinymce_excerpt_js');     add_action( 'admin_head-post-new.php', 'tinymce_excerpt_js');          function tinymce_css(){ ?>         <style type='text/css'>             #postexcerpt .inside{margin:0;padding:0;background:#fff;}             #postexcerpt .inside p{padding:0px 0px 5px 10px;}             #postexcerpt #excerpteditorcontainer { border-style: solid; padding: 0; }         </style>     <?php }     add_action( 'admin_head-post.php', 'tinymce_css');     add_action( 'admin_head-post-new.php', 'tinymce_css');          function prepareExcerptForEdit($e){         return nl2br($e);     }     add_action( 'excerpt_edit_pre','prepareExcerptForEdit');


Setting a custom sub-path for blog without using pages?

## Warning: fairly pedantic request ahead. I have a design that makes use of posts (I.e., the blog) and a custom post type called "howto". The site front page ("/") has a template that displays the latest blog posts and latest howtos. When the user navigates to the blog section ("/blog"), they see a different template than when they navigate to the howto section ("/howto"). I know the obvious way of doing this is to create two pages ("Blog" and "Home"), then use the drop-downs in Settings->Reading Options to explicitly set those. I can then associate specific page templates to those posts. But darned if that isn't really messy -- I'll have two useless empty pages cluttering any admin-side list of pages with actual content in them. You'd think there'd be some way to use template hinting to prevent this from being necessary:   * /howto/ -> archive-howto.php   * /blog/ -> archive.php So really, I guess the question really is as follows: **How does one set a custom path for posts without creating a new page?**


How to know if a child theme is being used?

I have inherited the job of editing my agency's webpage. I didn't create the site, and I am not sure whether the IMW custom theme that is active is a child type theme for 2011, or whether all customizations up to this point have been made to the original theme. Do need to create a child theme for this site, how to do that considering all the customizations that have already been applied. What do I need to provide to support for answers I read some of the answer posts but still am unsure. So If I do not see "Child" in the CSS, then it is not a child theme? I was thinking that maybe the IMW Custom theme was a child theme itself based on the 2011 theme, just without the word child being used to designate it as such. IF IT IS NOT A CHILD THEME, then all of the customizations up to this point have been done to the theme itself. How would I go about creating a child theme from this point? I am so confused.


Menu items do not "open" when mouse hover over them?

I am using "basic magazine" wootheme, and for some reason my top menu navigation bar doesn't "open" when I hover the mouse above it: http://www.danceinisrael.com/ Is there some CSS problem there? How can I detect/fix the problem? Thank you.


Add Taxonomy Values Within a Custom Post Type RSS Feed

I would like to display taxonomies within an RSS feed. I am able to display my custom fields as per Add Custom Fields to Custom Post Type RSS (Thank you to all the contributors of that post), but I am unable to display fields that contain taxonomy values. Here is the code I am using:               add_action('rss2_item', 'yoursite_rss2_item');     function yoursite_rss2_item() {     if (get_post_type()=='listings') {          $fields = array(          'listing_category',         'listing_type',         'listing_bedrooms',         'listing_city',          );          $post_id = get_the_ID();     foreach($fields as $field)       if ($value = get_post_meta($post_id,$field,true))         echo "<{$field}>{$value}</{$field}>\n";       }     }      Here are the 2 taxonomy fields that are not showing:   * "listing_category" - either "For Sale", "For Lease", or Both (multiple values).    * "listing_type" - 1 value containing "Condo", "House", "Land", or "Building". Any help is greatly appreciated.


How to store and retrieve the attachment alignment?

I am working on a project, where I want to display all image attachments of a post. Getting the URL and size of the images is not a problem, since both get stored in the database, if the image gets edited in the media-uploader. The problem is, that I need the alignment options as well. Sadly the alignment settings do not get stored anywhere in the database. It is only used temporary if I add the image to the post. I need a way to store the alignment-settings in the database, if they get edited. I know I can add a custom field to the media uploader, but since there already is an Align-Field I would like to avoid duplicating it. I do not really know where to start, as I am not very experienced in hooks and filters, or the media-uploader. Maybe there is a way to store and retrieve the setting in the attachment post meta?!


WP_Query Performance Issues with meta_query

I'm working on a custom template for a new theme that uses a `WP_Query` instance to select posts from 2 post types with 2 custom fields that are NOT empty. Depending on the section of the site, a `$current_zone` variable may be set to determine the category to query from.               // Custom loop     $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;     $custom_loop_args = array(         'post_type' => array('videos', 'post'),         'post_status' => 'publish',         'ignore_sticky_posts' => 1,         'paged' => $paged,         'meta_query' => array(             'relation' => 'OR',             array(                 'key' => 'article_source',                 'compare' => '!=',                 'value' => ''             ),             array(                 'key' => 'article_link',                 'compare' => '!=',                 'value' => ''             )         )     );          // Check the current zone     global $current_zone;          // Check for category match to current zone     if ( term_exists($current_zone, 'category') ) {         $term = get_term_by('name', $current_zone, 'category');         $custom_loop_args['cat'] = $term->term_id;     }          // Create unique identifier for caching     $cache_id = ( isset($term) ) ? '_term-' . $term->term_id : '_main';          // Run query or get transient cache     if ( ( $custom_loop = get_transient( "curated_wpquery$cache_id" ) ) === false ) {              // It wasn't there, so regenerate the data and save the transient         $custom_loop = new WP_Query( $custom_loop_args );         set_transient( "curated_wpquery$cache_id", $custom_loop, ( 60 * 60 * 1 ) );     }      I'm using the transients in an effort to speed this up, which does work, but the initial query takes 35 seconds and a crazy amount of memory to complete. We have a pretty large database, with about 10,553 records in the `posts` table. I've cleared out revisions, but haven't noticed a performance increase. So my real question is, how can I improve the performance of this query? Would a custom `$wpdb` query be best, or is querying custom fields in this way unproductive altogether? Any help is much appreciated.


Theme Customizer – Conditional Controls

I would like to dynamically add / remove Controls to/from the theme customizer without completely reloading the customizer page. For example when I choose option1 from a drop down I want control A to show and control B to hide and vice versa. I can think of three ways to do it: 1.Find a way to reload the customizer completely (via submit button or via javascript) then I can do this:               $option1 = get_theme_mod('option1');     if( $option1 === '1' ){         $wp_customize->add_setting('controlA', array());         $wp_customize->add_control( 'controlA', array(         'section' => 'layout_section',         'type'    => 'text', // text (default), checkbox, radio, select, dropdown-pages ) );     }      2.Use Ajax to load the updated values and populate the customizer controls with javascript. So I would enqueue my own script like this:               function custom_customize_enqueue() {         wp_enqueue_script( 'custom-customize', get_template_directory_uri() . '/custom.customize.js', array( 'jquery', 'customize-controls' ), false, true );     }     add_action( 'customize_controls_enqueue_scripts', 'custom_customize_enqueue'        );      And in custom.customize.js I would call a function to get my control values:               $.ajax({         url: ajaxurl,         type: 'POST',         data: {             'action':'get_control_values'         },         success:function(data) {                  //populate customize controls with the updated values              }     });      In functions.php:               function get_control_values(){              $option1 = get_theme_mod('option1');         if( $option1 === '1' ){                   // echo json_encoded data to populate my conditional customize controls         }     }          add_action( 'wp_ajax_get_control_values', 'get_control_values' );     add_action( 'wp_ajax_nopriv_get_control_values', 'get_control_values' );      3.Create a custom control that contains all inputs that conditionally depend on each other as "dummy" inputs and storing their values in another - hidden - input as JSON. So when I choose option1 from the drop down, control B will be hidden by javascript and the JSON string will be updated etc. EDIT: 4.Option: Maybe this is also possible through the WordPress Theme Customizer Javascript Interface as described here: http://shibashake.com/wordpress-theme/wordpress-theme-customizer-javascript- interface Can someone point me in the right direction? Thanks.


Help with a childtheme

I'm looking to put a slider into the header of my childtheme. I'm using the Govpress free theme I really don't know where to start. Any suggestions/advice to make this work?


Co-authors plus problems with query_post

I had a query_post that worked, aimed lists only posts by author own, but now that I updated wordpress stopped working. The query_post only works when you have only one author. I updated WordPress 3.2.1. to 3.7.1 Index.php               <?php $post_count = 0; ?>     <?php get_header(); ?>
     <?php if (have_posts()) : ?>     <?php          if ($user_level == '1'){              global $current_user;             get_currentuserinfo();             query_posts("author=$current_user->ID&showposts=4&paged=$paged");          }      ?>

                     <?php $walker = new Menu_With_Description; ?>                     <?php wp_nav_menu( array( 'theme_location' => 'content-menu', 'menu_class' => 'nav-menu', 'walker' =>  $walker ) ); ?>

Posts
             <?php while (have_posts()) : the_post(); ?>                      <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
                     <?php comments_popup_link( '0', '1', '%', 'comments-link', 'Comments are off for this post');?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Post: %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?>

                     <?php the_excerpt() ?>

             <?php $post_count++; endwhile; ?>          <?php if ($post_count == '0' and $user_level == '1'){              echo 'tour';             echo $post_count;             } ?>

<?php next_posts_link( __( '← Older posts', 'twentyten' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'twentyten' ) ); ?>

                  <?php else : ?>
<?php _e('Not Found', 'kubrick'); ?>

<?php _e('Sorry, but you are looking for something that isn’t here.', 'kubrick'); ?>
             <?php get_search_form(); ?>         <?php endif; ?>

     <?php get_footer(); ?>


Permalink Trouble with Custom Post Type

I have a custom post type called "work" and it has a taxonomy called "categories". Currently "/work" and "/work/category_slug/work_slug" works great. However "/work/category_slug" does not. I get a 404 page. Any ideas what I can do?               register_post_type('work', array(     'label' => 'Work',     'description' => '',     'public' => true,     'show_ui' => true,     'show_in_menu' => true,     'capability_type' => 'post',     'map_meta_cap' => true,     'hierarchical' => false,     'rewrite' => array('slug' => 'work', 'with_front' => true),     'query_var' => true,     'has_archive' => true,     'supports' => array('title','editor','custom-fields','comments','revisions','page-attributes'),     'taxonomies' => array('categories'),     'labels' => array (       'name' => 'Work',       'singular_name' => 'work',       'menu_name' => 'Work',       'add_new' => 'Add New',       'add_new_item' => 'Add New Item',       'edit' => 'Edit ',       'edit_item' => 'Edit Item',       'new_item' => 'New Item',       'view' => 'View',       'view_item' => 'View Item',       'search_items' => 'Search Items',       'not_found' => 'No Work Items Found',       'not_found_in_trash' => 'No Work Items found in Trash',       'parent' => 'Parent Work Item',     )     ) );                register_taxonomy( 'categories',array (        0 => 'work',     ),     array( 'hierarchical' => true,         'label' => 'Categories',         'show_ui' => true,         'query_var' => true,         'show_admin_column' => false,         'labels' => array (       'search_items' => 'Category',       'popular_items' => '',       'all_items' => '',       'parent_item' => '',       'parent_item_colon' => '',       'edit_item' => '',       'update_item' => '',       'add_new_item' => '',       'new_item_name' => '',       'separate_items_with_commas' => '',       'add_or_remove_items' => '',       'choose_from_most_used' => '',     )     ) );


How is it possible that the function of the test page works, but it does not go live?

I want to load the new entries without reloading the page.   I found a great solution for:   The ajax script:               <script>         $(document).ready(function() {         var refreshId = setInterval(function()         {             $('#content').fadeOut("fast").load('http://neocsatblog.mblx.hu/new.php').fadeIn("fast");         }, 10000);              });     </script>      And the php:               <?php require_once("wp-blog-header.php"); ?>     <div id="content" <?php cyberchimps_filter_content_class(); ?>>                  <?php do_action( 'cyberchimps_before_content'); ?>                  <?php if ( have_posts() ) : ?>                      <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', get_post_format() ); ?>                      <?php endwhile; ?>                  <?php elseif ( current_user_can( 'edit_posts' ) ) : ?>                      <?php get_template_part( 'no-results', 'index' ); ?>                  <?php endif; ?>                  <?php do_action( 'cyberchimps_after_content'); ?>              </div>      However, this is a special feature that works perfectly here: http://neocsatblog.mblx.hu/test/ However, the main page refuses to load new entries, I do not understand the reason for this, as we use everything the same.


Storing temporary data for a custom post type

I've created a Rental custom post type to a rental site I'm developing for a client. I'd like to add an ajax availability calendar in the backend so the client can mark/unmark unavailable dates clicking on them, such as this: http://i61.tinypic.com/j5l10p.png I need to temporary store the marked dates somewhere so they don't get lost when the client moves through months back and forth. I'm wondering if using transients is the best option for this. Any ideas? Thanks in advance


Some questions about how proper add 2 CSS file in a WordPress theme?

I have the following situation loading a CSS. I have a WordPress theme that load a **style.css** settings file by this code into my **functions.php** file:               /* Function automatically executed by the hook:      * 1) (OPTIONAL): Register a script (without load it): in this case register the CSS settings      * 2) Load the CSS settings           */     function wpb_adding_styles() {         wp_register_style('my_stylesheet', get_template_directory_uri() . '/style.css');         wp_enqueue_style('my_stylesheet');     }          /* Hooks a function on to a specific action (an action is a PHP function that is executed at specific      * points throughout the WordPress Core)      * @param 'wp_enqueue_scripts': The name of the action to which 'wpb_adding_styles' is hooked (wp_enqueue_scripts      *        is the proper hook to use when enqueuing items that are meant to appear on the front end)      */     add_action('wp_enqueue_scripts', 'wpb_adding_styles');      In this **style.css** file I define some basic CSS configuration, for example the body settings:               body{         padding:0px;         margin:0px;         font-family:Arial, Helvetica, sans-serif;         font-size:12px;     }      Then I have create a new **style2.css** settings file in which I would override\add some of the properties defined into my general **style.css** , following the previous example I would add the property that the body background have to be black, something like it:               body {         ........         ........         ........         background: #000;     }      Ok, so I think that I need to load the **style.css** file using the **style2.css** file as its dependencies, reading the documentation it seems to me that I can do something like it (or maybe the opposite?):               function load_theme_styles() {          wp_enqueue_style('main-css', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');     }     add_action('wp_enqueue_scripts', 'load_theme_styles');      where array() should not be empty but it have to contain the **style2.css** Is it a good solution to keep separate a general CSS file that have not to be edited (for example a css file of a CSS framework such as BootStrap with its original settings) and the have a custom CSS file in wich I override the settings that I want to change? If this is a goog solution can you say me how to pass in the previous array my **style2.css** file? UPDATE 1: I have change my **wpb_adding_styles()** in this way: my **main- css** depends from **style2.css**.               function wpb_adding_styles() {              wp_enqueue_style('style2', get_template_directory_uri() . '/style2.css', array(), '1.0', 'all');         wp_enqueue_style('main-css', get_template_directory_uri() . '/style.css', array('style2'), '1.0', 'all');          }      It seems work well but I am not sure if it is the right solution because if I delete the dependency it work well again               wp_enqueue_style('main-css', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');      Tnx Andrea


Trying to split a query into sections of six

I have a query which returns all custom post, I'm trying to split all post into sections of six then wrap them in an list item. Right now its performing as it should but breaks when it get to the 12 post, their are a total of 40 post. Im not sure what wrong could someone help.               <?php                   $args = array(                 'post_type' => 'portfolio',                 'posts_per_page' => -1                             );          $loop = new WP_Query( $args ); while ( $loop->have_posts()) : $loop->the_post(); ?>          <?php if($count === 1 ): echo "
"; endif; ?>              <?php if($count % 7 == 0 ): echo "
"; endif; ?>
             <?php the_post_thumbnail('portfolio-large'); ?>
<?php the_excerpt(); ?>
             <a href="<?php the_permalink(); ?>" style="color:#fff;">more info
          <?php if($count % 6 == 0 ): echo "
"; endif; ?>          <?php endwhile; wp_reset_query(); ?>


Parsing a shortcode through an author meta textfield

I have been using the UPME plugin to design a member profile website that allows me to take information and show each user different profiles depending on a shortcode I put into a textarea field. The problem I am having is using the `do_shortcode` call in my `functions.php`. I am not 100% sure if the field is being called correctly. I know it's not working as the shortcode is not loading anything up, but I do know the name of the textarea field is definitely `view_matches`. Here is what I have so far `print do_shortcode(the_author_meta( 'view_matches' ));`


How to make Custom Loop not crop featured images?

When using Custom Loop to display a lot of posts on a page, you use Featured Image to display the images on that page. However, cropping occurs if the images are higher than 208 pixels, and I want my images to display at their original size ( about 210x270 ). How do I prevent the cropping of the images.


get_post_meta property of non object

I am getting a custom field outside the loop in header.php. I get the custom field just fine but I found that when the custom field is empty, I get an error message                 Trying to get property of non-object       Here is my code                <?php $description = get_post_meta( $post->ID, 'page-description', true ); ?>
                 <?php if( !empty($description)) { ?>
<?php echo $description; ?>
                 <?php } ?>      I did some searching on this site and one post said to globalize the $post variable. I tried that but didn't work. I can't figure out what is wrong with it.


Generate daily archive whenever any post type is added

We have an issue with our date archive in WordPress, where our daily archive (example address www.xxx.com/2013/01/09) is only generated when a post from the default post type is added. Any day where a default post type was not posted, results in a 404 not found. If we go to a day where a default post type was posted, we have no problems seeing articles from all post types via this function (from another stackexchange thread)               function custom_post_date_archive($query) {     if ($query->is_date)         $query->set( 'post_type', array( 'news', 'sports', 'life', 'opinion', 'culture','community' ) );         remove_action( 'pre_get_posts', 'custom_post_date_archive' );     }     add_action('pre_get_posts', 'custom_post_date_archive');      We've also tried other functions where we generate a daily archive URL for each post type (for example www.xxx.com/news/2013/09/01), but that is not the URL format we would like. Basically we would like a way to tell WP to generate the base daily archive URL when ANY post type is added. This was working previously, however, when a separate rewrite function was added to the functions file, daily archive generation for all post types ceased. We've tried all types of rewrie flushing, to no avail (though the addresses do work, just that WP only thinks to generate www.xxx.com/2013/01/09 if a default post is made). Is there a function that can tell WP to always generate that address whenever any post type is added? Or is there another way to flush the system?


Create an Info/Help message at top of a custom post type

I'm wondering how you go about creating an info/help message at the top of a custom post type in WP's dashboard? I often see these at the top of plugins and Id like to do the same thing for my custom post types if possible ( _see image below for example --- Note: Screenshot has been taken fromNSP-Code's "Post-Types Order" plugin on the settings page"_)   ![enter image description here](http://i.stack.imgur.com/KlJq1.jpg) # EDIT #1 Thanks for the help everyone! It appears that I have two distinctly different ways available to me in how I can approach this as outlined by @Stephen & @Bainternet...Both look like viable options so Im going to try them all out and report back with what seems to work best in my situation. Thanks again for the assistance. WPSE is by far my fav place to learn new things about Wordpress, this place is great.


Create an archive page for custom taxonomies

I switched my site from categories to taxonomies for my custom post but I am having trouble getting it to work the same way. For categories I could have templates named something like `category-travel.php` and then have my loop in that file. Now I am trying to replace the category list with something like this :               <?php       $taxonomy = 'Gallery';     $orderby = 'name';     $show_count = 0;     $pad_counts = 0;     $hierarchical = 1;     $title = '';          $args = array (         'taxonomy' => $taxonomy,         'orderby' => $orderby,         'show_count' => $show_count,         'pad_counts' => $pad_counts,         'hierarchical' => $hierarchical,         'title_li' => $title         );          wp_list_categories($args) ?>      and in functions               register_taxonomy( 'Gallery', array( 'photo' ), array( 'hierarchical' => true, 'label' => 'Galleries', 'singular_label' => 'Gallery', 'rewrite' => true ) );      Now when I link from that generated list, something like `mysite.com/gallery/name` it is instead calling the `archive.php` rather than the `taxonomy-gallery.php` file I created. What am I doing wrong? Sorry if this is a duplicate but I think that question is for something different and I cant believe that you would have to do a hack for this.


how to make <!--more--> function in RSS feed like it does in posts

I'm dealing with an RSS feed problem that is making me crazy. I have begun manually incorporating in my recent blog posts in order to cut off the post at the desired spot and entice people to click to the post page in order to finish reading. In other words, I'm manually specifying the length of the teaser by inserting . My site works exactly how I want it to work, but I want my RSS feed to function in the same way. In other words, I want the post in my RSS feed to cut off at and link to the original post so subscribers have to visit my site to continue reading. I know that this is possible because some of my favorite blogs work this way (for example, 101cookbooks.com and smittenkitchen.com). I don't want to just see a text excerpt/summary feed. I want the text and photos up to the code to display in my feed exactly as they do on my home page! Please help! I've googled and googled and I can't find the answer. Thank you, Kate


Custom field Search with Relavanssi

The site I'm working on is a talent website that has actors names, headshots, and resume all created with post_title, featured images, and custom fields. I am using Relavanssi to make my search results work a little better. However, I am running into a problem where if the user search for "John" it works well with all the actors with "John" in their name come first and then anyone with "John" in their resume (custom fields) come after. But if the user search for, say, "Spanish" (meaning they are looking for an actor that speaks Spanish) the results come up randomly and not in any order. I want them to be ordered by the title of the post (which is also the name of the actor). So, short version: If a user searches for a name, it should come up with those names first. If a user searches for a field it should come up as alphabetical. I realize that I probably need two different search forms for this or at least two different fields, and I know how to create multiple forms with hidden fields to differentiate (which is fine), but I don't know how to make that work and still use Relavanssi or a similar plugin to run both searches for me.


how to add custom logo to my template

So now it should be somewhere here. I still have no idea how to do it :<
             <?php                           PC_Utility::pc_display_theme_logo($options);                      $options = get_option( PC_OPTIONS_DB_NAME );                 if ( !isset($options[ 'chk_hide_description' ]) ) { ?>
<?php bloginfo( 'description' ); ?>
                 <?php } ?>


How do I add an indicator to my .menu-item if it contains a .sub-menu?

If your common with the code that wp_nav_menu function generates. You should know what im asking for. I need to add an indicator like a plus sign or an arrow to indicate that this menu-item has a sub-menu. I cant find a class or id that would allow me to do that. Im guessing ill need a plugin for this? BUT I need some opinion first. Thanks..