title: Which post does a taxonomy term belongs to?

text: I’m having a page which displays all custom taxonomy terms for a particular type which I get from the URL. I use this code to retrieve all the terms:               $args = array(     'post_type' => 'mycustomposttype',     'programtype' => ’my-custom-taxonomy-term     );     $programtype = new WP_Query($args);     while ( $programtype->have_posts() ) : $programtype->the_post();     $terms = get_the_terms( $post->ID, 'my-custom-taxonomy );      This all works perfectly fine but then I want to produce a link, when pressing on each of the terms to redirect back to the original custom post it belongs to. Let me give an example: The custom post type “Programblock” with ID 19, has three custom taxonomy terms attached to it, which is called “events”. The three terms is listed on above mentioned page, but then I want to produce a link which takes them back to the custom post type page “Programblock” with the post ID as hashtag, like this: http://www.my-domain.com/programblock#19 How can I reverse this so Instead of asking “Which terms does this post has” I want to ask, “Which post does this term belongs to”. I hope I’ve explained myself clear enough, otherwise please ask. Sincere   - Mestika


title: Add class to the items in wp_list_pages

text:
I just want to add a class for the active page in the wp_list_pages().Is it possible? If so can I provide a particular class for a active page. Here is my code for listing the parent page and its sub page.                      <?php                    $output = wp_list_pages('echo=0&depth=1&title_li= &sort_column=menu_order' );     if (is_page( )) {       $page = $post->ID;       if ($post->post_parent) {         $page = $post->post_parent;       }            $children=wp_list_pages( 'echo=0&depth=1&child_of=' . $page . '&title_li=&sort_column=menu_order' );       if ($children) {         $output = wp_list_pages ('echo=0&depth=1&child_of=' . $page . '&title_li= &sort_column=menu_order');       }     }     ?>
<a href="<?php echo get_permalink( $post->post_parent ); ?>" class="active">Home
     <?php      echo $output;                             ?>      Please help me.I want add the class name "active" to the active page in the wp_list_pages(). For example I want to display my WP pages as follows.If 1 select the sub page 3 I want to add the class active only to that particular page

Home

1

2

3

4

5


title: How to rewrite a URL to another rewritten URL without changing the address?

text: Just got to the end of a site build and the client is now saying the original site URL's need to stay the same and do not want to do 301 redirects due to loss of link juice. The structure of the site has changed so not possible to match the URL structure. I have been trying to figure out how to rewrite the URL's so that they stay the same in the address bar but map to different content. As an example Old URL: `advisories/sos-12-11` New WordPress rewritten URL: `relateditem/sos-12-11` Have tried:               RewriteRule ^advisories/([A-Za-z0-9-]+)$ index.php?relateditem=$1 [L]      With Permalinks set to custom (/%postname%) this maps through to the right location but changes the address in the address bar. With Permalinks set to default it just maps to the home page and does not change the address bar. Seems the two are interacting but cannot figure out how. Any help greatly appreciated!


title: Buddypress Fake (non-bot) Users

text: BuddyPress Newbie question: I have a brand new site running WP 3.3.1 and BP 1.5. Even before launch I am plagued with numerous fake users every day. I don't think they are bots, because I have a math question at registration, and email activation enabled. They register, usually with a gmail address, and then activate and post updates containing spam links of all sorts. I haven't been able to find any real ideas on how to stop non-bot spammers, and have pretty much given up on an automated solution. Barring that, is there a way to hold new users for admin approval and prevent them from posting until they are approved? Any solutions are greatly appreciated! Thanks! Diana


title: How to include sticky posts in 'Blog pages show at most' X number of posts?

text: I'm using the default Loop Code. I've set the 'Blog pages show at most' option in Settings > Reading to 11. In my home page -set to show Latest Posts- whenever I mark a post as 'Sticky' it's being added to the original 'Blog pages show at most' count, so the home page now shows 12 posts instead of 11. I want to avoid this! I want to keep 11 posts in total, that being -in the example above- 1 Sticky post plus 10 normal posts. Is this possible? I've already tested this with default themes and all plugins turned off. Any help will be very much appreciated. * * * So far I've found that I could modify the main query using pre_get_posts. What I intend to do then is query for only the sticky posts, and then merge that query with the main query. I found this snippet but I'm having problems converting that into a pre_get_posts working function.               $newsposts = array();          $sticky = get_option('sticky_posts');     $args = array(         'post__in' => $sticky,         'posts_per_page' => $num     );     $sticky_posts = get_posts($args);          if( count($sticky_posts) < $num ) {         $extras = $num - count($sticky_posts);         $args= array(         'post__not_in' => $sticky,         'posts_per_page' => $extras     );     $extra_posts = get_posts($args);     $newsposts = array_merge($sticky_posts, $extra_posts);     }     else $newsposts = $sticky_posts;


title: MP4 upload ok, but HTTP500 if I update the file (multisite)

text: I am trying to make available a mp4 video of ~500Mb but my connection is too slow to do this at home. To achieve this, I uploaded the video via ssh from school then i used the wordpress media manager to upload a mp4 file of 1 byte. Once this file is uploaded, I went through ssh to its directory then I moved the 500Mb file to replace it. The problem is after that I get an HTTP 500 error, even if : - both of the original file (1B) and the replacing file (500Mb) are given 644 perms and the same owner/group - I checked that the filename is the same, it can not be an error like this. Here is my htaccess :               AddType video/mp4 .mp4 .m4v          SetEnv REGISTER_GLOBALS 0     SetEnv ZEND_OPTIMIZER 1     SetEnv MAGIC_QUOTES 0     SetEnv PHP_VER 5          SetOutputFilter DEFLATE     AddOutputFilterByType DEFLATE text/html text/xml application/xhtml+xml text/plain application/javascript text/css     BrowserMatch ^Mozilla/4 gzip-only-text/html     BrowserMatch ^Mozilla/4\.0[678] no-gzip     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html     SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary          ExpiresActive On     ExpiresByType image/jpg "access 1 year"     ExpiresByType image/jpeg "access 1 year"     ExpiresByType image/gif "access 1 year"     ExpiresByType image/png "access 1 year"     ExpiresByType text/x-javascript "access 1 month"     ExpiresByType application/x-shockwave-flash "access 1 month"     ExpiresByType application/pdf "access 1 month"     ExpiresByType image/x-icon "access 1 year"     ExpiresDefault "access 2 days"          RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      I can not figure out the problem. Does anyone know ? I forgot to specify that it is a multisite wordpress. Thanks a lot !


title: How To Grab All Type Of Attachments, But Images?

text: I need to get all file attachments which is not an image,   'post_mime_type' only accepts "any" or specific mime types, How to grab all type of attachments, but images?


title: Two posts in same div - WP loop

text:
I would need the following in Wordpress:

Title 1

Title 2

Title 3

Title 4

      I know how to get posts with WP loop, but how can I wrap every two posts in .posts-wrapped div? I fetch the posts with WP_Query. Thanks! EDIT: So I tried few ways to do it. For example with this:               $index=0;
          <?php     while ( have_posts() ) {         $index++;        ?>

<?php the_post(); ?>

 <?php     if(($index % 2) ==0){     echo '

';     }     } ?>
      But this prints one extra empty posts-wrapped div:
         Lorem ipsum 1
         Lorem 2 ipsum est

         Lorem ipsum 1
         Lorem 2 ipsum est

      How can i get rid of this last empty div? It screws my carousel (this content is part of carousel).


title: Custom Post Types don’t highlight in menu nav

text: Working on a theatrical events site. The structure requires several separate events areas, each with a top page listing events in the particular area, and corresponding individual events pages underneath the listings page. Since each of the event area pages require a different treatment, I thought this was a good situation for custom post types, using both single-[event] and archive-[event] templates for each area. I installed Custom Post Types UI to make the custom post types (including matching custom taxonomy) and Advanced Custom Fields to make meta fields. So far so good. The Archive custom post type (full listing of area events) pulls meta from the Single custom post type, and both custom post pages display correctly except for one thing: the main nav menu no longer highlights the active web page on the Archive listing. [Note: there are many posts about how to highlight submenu Single custom posts to match parent; I don’t need that, just need the current Event Area to highlight correctly in main menu nav!] I realized I had constructed my main nav – which includes the event areas – with wp_nav_menu and register_nav_menus. So the event areas corresponding to Archive custom posts were originally constructed as Pages and the main nav was set up using WP Menu’s drag and drop capability. Wordpress correctly defaults to the archive-[event] custom post template (and ignores the existing Page with same name), and the nav menu is functional in terms of links, but doesn’t highlight the Archive custom post link in the nav. Pages in the main nav work correctly. When I check output on Event Area, there is a “current_page_parent” class attached to the Blog nav, but no “current-menu-item” elsewhere, which I guess is appropriate for custom posts. I suppose if wp_nav_menu is just for Pages, this makes sense as the top-level archive posts won’t be recognized, but I have no clue how to fix it. I’m will to try hacks, but want to avoid ID- specific ones or jQuery if possible. One thought would be to chuck the archive-[event] template, and use a regular page template for the listing while keeping the true single-[event] custom type post. Any reason faking it that way couldn’t work? Thanks for any advice, hope I'm missing obvious/easy approach.


title: Beginner advice

text: Hi I am a self tought web developer with a year experience in using html/css/javascript/ and only just recently learned php/mysql for about 4 months.I have never used a cms before and now I was recently asked to learn Wordpress in a month with all it's features. As I was told I have to learn it from more of a developers point of view so theme development and plugin development is a must. What I want to ask is 8 hours a day enough for learning Wordpress in a month?And can I get some recommendations on what books should I read to get up to speed on what I need to know? I have seen that most of the books that are out are talking about Wordpress 3 but the most recent version is Wordpress 3.3.Will it confuse me if I learn from a book that teaches from an earlier version?


title: How to pass users back and forth using session data?

text: I have applications that I wrote that use SAML and then a user database to define permissions for them all. And basically once a user signs on via our SSO they can use the applications with their defined perms. I want to do the same thing for WP. Where do I start? I would like WP to recognize their session username before they login and then create wordpress cookie. I saw a root cookie plugin that would pass the user info to other wp sites but how about getting the session username to begin with? I would like users to come to WP site and see that they are logged in with their username but I am open for other ways too. Right now what is given to me for SAML authentication is:   * app url: redirect to the SSO sign in   * app key: hash to encrypt   * uid   * firstname   * lastname   * email   * time (POST time is used for validation) **Note:** I have just tried using the SAML2 plugin for WP. First it is a beta plugin and very confusing. Second I keep getting fatal error that it cannot find IDP information. Would really just like to take the session uid I have an log a person in using that.


title: Access for adding subpages but not for pages

text: For every website project, i make the wordpress admin custom for the client. Right now, i want that the client only has access to add subpages. I have a main navigation on the website. I want that the main navigation is fixed, so the client can not add pages to the navigation. But the client can add subpages to the current pages in the fixed main navigation. I googled it, but i can't find a solution. I know i can show menu items on a specific id. So i can make the main navigation fixed. Example:               <?php wp_list_pages('include=7,13,26,35&title_li=<h2>' . __('Pages') . '</h2>' ); ?>      But, does it show the subpages id's thats below the page id? And is there not a cleaner way? Because with this solutation the client has still access to create pages. I only hide the created pages on the front website. Hope someone can help me. Many thanks,


title: Exclude category from fucntion

text: ## QUESTION Hey guys, I have this function and I need to exclude 2 categories: 81 and 82. Can You help? :) ## CODE               function has_related_same_cat_posts(){     global $post;     $categories = get_the_category($post->ID);          if ($categories) {         $category_ids = array();         foreach($categories as $individual_category)              $category_ids[] = $individual_category->term_id;              $args=array(         'category__in' => $category_ids,         'post__not_in' => array($post->ID),         'posts_per_page'=> 4, // Number of related posts that will be shown.         'caller_get_posts'=>1,         'orderby' => 'rand',              );              $my_query = new wp_query( $args );         if( $my_query->have_posts() ) {             $return = true;         } else {             $return = false;         }          }          return $return;     }


title: Add an image gallery to a custom post type?

text: I am pulling data from an external web service into a custom post type. This data includes images. How can I create an image gallery, add some existing attachments to it, and associate it with a post? What I was hoping to find is something like a `set_post_gallery` counterpart to the `get_post_gallery` function, but I can't find anything like it in the codex, on google, or in `wp-includes/media.php`. This is how I set up the attachments:               $attachment = [       'guid' => wp_upload_dir()[ 'url' ] . '/' . basename( $path ),       'post_mime_type' => wp_check_filetype( basename( $path ), null )[ 'type' ],       'post_title' => "$mlsNum $id",       'post_content' => '',       'post_status' => 'inherit'     ];          $attachmentId = wp_insert_attachment( $attachment, $path, $this->postId );          // Generate attachment metadata and create resized images.     wp_update_attachment_metadata( $attachmentId, wp_generate_attachment_metadata( $attachmentId, $path ));      And this is how I am trying to retrieve the gallery for the theme:               $gallery = get_post_gallery( $post, false );     var_dump( $gallery );     var_dump( $post );      `$post` is defined, and `$gallery` is false. I was under the impression that `wp_insert_attachment` would create a gallery for the post and add the attachment to it, but apparently this is not the case. If it was, then that would cause other problems for me when I go to attach a PDF to the post.


title: Custom Taxonomy Hierarchy for Custom Post Types (eg Categories and Subcategories)

text: I'm working on building some custom taxonomies for a custom post type I created. The custom post type is `Products`. For the custom post type `Products` I've created a taxonomy of `Category`. Now Under `Category`, I'd like to have a taxonomy of `Sub_Category`. I've created all the taxonomies and set them to hierarchical, but the `Sub_Category` tax seems to be relative to the `Product` Custom Post Type, NOT the `Category` custom taxonomy. Is there a way to do this? I saw a screenshot where someone was filling out a taxonomy form for a taxonomy they created and it had an option for PARENT but I could never get that to show up. How can I choose a PARENT `Category` taxonomy on my `SubCategory` taxonomy? Here is my `Category` and `SubCategory` taxonomy code:               function create_productcategory_taxonomy() {         $labels = array(             'name' => _x( 'Categories', 'taxonomy general name' ),             'singular_name' =>_x( 'Category', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Categories' ),             'popular_items' => __( 'Popular Categories' ),             'all_items' => __( 'All Categories' ),             'parent_item' => null,             'parent_item_colon' => null,             'edit_item' => __( 'Edit Product Category' ),             'update_item' => __( 'Update Product Category' ),             'add_new_item' => __( 'Add New Product Category' ),             'new_item_name' => __( 'New Product Category' ),             'separate_items_with_commas' => __( 'Separate categories with commas' ),             'add_or_remove_items' => __( 'Add or remove product categories' ),             'choose_from_most_used' => __( 'Choose from the most used categories' )             );              register_taxonomy('tf_productcategory', 'tf_products', array (             'label' => __('Product Category'),             'labels' => $labels,             'hierarchial' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'product-category'),             ));      }          function create_product_subcategory_taxonomy() {         $labels = array(             'name' => _x( 'SubCategories', 'taxonomy general name' ),             'singular_name' =>_x( 'SubCategory', 'taxonomy singular name' ),             'search_items' =>  __( 'Search SubCategories' ),             'popular_items' => __( 'Popular SubCategories' ),             'all_items' => __( 'All SubCategories' ),             'parent_item' => __( 'Main Category' ),             'parent_item_colon' => ( 'Main Category:' ),             'edit_item' => __( 'Edit Product SubCategory' ),             'update_item' => __( 'Update Product SubCategory' ),             'add_new_item' => __( 'Add New Product SubCategory' ),             'new_item_name' => __( 'New Product SubCategory' ),             'menu_name' => __( 'SubCategories' )             );              register_taxonomy('tf_productsubcategory', 'tf_products', array (             'label' => __('Product SubCategory'),             'labels' => $labels,             'hierarchial' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'product-subcategory'),             ));      }          add_action( 'init', 'create_productcategory_taxonomy', 0 );     add_action( 'init', 'create_product_subcategory_taxonomy', 0 );


title: On what point (hook) does the_/has_post_thumbnail() load?

text: I got some problems during my loading priority/order that i already discovered. Now i ran into the problem that i can't use any post_thumbnail functions (get_post_thumbnail_id, has_post_thumbnail, the_post_thumbnail): "Call to undefined function"... Does anyone know at which point these functions are loaded? I would be satisfied if i know after which hook they get loaded. Thanks! Edit: I traced down all files that get loaded on my edit custom post type edit screen. It's 64 file from core before my theme files start loading. Files starting from #26 are:   * /wp-includes/general-template.php   * /wp-includes/link-template.php   * /wp-includes/author-template.php   * /wp-includes/post.php   * /wp-includes/post-template.php   * /wp-includes/category.php   * /wp-includes/category-template.php ... but /wp-includes/post-thumbnail-template.php doesn't seem to load. Weired ... Edit 2: post thumbnail support is activated and i can upload images. Only when i try to view them then i get the error about the id function. My problem is that it worked an hour ago and i need to track down whatever is causing this behavior. Edit 3: Funny. I load my files at init.. right after the file should get included. Plus: I just downloaded wordpress again and replaced the file, so everything from this side should be fine.


title: BuddyPress - A hook available to hide custom born date on public profile view?

text: I'm trying to hide some fields on public BuddyPress profiles, it is possible? Thanks in advance.


title: Filter get_cat_id for Custom Post Type

text:
I have this simple snippet to retrieve the categories (taxonomies) of my Custom Post Type 'portfolio' I need to display each taxonomy but it displays all the categories. I just saw this question Filter get_categories() for taxonomy term in WordPress and unfortunately I tried with no success.               <?php         query_posts("post_type=portfolio");         if ( have_posts() ) : while ( have_posts() ) : the_post();          $catid = get_cat_id('Images');     ?>          <?php          $categories=  get_categories('child_of='.$catid.'&orderby;=name');          foreach ($categories as $cat) {         $input = '
category_nicename.'">';           $input .= $cat->cat_name;           $input .= '
';           echo $input;           }     ?>      Can you please guide me or give me a hint? Thanks so much.


title: WP as an HTML editor

text: Is WP a good HTML editor? A friend of mine wants to create HTML pages, but doesn't know HTML. Can WP become a WYSIWIG HTML editor via the appropriate plugin? He'll be formatting images, wanting to place text in specific locations, etc. Nothing too fancy, but not just text either.


title: Is it possible to have two different previews of a post (ie. two templates for one post)?

text: I'm looking for a way to allow post editors to see two different previews of the posts they are writing. On the front, the same post can appear it two different sections of the website (each shows a different amount of custom fields). How can I create two preview links (for ex : "Preview with template 1" and "Preview with template 2") ?


title: Echo post content from archive page

text: I am trying to pull the latest post content in a archive page into the meta description, this is what I got:                 <?php } elseif (is_tax()) { ?>           <meta name="description" content="<?php                 $current_tag = get_query_var( 'taxonomy' );                $current_tax_tag = $wp_query->get_queried_object()->slug;                 $args = array( $current_tag => $current_tax,                               'numberposts' => 1 );                 $best_post_for_meta = get_posts($args); echo $best_post_for_meta->post_content; ?>">      But I can't find the problem, it's not echoing anything. **EDIT:** Is it because it's in the header?


title: problem with wp theme uploading to server..?

text: Please help me out.. I had uploaded new theme(child theme) in clients server.Theme folder has _twenty ten_ and _child theme_ now.But when i activated the theme in admin side ,the twenty ten shows the corresponding child theme and the new one shows the html template (from that html template i made the corresponding wordpress theme).Is this the problem with uploading? what went wrong ?


title: Set default date in datepicker of the advance custom field

text: I am using advance custom field in my wordpress project. In it i have added 2 datepickers as custom fields into page. Now the main problem is whenever i add new page both the datpicker by default comes empty, but i want to set current date of the server in it, that is whenever i add a new page both the date picker should have current date of the server by default in it. In advance thanks for the help.


title: Add filter to Admin list for all custom post types by their custom taxonomies

text: I want to add **filter** on every **Custom post type** that have taxonomy associated with it. I have googled but found code for only for single post type or for single taxonomy.


title: How to load javascript file on homepage in Wordpress in order?

text: I am using a `quicktags` plugin, which was not loading on the home page, now it does, but it does it on the wrong place. How can I solve this? **I want the quicktags.min.js file to load first, rather than the basic- comment quicktags...** I am using this script:               add_action( 'wp_enqueue_scripts', 'ron_scripts' );     function ron_scripts(){        if(is_home()){          wp_register_script( 'quicktags', '/wp-includes/js/quicktags.min.js?ver=3.5.1');          wp_enqueue_script( 'quicktags' );          wp_register_script( 'basic-comment-quicktags', '/wp-content/plugins/basic-comment-quicktags/quicktags.js' );          wp_enqueue_script( 'basic-comment-quicktags' );          } else {              }     }      What should I do to get it work like I want it to be? Edit: so now I am using:               function quicktags_script() {         wp_register_script( 'quicktags-min', '/wp-includes/js/quicktags.min.js?ver=3.5.1');         wp_enqueue_script( 'quicktags-min' );     wp_register_script( 'basic-comment-quicktags', '/wp-content/plugins/basic-comment-quicktags/quicktags.js' );          wp_enqueue_script( 'basic-comment-quicktags' );     }          add_action( 'wp_enqueue_scripts', 'quicktags_script' );      .... Can I get the basic-comment-quicktags beneath all scripts? Edit 2: If I change `quicktags-min` to `quicktags`, it does not give me the l10n error and it shows it to me in my page source. This time I get this error: `Permission denied to access property 'toString'`


title: How to do a task only once for logged in users

text: I want to do a task only once after an user has visited my site. I am currently doing like this:               function my_task(){         //do my tasks     }     add_action('init', 'my_task');      I am doing this from a plugin. This actually loads **my_task()** function every time users load any page of wordpress. But I only want to load it once for each user for each session. Once they close the browser, and come back again, I want it to load again only for once till they exit. How can I do this? Thanks in advance.


title: Bootstrap menu - make menu entries with submenu not clickable

text:
I am currently developing a new WordPress theme employed on the basis of twitters bootstrap build. To use the menu Custom Navbar, I've followed the instructions of goodandorgreat. https://gist.github.com/1597994 My problem now is that menu items with submenus are also clickable. That should not be so. What could I do here? header.php Setup:

             <?php                  $args = array(                 'theme_location' => 'top-bar',                 'menu' => 'main-menu',                  'container_class' => 'nav-collapse',                 'menu_class'     => 'nav',                 'menu_id' => 'main-menu',                 'walker'     => new Bootstrap_Walker_Nav_Menu()             );                  wp_nav_menu($args);                  ?>

      I dont want handle that with entrie url's like "#".


title: One blog inside another

text: I have a question about having two blogs at the same host simultaneously. Here is my scenario: The first blog is hosted in the root directory http://mathosproject.com/, and the second is hosted in a _sub directory_ , http://blog.mathosproject.com/, which is linked to _mathosproject.com/blog/_. I have tried to manipulate the _web.config_ file of the root, by making it excluding the directory _blog_ as following:               <configuration>       <system.webServer>         <rewrite>           <rules>             <rule name="wordpress8" patternSyntax="Wildcard">               <match url="^(blog|sample-page)*" ignoreCase="true" />               <conditions>                 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />                 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />                 <add input="{REQUEST_URI}" pattern="^/(blog|index)" negate="true" />               </conditions>               <action type="Rewrite" url="blog/index.php" />             </rule>                  <rule name="wordpress" patternSyntax="Wildcard">               <match url="*" ignoreCase="false" />               <conditions>                 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />                 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />                 <add input="{REQUEST_URI}" pattern="^/(blog|index)" negate="true" />               </conditions>               <action type="Rewrite" url="index.php" />                  </rule>           </rules>         </rewrite>       </system.webServer>     </configuration>      This actually helped me to be able to view the second blog, in _blog_ , but as I processed to the _sample-page_ , I was redirected to the first blog. My question is, is there a way I can configure the _web.config_ , so that it excludes a folder entirely?


title: How to edit wordpress post without republishing

text: Is there a way to update an older post without republishing the post? If I am looking at a previously published post and discover a misplaced comma or reformat an image I don't need all my RSS and email subscribers to receive that post in their feed. This is especially an issue if I want to fix issues in multiple posts on the same day. I saw something somewhere about changing the post to private, saving, and then setting the post back to public but that seems to also require publishing to reset the post.


title: How can I add a menu item to the admin area?

text:
I've used almost all of the Wordpress example code but it still doesn't work. I've put the php file under wp-content/plugins/menuitem/ .The code is simple               <?php add_action('admin_menu', 'donations_overview_menu');     function donations_overview_menu() {         add_options_page('Donations overview', 'Donations overview', 'manage_options', 'donations-overview', 'donations_overview');}          function donations_overview() {         if (!current_user_can('manage_options'))  {             wp_die( __('You do not have sufficient permissions to access this page.') );         }         echo '
';         echo '
Here is where the form would go if I actually had options.
';         echo '
';     }     ?>


title: Advanced Custom Fields Plugin: how would I get an image src path uploaded from User Profile?

text: I have created an Image Upload field for a User Photo in the User Profile section in the wp-admin using Advanced Custom Fields. I realized ACF could do this per this post: Photo gallery on profile page? How would I go about capturing the contents of the image src field in ACF? The following does not work:               <?php $publisher_photo = get_field('user_photo'); ?>          <?php echo ""; ?>      I even tried this, but it does not work either:               <?php $publisher_photo = get_the_author_meta('user_photo'); ?>     <?php echo ""; ?>      When I try to debug and echo the contents of the $publisher_photo variable, it comes back blank leading me to believe I'm not picking up this field from the User Profile in the correct way.


title: How can I display these posts in ascending order?

text: I am trying to display the following posts in descending order beginning with the first created and ending on the last page with the most recently created post. Any help is appreciated. Here is my code:               <?php     $numofmebers = '-1';     if ( empty($_GET['page_id_all']) ) $_GET['page_id_all'] = 1;         $count_post = 0;             query_posts( array( 'posts_per_page' => '-1', 'post_type' => 'coach-instructor' ,'post_status' => 'publish') );             while ( have_posts()) : the_post();                 $count_post++;             endwhile;                 if ( $node->instructor_pagination == "Single Page" ) {$node->instructor_page_num = -1;}                 query_posts( array('posts_per_page' => "$node->instructor_page_num", 'paged' => $_GET['page_id_all'], 'post_type' => 'coach-instructor' ,'post_status' => 'publish') );              $counter_news = 0;             while ( have_posts()) : the_post();             $counter_news++;             $image_id = get_post_thumbnail_id ( $post->ID );             $coach_istructor_meta = get_post_meta($post->ID, "cs_coach_istructor_meta", true);                 if ( $coach_istructor_meta <> "" ) {                     $xmlObject_author = new SimpleXMLElement($coach_istructor_meta);                         $about = $xmlObject_author->about;                         $specialism = $xmlObject_author->specialism;                         $qualifications = $xmlObject_author->qualifications;                         $philosophy = $xmlObject_author->philosophy;                         $contact = $xmlObject_author->contact;                 }                 else {                     $about = '';                     $specialism = '';                     $qualifications = '';                     $philosophy = '';                     $contact = '';                 }     ?>


title: Sub-directory blog on a sub-domain WordPress network site

text: I have a WordPress Network install with the individual sites installed on subdomains.   * example.com   * a.example.com   * b.example.com I would now like to launch a blog on each of the sites. It'd like the blog to be situated in a `/blog` sub-directory of each of the subdomains, but as the blogs would be completely separate from the website and use it a different theme, I think it makes sense to have them as separate sites in the network. In other words, what I'd like to have is:   * example.com      * example.com/blog   * a.example.com      * a.example.com/blog   * b.example.com      * b.example.com/blog Each of the above being a separate WordPress Network site, with different themes, admin panels, etc. Is there any way to accomplish something like this? Thanks! P.S.: The site runs on nginx.


title: Add class name of content, Hypernate doesn't work to IE and Chrome

text:
I am using the `hyphenator.js` to custom page template and works for paragraph, but I can not apply it to Post. How can do that? `header.php`                                   `style.css`               post-single {text-align:justify; font-size:1em;}      `single-news.php`               <div class="post-single" id="post-<?php the_ID();?>">

<?php the_title(); ?>

     Posted <?php the_time('l, j F Y') ?>.
                  <?php the_content (); ?>
        The problem with the class resolved, but the `hypernate .js` doesn't work to IE. How can fix that?


title: Custom PHP-coding in MU installs

text: I have a WPMU install with a couple of sites on it. I'd like to add some subdirectories that are not wordpress blog pages but do contain working PHP code. They do not use any of wordpress's libraries and are not plugins. The catch is that I'd like these subdirectories to only show up on a particular site. For instance, the hierarchy is:               /wordpress/customapp      but               http://myfirstsite.something.com/wordpress/customapp      should work while               http://mysecondsite.something.com/wordpress/customapp      should give a 404 error. Is there anyway to do this? I'm running Wordpress through Windows Server IIS7 if it is any help. Thanks


title: What code removes the admin bar for all users in WordPress 3.3?

text: How can I remove the admin bar in both the front and backend for all users in WordPress 3.3?


title: Add #sidebar-2 to a custom page template

text:
I registered a few custom sidebars, and the corresponding code in my version of TwentyTwelve theme now looks like this:                   register_sidebar( array(         'name' => __( 'Sidebar #1', 'twentytwelve' ),         'id' => 'sidebar-1',         'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ),         'before_widget' => '',         'after_widget' => '',         'before_title' => '
',         'after_title' => '
',     ) );          register_sidebar( array(         'name' => __( 'Sidebar #2', 'twentytwelve' ),         'id' => 'sidebar-2',         'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ),         'before_widget' => '',         'after_widget' => '',         'before_title' => '
',         'after_title' => '
',     ) );          register_sidebar( array(         'name' => __( 'Sidebar #3', 'twentytwelve' ),         'id' => 'sidebar-3',         'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ),         'before_widget' => '',         'after_widget' => '',         'before_title' => '
',         'after_title' => '
',     ) );          register_sidebar( array(         'name' => __( 'Sidebar #4', 'twentytwelve' ),         'id' => 'sidebar-4',         'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ),         'before_widget' => '',         'after_widget' => '',         'before_title' => '
',         'after_title' => '
',     ) );          register_sidebar( array(         'name' => __( 'Sidebar #5', 'twentytwelve' ),         'id' => 'sidebar-5',         'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ),         'before_widget' => '',         'after_widget' => '',         'before_title' => '
',         'after_title' => '
',     ) );      My custom page template uses #sidebar-1:
          <?php get_sidebar(); ?>
       Now I want to create a separate custom page template # 2, which should be identical to custom page template # 1, except it should use #sidebar-2 instead of #sidebar-1. **Question:** How should I place the alternative sidebar there? Thank you in advance for your help!


title: Masonry, remove “is_expanded” class when new item is clicked?

text: I´m using a layout like http://masonry.desandro.com/faq.html and i am wondering if there is a way to only have one item active at them time. So that when you expand a new item a the one you currently have open goes back to its original form (removes class="is_expanded") . I´ve quite new to programming and don´t really know where to stat to look, tried configuring How do I remove class from previous selection when clicking additional item? but with no luck This is codepen link for the demo : http://codepen.io/desandro/pen/BnCqy Please help me to find out the solution any help would be appreciated..


title: what is allowed as an id argument in register_sidebar( $args )

text: I am want to register a sidebar but i am a little confused about the uses of the id argument in register_sidebar function. > Codex says: id - Sidebar id - Must be all in lowercase, with no spaces > (default is a numeric auto-incremented ID). Of what use is the id arguement and must it alyways be in numeric form?.


title: Undefined index: debuging error for theme option template snippet

text: Hello I tried to find the solution but couldn't get what I am looking for..I am getting error exactly as bellow.. Notice: Undefined index: page in C:\xampp\htdocs\site\wp- content\themes\mytheme\admin\admin-panel.php on line 745 and code on line 745 is               function mytheme_add_init() {          $file_dir=get_bloginfo('template_directory');     wp_enqueue_style("functions", $file_dir."/admin/functions.css", false, "1.0", "all");     wp_enqueue_script("rm_script", $file_dir."/admin/rm_script.js", false, "1.0");          }      I dont know if I am using deprecated snippet or so.


title: How to break the wp_link_pages in two lines

text:
I have 4 videos in my single post which are being displayed using nextpage quicktag. To style pagination i am using the follwing code in single.php
<?php wp_link_pages('before=LQ &pagelink=Chapter %'); ?>
      its giving me output like _LQ Chapter 1 Chapter 2 Chapter 3 Chapter4_ But i want to display like _LQ Chapter 1 Chapter 2_ _HQ Chapter 1 Chapter 2_ in seprate lines . What i can do for this? Desired html output should be like this
         LQ         Chapter 1         Chapter 2         Chapter 3

         HQ         Chapter 1         Chapter 2         Chapter 3
      and for this i will add 6 chapter content in my post using the like               Chapter 1     Chapter 2     Chapter 3      Chapter 4  // this will become chapter 1 in HQ     Chatper 5 // this will become chapter 2 in HQ     Chapter 6


title: Installing Google analytics to home page

text: I've installed a plugin that puts google analytics code to the page of each post. But it did not install google analytics code to home page and because only a small portion of users click on the post's page I can not track the users. How can I install google analytics manually to the home page and if I do so I could not use the plug-in any more? My theme is Twenty Ten 1.2.


title: missing argument 2 when passing arguments to add_action

text: I wanted to pass arguments to a function triggered by an add_action hook. I followed the codex on this. I got a warning and the result was erratic, with an unexpected behavior. This question has already been adressed before without answers. I could reproduce this problem with a simplified function echoing the 2 arguments it needs. So, in `functions.php`:               function my_function ($arg1, $arg2) {         echo 'id1: '.$id1.' id2: '.$id2;         return;     }     add_action('this_hook', 'my_function', 10, 2);      The 2 number stands for the number of arguments needed by `my_function` in order it can take into account some of its context when executed. So, to be executed, the `do_action` must be added in the template pages files, for example in `header.php` as it was the case for me.                do_action('this_hook', 'dogs', 'cats');      The result is echoing > id1: id2: id1: dogs id2: cats Missing argument 2 for my_function() The expected behavior would have been: > id1: dogs id2: cats


title: Wordpress custom post type post and category links 404

text:
I've recently created several custom post types in a wordpress site, with the code below, they are generating links in the correct form e.g. root/category/id/postname but each link to the full post, pagination or category 404's. I've tried a number of popular solutions, appending /%category%/%post_id%/ to the url structure, rewriting function names but I'm getting nowhere fast. With the wordpress permalink structure set to default e.g. root/?page_id=1257 everything works ok. Any effort to add additional parameters to rewrite (see below) produces "Parse error: syntax error, unexpected ';'" even though no ';' is present.               'rewrite' => array(     'slug' => 'issue')      Any help appreciated - highly confused, very frustrated!               <?php          //      CUSTOM POST TYPE 1     add_action('init', 'mjwpress_register');          function mjwpress_register() {         $args = array(             'label' => __('Press'),             'singular_label' => __('Press'),             'public' => true,             'show_ui' => true,             'capability_type' => 'post',             'new_item' => __('New Press Item'),             'hierarchical' => false,             'rewrite' => true,             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'comments', 'revisions', 'page-attributes', 'post-formats')         );              register_taxonomy('press-category', array('article'),              array(                 'label' => 'Press Story Category',                  'singular_label' => 'press-story-category',                 'public' => TRUE,                 'show_tagcloud' => TRUE,                 'hierarchical' => TRUE,                 'query_var' => TRUE,                 'menu_position' => 5,                 'rewrite' => TRUE)         );              register_post_type( 'mjwpress' , $args );     }               add_action('inthenews_init', 'inthenews_init');     add_action('save_post', 'save_mjwpress_options');          function inthenews_init(){         add_meta_box('newsmeta', 'Press Options', 'mjwpress_meta_options', 'mjwpress', 'normal', 'low');          }          function mjwpress_meta_options(){         global $post;         $custom = get_post_custom($post->ID);         $linkurl = $custom['linkurl'][0];         $linktitle = $custom['linktitle'][0];     ?>

             Link to External Publication:             <input name='linkurl' value='<?php echo $linkurl; ?>' />
E.g. http://www.example.com/article-title.php

             Title of External Publication:             <input name='linktitle' value='<?php echo $linktitle; ?>' />
E.g. Lib Dem Voice

          <?php     }          function save_mjwpress_options(){         global $post;         update_post_meta($post->ID, 'linkurl', $_POST['linkurl']);         update_post_meta($post->ID, 'linktitle', $_POST['linktitle']);     }          ?>


title: Display value of custom field not working

text:
I am simply trying to print the value of a custom field. I have read all the documentation, tried out other people's suggestions, and nothing works. I can get it to print the ID #, but not the actual value I have in the field. I am using the Types plugin to create the field. this prints the ID:               <?php echo get_the_ID($value, 'authorinfo', true); ?>      as well as:               <?php echo get_the_ID($key, 'authorinfo', true); ?>      this does nothing:               <?php get_post_meta( $post->ID, 'authorinfo', true ); ?>      this does nothing:               <?php echo get_post_meta(get_the_ID(), 'authorinfo', true); ?>      (I have a separate question on this site where the problem came up and a solution was offered but unfortunately it didn't work for me) - Display custom post type and custom fields within a Bootstrap Carousel Here is all the code I'm working within in case that helps. I hope I'm doing something stupid here.               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                    <?php $the_query = new WP_Query(array(                 'post_type' => 'testimonial',                  'posts_per_page' => 1                  ));                 while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

                         <?php the_content();?>                         <?php echo get_post_meta(get_the_ID(), 'authorinfo', true); ?>

                 <?php endwhile; wp_reset_postdata(); ?>                 <?php $the_query = new WP_Query(array(                 'post_type' => 'testimonial',                  'posts_per_page' => 5,                  'offset' => 1                  ));                 while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

                         <?php the_content();?>                         <?php echo get_post_meta(get_the_ID(), 'authorinfo', true); ?>

                      <?php endwhile; wp_reset_postdata(); ?>

          <?php endwhile; ?>            **EDIT/ADDITION** Since working with the Types plugin more, I am pretty sure this problem could be solved by using "types_render_field" instead of "get_post_meta". I don't have a place where I can test this, but I think this should help someone with a similar problem.


title: Using WP_Query within an mu-plugin

text: I'm trying to create a list of parent IDs for a custom post type for use within a "must use" plugin I'm developing on a project. Here's the code I'm using to generate the query:               $cpt_parents = new WP_Query( array (          'post_type' => 'cpt',         'posts_per_page' => -1, // Get them all          'post_parent' => 0, // Return only top-level                 'fields' => 'ids'         )        );          $parent_ids = $cpt_parents->posts;      And here are the resulting errors:               Notice: Undefined index: wp_taxonomies in [url]/wp-includes/query.php on line 1700          Warning: Invalid argument supplied for foreach() in [url]/wp-includes/query.php on line 1700          Notice: Undefined index: wp_taxonomies in [url]/wp-includes/query.php on line 1700          Warning: Invalid argument supplied for foreach() in [url]/wp-includes/query.php on line 1700          Fatal error: Call to undefined function is_user_logged_in() in [url]/wp-includes/query.php on line 2485      What do I need to do in order to run WP_Query within a plugin?


title: Nav Menu and display post count

text:
Iam looking for a solution that the number of child post displayed, like so: Parent (14) - Child - Child Parent (2) - Child I have played with the custom walker and tried the function with ->count but without luck. Has someone a solution? Thanks               class Count_Post_Walker extends Walker_Nav_Menu     {         function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {             global $wp_query;             $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                  $class_names = '';                  $classes = empty( $item->classes ) ? array() : (array) $item->classes;             $classes[] = 'menu-item-' . $item->ID;                  $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );             $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';                  $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );             $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';                  $output .= $indent . '
';                  $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                  $submenus = $depth == 0 ? get_posts( array( 'post_type' => 'post', 'show_count' => 1, 'numberposts' => -1,  'meta_query' => array(            array(                 'taxonomy' => 'category',                 'field' => $item->ID,                  ))      ) ) : false;             $item_output = $args->before;             $item_output .= '';             $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;             $item_output .= '';             $item_output .= $submenus ? ' (' . count( $submenus ) . ')' : '';             $item_output .= $args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }


title: Last three posts not being put in order by date. How to fix this?

text: My company adds a quote of the day each day. The last three posts that I have put are not in order though. The first quote I posted 3 days ago is at the top the post I posted yesterday is under that, and the post from today is third down. The posts under that were all from before I posted. How do I fix this?


title: get child-ID or attachment-ID of a post

text: I am trying yo get information of attachments and there type, when ever I publish a post with attachment its information is stored in wp_post with three IDS ex: `ID=1, parent-id = 0, post_type=post, mime_type=null ID=2, parent-id = 1, post_type=attachment, mime_type=image/jpg ID=2, parent-id = 1, post_type=revision, mime_type=null` in the first line id-1, its storing information about post in the second line id=2. its storing information about attachment in the third line id=3, i don't know what it was storing If i use get_post()->get_post_ID its fetching post-ID that is ID=1 what I want to get is attachment post information ie; id=2


title: How to display summary content from a Page (Not a Post) on another page

text: I created a Page called "About Joe" as a **_page_** in WordPress. Then on a different page (e.g. the homepage), I wish to display _a summary_ which includes:   1. a thumbnail   2. the 1st paragraph   3. link to page Is this possible? Maybe I'm not asking the right questions to the codex as I'm not finding anything. The closest thing I could find was `get_page()`, which i'm not even sure is the solution. But that function is now **_deprecated_**. Please advise! Thanks


title: Footer with next/previous posts

text: I'm looking for something to create a multi footer with previous / next posts. The footer needs to know if the current post is the newest (1st, 2nd and 3rd newest), oldest (3rd, 2nd, and oldest) or in between. As an example: ![enter image description here](http://i.stack.imgur.com/uEfPs.png) The old / new links include title & thumbnail. Does anyone know how I can achieve this?


title: Find all posts via SQL beginning with A of type B

text: I have problem with post and taxonomy query. What i need is to get all post's from custom post type which starts with A and have defined term. Here is my sql:               SELECT * FROM $wpdb->posts, $wpdb->terms         WHERE post_title LIKE 'А%'         AND post_type = 'filmi-i-serialii'         AND post_status = 'publish'         AND slug = 'igralni';      But this returns me all posts in _filmi-i-serialii_ post-type and not only those that are in the taxonomy _igralni_.


title: How do WP child-themes work?

text: Ok, I have my main theme setup, and now I created a child theme with the name interio_child. From these instructions I understand that you only need to add the style.css file which makes the link to your main theme. Also you can add additional files which override code from your main theme. Right now I have activated my child theme. It only displays the code that is present in my child theme folder and no CSS at all. How is this possible? I've looked at numerous tutorials and wordpress support topics, but I can't get this child theme linked to my main theme. These are the contents from my child theme's style.css:               /*     Theme Name: Interio Child     Theme URI: http://tohidgolkar.com     Author: Tohid Golkar     Author URI: http://tohidgolkar.com     Description: Child theme for the Interio theme      Template: interio     Version: 1.1     */          @import url('../interio/style.css');     @import url('stylesheets/mystyle.css');      Does the child theme folder need to contain all files from the main theme? I believe not, it should link with the main theme, correct? Then why are there no files from the main theme displayed on the website?


title: Can't change parent page

text: Some of my pages are children of "home". I want to assign them to a new page. But I cant change the pages parent. Everytime I try and publish, it just switches back to "home". I am using the Roots-Theme, I don't know if that matters. Edit: I even tried to erase "Home". The children of home are assigned to "Main" then (I could not change that either). As I recreated home, they were reassigned to it. Maybe its because of the WPML Multilanguage plugin?


title: If Loop has odd number of posts on last page Custom style for last post in it

text:
My loop displays posts in two columns using this php               <?php     if (have_posts()): while (have_posts()) : the_post();      $count++;     ?>         <?php  if ($count == 1) : ?>

         CONTENT OF POST : Title, Thumbnail, Excerpt... etc

              <?php elseif ($count == 2) : ?>
        CONTENT OF POST : Title, Thumbnail, Excerpt... etc

          <?php $count = 0; ?>                <?php else : ?>       WHEN THERE IS NO POSTS     <?php endif; endwhile; endif; ?>      You can see that the div '' opens in the first count & closes in the second one. so when my loop has an even number of posts works great, but with odd number it doesn't close the div so My idea is this: If loop has even number http://i.stack.imgur.com/Hu4Ua.png If loop has odd number of posts http://i.stack.imgur.com/JjqzZ.png I hope my question is clear,


title: Custom Walker function need to customize in a specific way for wp_nav_menu in Wordpress

text:
I have used wp_nav_menu() for my custom WP sites with Custom Walker Function which is working fine and providing me below output:

HOME

MY Review Post 1

My Test Post

      But Right now i want to add div class through loop after the ul class="col- sm-12 list-unstyled" inside the div class "yamm-content". So output will be:

HOME

MY Review Post 1

My Test Post

title text come here
                                     learn more

      Please provide some idea how can i get it from my custom Walker function. I just tried to get it through static way but don't know how to place it after ending the `</UL>`. Anybody please help me..                   class custom_menu_walker extends Walker_Nav_Menu {         private $curItem;              function start_lvl(&$output, $depth) {             $thisItem = $this->curItem;                   $output .= '

';                 $output .= ( $depth == 0 && $thisItem->object == 'category' ) ? '
' : '
';                    }               function end_lvl(&$output, $depth) {             $output .= '

';              }              // add main/sub classes to li's and links          function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {              $this->curItem = $item;                  $indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent                       // depth dependent classes             $depth_classes = array(                 ( $depth == 0 ? 'dropdown' : '' ),                 (( $depth == 0 && $item->object == 'category' ) ? 'yamm-first' : ''),                 ( $depth % 2 ? 'menu-item-odd' : 'menu-item-even' ),                 'menu-item-depth-' . $depth             );             $depth_class_names = esc_attr( implode( ' ', $depth_classes ) );                  // passed classes             $classes = empty( $item->classes ) ? array() : (array) $item->classes;             $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) );                  // build html                  $output .= $indent . '
ID . '" class="' . $depth_class_names . ' ' . $class_names . '">';                  // link attributes             $attributes = ' class="menu-link ' . ( $depth == 0 ? 'dropdown-toggle' : '' ) . '"';                       $item_output = sprintf( '%1$s%3$s%4$s%5$s%6$s',                 $args->before,                 $attributes,                 $args->link_before,                 apply_filters( 'the_title', $item->title, $item->ID ),                 $args->link_after,                 $args->after             );                       // build html             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }                        function end_el( &$output, $item, $depth = 0, $args = array(), $current_object_id = 0 ) {             if ( $depth == 0 && $item->object == 'category' ) {                       ?>

title text come here
                                     learn more

                     <?php                  }         }     }


title: Set Current Category to Active in category.php

text:
Inside the category.php file I have a custom navbar which is...

All Categories
                     <?php wp_list_categories('orderby=name&title_li='); ?>
      I would like the li for the current category to have class = "active". How can I code this? Thank you


title: Query parsing only author ids

text: I need array only all author ids from the loop, each one only once if possible and out of all posts in the loop. Any suggestions?


title: Trying to output a "Most visited blogs" list in wordpress multisite

text: Does anyone know how to get a "most visited" list out of Wordpress Multisite? I got alot of bloggers and have been looking for a way to output a top 10/20 list of most visited blogs, but cant find any plugin or snippets for this. Example - like the list on the right side of this site (not WP) http://blogg.se/


title: Customizer preview doesn't update get_option() value properly

text: I have a setting in index.php               if(get_option('cb2_blog_home')){         cb_get_blog_links();     }      This code allows the home page blog index to be turned on and off. The cb_get_blog_links() function draws out the list of blog post summaries. And, in the customizer, I have a checkbox to allow this value cb2_blog_home to be set. However, it has no effect. Its as if the option is always true. Any ideas why? Inside that function, there are several variables that I'm also setting with the customizer. Those all work perfectly. Here's the full customizer code. Everything fires perfectly except the home blog setting. The only thing I can come up with is that one is a function and the others are variables within the function.               function cb_customize_register($wp_customize){                  $wp_customize->add_section('cb_customizer_blog', array(                     'title'    => __('Theme Blog Settings', 'Theme'),                     'priority' => 120,             ));                          //Show & Hide Blog Links on Home                     $wp_customize->add_setting('cb2_blog_home', array(                             'default'        => '',                             'capability'     => 'edit_theme_options',                             'type'           => 'option',                     ));                          $wp_customize->add_control('cb2_blog_home', array(                             'label'      => __('Enable Home Blog', 'Theme'),                             'section'    => 'cb_customizer_blog',                             'settings'   => 'cb2_blog_home',                             'type'   => 'checkbox',                             'priority' => 125,                     ));                          //Home Blog Post Count                     $wp_customize->add_setting('cb2_blog_home_count', array(                             'default'        => '3',                             'capability'     => 'edit_theme_options',                             'type'           => 'option',                     ));                          $wp_customize->add_control('cb2_blog_home_count', array(                             'label'      => __('Home Blog Post Count', 'Theme'),                             'section'    => 'cb_customizer_blog',                             'settings'   => 'cb2_blog_home_count',                             'priority' => 130,                     ));                               //Show & Hide Home Blog Title Heading                     $wp_customize->add_setting('cb2_blog_home_title_hide', array(                             'default'        => '',                             'capability'     => 'edit_theme_options',                             'type'           => 'option',                     ));                          $wp_customize->add_control('cb2_blog_home_title_hide', array(                             'label'      => __('Hide Home Blog Title', 'Theme'),                             'section'    => 'cb_customizer_blog',                             'settings'   => 'cb2_blog_home_title_hide',                             'type'   => 'checkbox',                             'priority' => 135,                     ));                          //Show & Hide Home Blog Author Byline                     $wp_customize->add_setting('cb2_blog_index_author', array(                             'default'        => '',                             'capability'     => 'edit_theme_options',                             'type'           => 'option',                     ));                          $wp_customize->add_control('cb2_blog_index_author', array(                             'label'      => __('Hide Blog Author Byline', 'Theme'),                             'section'    => 'cb_customizer_blog',                             'settings'   => 'cb2_blog_index_author',                             'type'   => 'checkbox',                             'priority' => 140,                     ));                      //Show & Hide Home Blog Date                 $wp_customize->add_setting('cb2_blog_index_date', array(                             'default'        => '',                             'capability'     => 'edit_theme_options',                             'type'           => 'option',                     ));                          $wp_customize->add_control('cb2_blog_index_date', array(                             'label'      => __('Hide Blog Date', 'Theme'),                             'section'    => 'cb_customizer_blog',                             'settings'   => 'cb2_blog_index_date',                             'type'   => 'checkbox',                             'priority' => 145,                     ));          }          add_action('customize_register', 'cb_customize_register');


title: Saving options for the fields on paginated pages

text:
I am working on a WordPress plugin with some options for the fields which are working fine without pagination. I am kind of new to WordPress plugin development. The problem is I added pagination to the plugin's options page but the problem is when I click on save changes and if for example I am on page 2 then the changes are reset on the options which are on page 1 and all other pages. It looks something like this: http://usmanali.net/plugin-page.png How can I fix it? I mean how can make the changes save only for the options displaying on that specific page and not on the other page of the pagination? This is the code:               public function register_settings_and_fields()         {                  global $wpdb;                  register_setting('par_plugin_options', 'par_plugin_options'); // 3rd param required for cb                  add_settings_section('par_main_section', 'Check / Uncheck the pages against each user', array($this, 'par_main_section_cb'), 'ua_par_settings'); //id, title of section, cb, page                  $users = get_users();                  $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;                  $limit = 2;                  $offset = ( $pagenum - 1 ) * $limit;                      $args = array(                     'blog_id'      => $GLOBALS['blog_id'],                     'role'         => '',                     'meta_key'     => '',                     'meta_value'   => '',                     'meta_compare' => '',                     'meta_query'   => array(),                     'include'      => array(),                     'exclude'      => array(),                     'orderby'      => 'login',                     'order'        => 'ASC',                     'offset'       => '',                     'search'       => '',                     'number'       => $limit,                     'count_total'  => false,                     'fields'       => 'all',                     'who'          => ''                  );                  $entries = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}users LIMIT $offset, $limit" );                  if( $entries ) {                  $count = 1;                      foreach ( $entries as $user ) {                      add_settings_field($user->user_login, '' . $user->user_nicename . '
(' . $user->user_email . ')', array($this, 'process_callback'), 'ua_par_settings', 'par_main_section', array( 'value' => $user->user_login, ));                      $count++;                      };                  }                  $total = $wpdb->get_var( "SELECT COUNT(`id`) FROM {$wpdb->users}" );                  $num_of_pages = ceil( $total / $limit );             $page_links = paginate_links( array(                 'base' => add_query_arg( 'pagenum', '%#%' ),                 'format' => '',                 'prev_text' => __( '«', 'aag' ),                 'next_text' => __( '»', 'aag' ),                 'total' => $num_of_pages,                 'current' => $pagenum             ) );                  if ( $page_links ) {                 echo '

' . $page_links . '

';             }              }


title: Wordpress Ajax Login without page reload

text: I'm currently developing a Wordpress theme where I want the user to be able to upload images before he register or log in to the site. The initial problem was, you can´t upload images to wordpress using the wp.media javascript class if you are not a registered user. The solution I create is actually very simple:   1. When the user arrives at the registration page, a javascript code check's if the user is logged in or not, if he´s not we create a temporary user with a random e-mail and password and login the visitor with this newly created temporary user, all in background. After that, the idea is once the user registers with his own data, this temporary user is going to be updated with the correct visitor data.   2. Now the tricky part. I wan´t wordpress to identify this user as logged in without a page reload, to make this work I added a function to the action 'set_logged_in_cookie', so i can get the $_COOKIE data the wordpress is going to set to this new logged in user and retrieve it through the ajax call, I then set this cookie data in the local user computer with javascript. Now I´m able to get the correct data for the Cookie (php working just fine) and set it also without a problem (javascript looks to be working fine also). If I dump the $_COOKIE global after a page reload I get the same data I´m getting in the javascript code ajax call, but after I set the cookie, in the javascript code, without a reload and when I try to upload with the wp.media nothing works, after a page reload it works just fine. Any sugestions? Bellow is my current code ( I left only the relevant code )                // set action to get the cookie data      $this->setAction('set_logged_in_cookie', 'setCookieContents');      public function setCookieContents($logged_in_cookie, $expire, $expiration, $user_id)      {          $this->_cookieContents = array(              'logged_in_cookie'  =>  $logged_in_cookie,              'expire'            =>  $expire,              'expiration'        =>  $expiration,              'user_id'           =>  $user_id          );      }      ...                public function handleAjax( $action )      {             header('Content-type: application/json');             $action     =   PlulzTools::getValue('todo');             $response = array(            'status'    =>  'ok',            'data'      =>  array()        );             switch($action)        {               case 'ajaxlogin' :                      $response['data']['cookie'] = array(                            'key'   =>  LOGGED_IN_COOKIE,                            'data'  =>  $this->_cookieContents['logged_in_cookie']                      );                           echo json_encode($response);               break;            }      Now, in the front end javascript code, get the data and set the cookie (or at least, try to)               jQuery.ajax({          url : Frontend.ajaxurl,          type: 'POST',          data: EnviarLogin,          timeout: 12000     }).done(function(newresponse){               if(newresponse.status == 'ok')          {               // atualizando status de login               logged = true;                    jQuery.cookie(newresponse.data.cookie.key, newresponse.data.cookie.data);               }     }).error(function (xhr, ajaxOptions, thrownError){               console.log(xhr);          console.log('Erro! Status:' + xhr.status + '; Erro thrown: ' + thrownError, + ' Description: ' + xhr.statusText);               return false;          });


title: Display all sub category but one

text: How would I display all the sub category but one? I tried `is_category('myslug')` then return in the post loop but it wont work. my code in the post loop               if(is_category('myslug')){         return;     }      Stills return all the sub category even the one with slug `myslug`


title: The plugin generated xx characters of unexpected output. How to solve?

text:
I get the following message when I activate the plugin `The plugin generated 655 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' How can I debug this? I have turned WP_DEBUG on. Any solutions?               <?php     /*     Plugin Name: costing calculator     Description: A costing calculator for the engineering industry     Author: Matthew Pollard     Version: 1.0     */               register_activation_hook( __FILE__, 'mp_install_countries_table' );     register_activation_hook( __FILE__, 'mp_install_country_data' );     register_activation_hook( __FILE__, 'mp_install_machines_table' );     register_activation_hook( __FILE__, 'mp_install_machines_data' );     register_activation_hook( __FILE__, 'mp_install_settings_table' );     register_activation_hook( __FILE__, 'mp_install_settings_data' );          function mp_install_countries_table()  {         global $wpdb;         $table_name = $wpdb->prefix . 'countries';                   $sql = "CREATE TABLE $table_name (             id mediumint(9) NOT NULL AUTO_INCREMENT,             name tinytext NOT NULL,             labour_cost INT,             overheads FLOAT,             profit FLOAT,             UNIQUE KEY id (id)         );";             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );        dbDelta( $sql );     }          function mp_install_country_data() {              global $wpdb;              $table_name = $wpdb->prefix . 'countries';            $rows =   array(                array(                 'id' => '1',                 'name' => 'UK',                 'labour_cost' => '20',                 'overheads' => '0.45',                 'profit' => '0.22'                  ),             array(                 'id' => '2',                 'name' =>'james',                 'labour_cost' => '6',                 'overheads' => '0.27',                 'profit' => '0.17'               )         );                foreach( $rows as $row )         {         $wpdb->insert( $table_name, $row);         }     }            //creating machines table     function mp_install_machines_table() {     global $wpdb;         $table_name2 = $wpdb->prefix . 'machines';           $sql2= "CREATE TABLE $table_name2 (               id int(11) NOT NULL AUTO_INCREMENT,               name varchar(255) DEFAULT NULL,               rate int(11) NOT NULL,               UNIQUE KEY id (id)               ) ; ";               require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );               dbDelta ( $sql2 );               }      // populate machines table     function mp_install_machines_data() {     global $wpdb;     $table_name_mach_in = $wpdb->prefix . 'machines';            $machine_id = '1';       $machine_name  = 'robot spot welder';       $machine_rate = '91';                   $rows_affectedmac = $wpdb->insert( $table_name_mach_in, array( 'id' => $machine_id, 'name' => $machine_name, 'rate' => $machine_rate ));          require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );          dbDelta( $rows_affectedmac );       }            //creating settings table     function mp_install_settings_table() {     global $wpdb;         $table_name3 = $wpdb->prefix . 'settings';           $sql5= "CREATE TABLE $table_name3 (               id int(11) NOT NULL AUTO_INCREMENT,               robot_constructional INT,               robot_stitching FLOAT,               robot_addr_in FLOAT,               robot_addr_out FLOAT,               UNIQUE KEY id (id)               ) ; ";               require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );               dbDelta ( $sql5 );               }        //populate settings table       function mp_install_settings_data() {     global $wpdb;     $table_name_sett_in = $wpdb->prefix . 'settings';            $setting_id = '1';       $setting_con  = '3';       $setting_stitc = '1.8';            $setting_rob_in = '2.4';       $setting_rob_out =  '2.4';           $rows_affectedset = $wpdb->insert( $table_name_sett_in, array( 'id' => $setting_id, 'robot_constructional' => $setting_con, 'robot_stitching' => $setting_stitc, 'robot_addr_in' => $setting_rob_in, 'robot_addr_out' => $setting_rob_out ));          require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );          dbDelta( $rows_affectedset );       }       // end of  create table and populating           // deadctivate the plugin and delete tables      function mp_uninstall_countries_table() {       global $wpdb;       $thetable = $wpdb->prefix. 'countries';       //Delete any options that's stored also?        // delete_option('wp_yourplugin_version');       $wpdb->query("DROP TABLE IF EXISTS $thetable");     }            register_deactivation_hook( __FILE__, 'mp_uninstall_countries_table') ;                 //include jquery     add_action( 'wp_enqueue_script', 'load_jquery2' );     function load_jquery2() {         wp_enqueue_script( 'jquery' );     }                function add_my_css_and_my_js_files(){         wp_enqueue_script('jquery-validate-min', plugins_url('activate/jquery_validate_min.js', __FILE__ ) );     }     add_action('wp_enqueue_scripts', "add_my_css_and_my_js_files");          // shortcode to display calcs     add_action( 'init', 'register_shortcodes');     function register_shortcodes() {     add_shortcode( 'displaycalcs', 'mp_calcs_display' );     }          function mp_calcs_display() {     return '     <form name="calsinput" action="" method="post" id="calsinput" >
 Process

 operation type always robot

     Number of welds: <input type="number" name="numberofwelds" class="required digits" title="This field is required and must be a no."  >

     Number of construction welds: <input type="number" name="numberofconwelds" class="required digits"  title="This field is required and must be a no.">

 Outputs

     Robot in/out: <input type="text" name="robotinout" disabled>

     Weld time: <input type="text" name="weldtime" disabled>

     Controlling cycle: <input type="text" name="concycle" disabled>

     Total time(secs): <input type="text" name="totaltimesecs" disabled>

     <input type="submit" value="Calculate cycle time ">     </form>            ';     }


title: Custom category for posts via XMLRPC

text: I have a blog located at one site that when I post into a category, it will auto-post via XMLRPC to another site of mine. This functionality works, but I would like to assign a category to these posts. Is there any way to do this? The only site that will be posting this way is controlled by me, so I don't care if it's global. Thanks


title: Saving widget gets an undefined variable

text:
I am developing a widget for cached feeds. The widget itself works exactly as I want but I noticed that if I were to delete the widget and then add a new one (or simply just add a new one) on the first save I get an undefined variable error. This is in the admin Appearence->widgets section. `Notice: Undefined index: cached_feed1450-3 in D:\Sites\test.dev\wordpress\wp- admin\includes\ajax-actions.php on line 1578` It looks to me that this may be a WordPress issue since that line is:               if ( $form = $wp_registered_widget_controls[$widget_id] )      I guess they need to check `isset` I am pasting my widget here to make sure that this isn't an issue with my widget but confirmation that this is a WordPress bug. I really hope its the latter... Thanks for you help is identifying this issue. **EDIT:** This error only happens on when saving a new widget. It only seems to happen with my widget. When editing it's not an issue. I have a bootstrap for loading the plugin. I use this `add_action( 'widgets_init', array('BootStrap1450', 'addWidgets') );` in the               /**      * Initialize the BootStrap      */     public static function init() {         require_once(A1450COM_LIBRARY_PATH.'Functions1450.php');              // Initialize proper components (do not put into a hook!)         if (is_admin()) {             require_once(A1450COM_LIBRARY_PATH.'BackEnd1450.php');         } else {             require_once(A1450COM_LIBRARY_PATH.'FrontEnd1450.php');             FrontEnd1450::init(); // Call manually         }              // Initiation of WP hook         add_action( 'init', array('BootStrap1450', 'initWP') );         add_action( 'widgets_init', array('BootStrap1450', 'addWidgets') );     }       addWidgets is:               /**      * Adds widgets      */     public static function addWidgets() {         include_once(A1450COM_WIDGETS_PATH.'CachedFeed1450.php');     }      The widget file then follows:               <?php     /**      * An RSS feed widget with cache controls      * @package WordPress      * @subpackage Cached Feed Widget      * @author Jeremy      */     class CachedFeed1450 extends WP_Widget {         const TEXT_DOMAIN = 'cachedfeed';         const COUNT_LIMIT = 20;              /**          * Register widget with WordPress.          */         public function __construct() {                  $widget_options = array(                 'description' => __( 'A cached feed widget that gives you custom settings per feed.', self::TEXT_DOMAIN )             );                  $control_options = array(                 'width' => 300             );                  parent::__construct(                 'cached_feed1450', // Base ID                 __('Cached Feed', self::TEXT_DOMAIN), // Name                 $widget_options,                 $control_options             );         }              /**          * Front-end display of widget.          * *Currently only set for google news feed.          * @todo Create a feed object to handle multiple feeds different data structures          *          * @see WP_Widget::widget()          *          * @param array $args     Widget arguments.          * @param array $instance Saved values from database.          */         public function widget( $args, $instance ) {             extract( $args );             $title = apply_filters( 'widget_title', $instance['title'] );             $feedURL = $instance['feed'];             $count = absint($instance['count']);             $showWidgetTitle = $instance['show_widget_title'];             $showTitle = $instance['show_title'];             $showContent = $instance['show_content'];             $showAuthor = $instance['show_author'];             $showDate = $instance['show_date'];             $enableCache = $instance['enable_cache'];             $cacheLifetime = $instance['cache_lifetime'];                  echo $before_widget;             if ( $showWidgetTitle && !empty( $title ) ) {                 echo $before_title . $title . $after_title;             }                  $results = self::getFeed($widget_id, $feedURL, $count);             if (!empty($results)) {                 echo '
';                 // @todo Design a decent layout                 foreach($results as $feed) {                     echo '
';                          if ($showTitle)                         echo $feed->title;                          if ($showContent)                         echo $feed->description;                          if ($showDate)                         echo $feed->pubDate;          //                echo $feed->link;                          echo '
';                 }                 echo '
';             }             echo $after_widget;             return;         }              /**          * Sanitize widget form values as they are saved.          *          * @see WP_Widget::update()          *          * @param array $new_instance Values just sent to be saved.          * @param array $old_instance Previously saved values from database.          *          * @return array Updated safe values to be saved.          */         public function update( $new_instance, $old_instance ) {                  $instance = $old_instance; // Sets defaults to old values             $instance['title'] = strip_tags($new_instance['title']);             $instance['feed'] = strip_tags($new_instance['feed']);             $instance['count'] =  absint($new_instance['count']);             $instance['show_title'] = !empty($new_instance['show_title']) ? '1' : '0';             $instance['show_content'] = !empty($new_instance['show_content']) ? '1' : '0';             $instance['show_author'] = !empty($new_instance['show_author']) ? '1' : '0';             $instance['show_date'] = !empty($new_instance['show_date']) ? '1' : '0';             $instance['enable_cache'] = !empty($new_instance['enable_cache']) ? '1' : '0';             $instance['show_widget_title'] = !empty($new_instance['show_widget_title']) ? '1' : '0';             $instance['cache_lifetime'] =  absint($new_instance['cache_lifetime']) * 60; // * 60 is to convert the seconds to minutes                  // Clean the array             array_walk($instance, array(__CLASS__, 'trim'));                  // Fail-safe             if (empty($instance['feed'])) {                 return false;             }             return $instance;         }              /**          * Workaround to trim array on array_walk          * @param $value          */         public static function trim(&$value) {             $value = trim($value);         }              /**          * Back-end widget form.          *          * @see WP_Widget::form()          *          * @param array $instance Previously saved values from database.          */         public function form( $instance ) {             // Build data             $title = !empty($instance[ 'title' ]) ? $instance[ 'title' ] : '';             $feed = !empty($instance[ 'feed' ]) ? $instance[ 'feed' ] : '';             $count = !empty($instance[ 'count' ]) ? $instance[ 'count' ] : 0;             $cacheLifetime = !empty($instance[ 'cache_lifetime' ]) ? ($instance[ 'cache_lifetime' ] / 60) : 3600; // Default is 1 hour             $showTitle = !empty($instance[ 'show_title' ]) ? true : false;             $showContent = !empty($instance[ 'show_content' ]) ? true : false;             $showAuthor = !empty($instance[ 'show_author' ]) ? true : false;             $showDate = !empty($instance[ 'show_date' ]) ? true : false;             $enableCache = !empty($instance[ 'enable_cache' ]) ? true : false;             $showWidgetTitle = !empty($instance[ 'show_widget_title' ]) ? true : false;             ?>
                 <label for="<?php echo $this->get_field_id( 'feed' ); ?>"><?php _e( 'Feed URL:', self::TEXT_DOMAIN ); ?>                 <input class="widefat" id="<?php echo $this->get_field_id( 'feed' ); ?>" name="<?php echo $this->get_field_name( 'feed' ); ?>" type="text" value="<?php echo esc_attr( $feed ); ?>" />

                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title: (optional)', self::TEXT_DOMAIN ); ?>                 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />

                 <input type="checkbox" id="<?php echo $this->get_field_id( 'show_widget_title' ); ?>" name="<?php echo $this->get_field_name( 'show_widget_title' ); ?>" value="1" <?php checked($showWidgetTitle, 1) ?> />                 <label for="<?php echo $this->get_field_id( 'show_widget_title' ); ?>"><?php _e( 'Display the widget title?', self::TEXT_DOMAIN ); ?>

                 <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'How many items would you like to display?:', self::TEXT_DOMAIN ); ?>                 <select id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" >                     <?php                     for($i=1; $i <= self::COUNT_LIMIT; $i++) {                         echo '<option value="'.$i.'" '.selected($i, $count, false).'>'.$i.'</option>';                     }                     ?>                 </select>

                 <input type="checkbox" id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" value="1" <?php checked($showTitle, 1) ?> />                 <label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Display the item title?', self::TEXT_DOMAIN ); ?>

                 <input type="checkbox" id="<?php echo $this->get_field_id( 'show_content' ); ?>" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="1" <?php checked($showContent, 1) ?> />                 <label for="<?php echo $this->get_field_id( 'show_content' ); ?>"><?php _e( 'Display item content?', self::TEXT_DOMAIN ); ?>

                 <input type="checkbox" id="<?php echo $this->get_field_id( 'show_author' ); ?>" name="<?php echo $this->get_field_name( 'show_author' ); ?>" value="1" <?php checked($showAuthor, 1) ?> />                 <label for="<?php echo $this->get_field_id( 'show_author' ); ?>"><?php _e( 'Display item author if available?', self::TEXT_DOMAIN ); ?>

                 <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" value="1" <?php checked($showDate, 1) ?> />                 <label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display item date?', self::TEXT_DOMAIN ); ?>

                 <input type="checkbox" id="<?php echo $this->get_field_id( 'enable_cache' ); ?>" name="<?php echo $this->get_field_name( 'enable_cache' ); ?>" value="1" <?php checked($enableCache, 1) ?> class="cachedform-cache-toggle" />                 <label for="<?php echo $this->get_field_id( 'enable_cache' ); ?>"><?php _e( 'Enable Cache?', self::TEXT_DOMAIN ); ?>

                 <label for="<?php echo $this->get_field_id( 'cache_lifetime' ); ?>"><?php _e( 'Cache lifetime:', self::TEXT_DOMAIN ); ?>                 <input id="<?php echo $this->get_field_id( 'cache_lifetime' ); ?>" name="<?php echo $this->get_field_name( 'cache_lifetime' ); ?>" type="text" value="<?php echo esc_attr( $cacheLifetime ); ?>" />                 <?php _e('In minutes', self::TEXT_DOMAIN); ?>
                  <?php         }              /**          * Get the feed data          * @param string $id          * @param string $feed_url          * @param int $limit          * @param bool $sendRaw          * @param null $cacheTime          * @return array|SimpleXmlElement          */         private function getFeed($id, $feed_url, $limit = 0, $sendRaw = false, $cacheTime = 0) {             if (empty($cacheTime)) {                 $cacheTime = 3600; // 1 hour cache by default             }                  // Define cache file             $cache_file = get_theme_root() . DIRECTORY_SEPARATOR . get_template() . DIRECTORY_SEPARATOR . 'cached-feed-'.$id.'.xml';                  // Check for cache             $tmpFileModifiedDate = @filemtime($cache_file);             $timedif = time() - $tmpFileModifiedDate;             if (file_exists($cache_file) && $timedif < $cacheTime) {                 $string = file_get_contents($cache_file);             } else {                 $string = @file_get_contents($feed_url);                 // Check if an error and attempt a quick fix                 if ($string === false) {                     $string = @file_get_contents(urlencode($feed_url));                 }                 if ($string === false) {                     trigger_error(__('Cached Feed Error - Fetch feed content', self::TEXT_DOMAIN));                     return false;                 }                 if ($string) {                     $f = fopen($cache_file, 'w');                     if ($f === false) {                         trigger_error(__('Cached Feed Error - Failed to write to cache file', self::TEXT_DOMAIN));                         return false; // Failed to write to file                     }                     if ($f) {                         fwrite($f, $string, strlen($string));                         fclose($f);                     }                 }             }                  // Return empty array if no data             if (!$string) {                 return array();             }                  // Get content from XML             $x = new SimpleXmlElement($string);             if ($sendRaw) {                 return $x;             }             $entries = array();             $i = 0;             foreach ($x->channel->item as $entry) {                 if ($limit > 0 && $i >= $limit) {                     continue;                 }                 $entries[] = $entry;                 $i++;             }     //            die('
'.print_r($entries, true).'
');             return $entries;         }     }     register_widget( 'CachedFeed' );


title: How to Insert Popup box shortcode in wordpress

text:
I create a Tinymce Popup box for inserting shortcode on content area in wordpress. When I click shortcode button then popup box open successfully with input field. But when I click popup box insert button then noting happen. I search on google and try so hard but I can't find out the problem. Please, anyone can help me. In the following is my popbox code:               <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">               <title>Insert Button</title>                    <link rel="stylesheet" href="includes/css/friendly_buttons_tinymce.css" />
             <form action="/" method="get" accept-charset="utf-8">
                     Button URL                     <input type="text" name="button-url" value="" id="button-url" />

                     Button Text                     <input type="text" name="button-text" value="" id="button-text" />

                     Size                     <select name="button-size" id="button-size" size="1">                         <option value="small">Small</option>                         <option value="medium" selected="selected">Medium</option>                         <option value="large">Large</option>                     </select>

                     Style                     <select name="button-style" id="button-style" size="1">                         <option value="less_round">Less Round</option>                         <option value="round" selected="selected">Round</option>                         <option value="square">Square</option>                     </select>

                     Color                     <select name="button-color" id="button-color" size="1">                         <option value="gray" selected="selected">Gray</option>                         <option value="blue"=>Blue</option>                         <option value="red">Red</option>                         <option value="green">Green</option>                         <option value="black">Black</option>                     </select>

                     Alignment                     <select name="button-align" id="button-align" size="1">                         <option value="gray" selected="selected">None</option>                         <option value="left"=>Left</option>                         <option value="right">Right</option>                     </select>

                        Insert
             </form>