title: show title if one of post meta exist

text: I have 4 metabox `facebook`, `twitter`, `instagram`, `youtube` with title "Follow Us". I am using this code to show facebook logo and link. So if there are a value in facebook metabox I got the logo and the link. Now my question, if One of this 4 metabox (facebook, twitter, instagram, youtube) has a value ( at least one of this 4 ), I need to show title "Follow Us on". Thank you


title: Is `is_sidebar_active()` deprecated, and showing error?

text: I **Googled** `is_sidebar_active()`, used by several WordPress trainer, but I came to the decision, the function's surely deprecated. But unfortunately I found no mention, even no entry in WordPress Codex. As a Wikipedian, I also edit the Codex sometime, but need the confirmation that, `is_sidebar_active()` IS DEPRECATED, and `is_active_sidebar()` is ON now. I used `is_active_sidebar()` instead of `is_sidebar_active()` in my theme and it's working fine. But I need a confirmation. Anybody?


title: why is markup routinely placed in functions in wordpress?

text:
Here is an exampple from a woothemes theme. I'm definetly not having a go at woothemes - they are a great theme provider with great standards and this sort of thing is fairly typical in themes. why? Is this sort of code best practice in wordpress? I suppose I'm expecting view type stuff to be in a template file or partial, not in an php includes file               /*-----------------------------------------------------------------------------------*/     /* Optionally load top navigation. */     /*-----------------------------------------------------------------------------------*/          if ( ! function_exists( 'woo_top_nav' ) ) {     function woo_top_nav () {         if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'top-menu' ) ) {             global $woo_options;     ?>

                 <?php superstore_contact(); ?>                                      <?php wp_nav_menu( array( 'depth' => 6, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'top-nav', 'menu_class' => 'nav fl', 'theme_location' => 'top-menu' ) ); ?>

           <?php         }     } // End woo_top_nav()     }


title: Snapshot Theme from WooThemes — empty 'alt' attribute

text: I´m using Snapshot theme from WooThemes. The code which resizes (width and height and size in kb), and shows the images (an 'a' tag, wrapping an 'img' tag) is this one:               <?php if ( get_option('woo_resize') ) { woo_get_image('image','210','280');?>       The problem is: I´ve setted the 'alt' text while posting and, when trying to see the post image source code, the 'alt' attribute, appears, empty. Does anyone has passed for this before? Any tips? The post which I wanted to have the 'alt' attribute is the first product in the first row, in the first column: http://kevingstongramado.p.ht/catalogo/?cat=28 I´ve tried to insert code manually, without the use of the theme´s functions.. Here´s what I´ve tried: EDIT (I´ve noticed posting one new post, that the code doesn´t resize in kb):               <?php $img_attr = wp_get_attachment_image_src($attachment->ID, 'image');     $image = wp_get_image_editor($img_attr[0] ); // Return an implementation that        //extends <tt>WP_Image_Editor</tt>     if ( ! is_wp_error( $image ) ) {     $image->resize(210, 280, true );     $image->save($img_attr[0]);     }     $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);                 ?>     <a href="<?php echo get_permalink($post->ID); ?>" title="View <?php the_title(); ?>">         <img src="<?php echo get_post_meta($post->ID, "image", $single = true); ?>" alt="<?php      echo $alt;?>"/>      The code doesn´t resize in kb and, still don´t get the 'alt' attribute. I´ve tried using 'SEO Friendly Images' plugin. Doesn´t work for me. What should I do?


title: Lightbox gallery in a link

text: Here is what i try to get. Into WordPress a module plugin that allow me to make slideshow of image. create a portfolio name "castle" and another one name "bridge" and get 3-5 photo in each. Then, in a text, i will talk about a beautiful bridge name xyz and i like the name of the bridge to be a link, when i click this link, a modal window will appear with a slideshow (light-box evolution is perfectly what i like), then somewhere else, when i talk about the caste abc i like the name to be a link, when click, show a slideshow of thos 4 image uploaded. so the question, what plugin do that ? thanks for the help ! the way things work in the theme Barely Corporate from ThemeBlvd is AWESOME, but i think it's custom work for there theme ! I try to find a way to get the behavior i whant, i am not promoting any theme or telling this is better that that, i just have seen behavior a like to replicate for my site


title: How to add PHP code snippet to all Post pages?

text: I wrote a short PHP snippet that I want to include on all past and future posts. I can't figure out which PHP file to add it into that'll affect the change to all and only Posts. Can someone point me in the right way? Thanks.


title: What is the use of to_ping and pinged column?

text: Can anyone explain or show a reference for the use of `to_ping` and `pinged` column in the wp_posts table? It seems that my Googling skills have failed me. I wanted to do an experiment using the `pinged` column to save the `term_id` of a term that is related to this post record. I know that the proper way is to use custom field instead, but I wanted to reduce the mysql `inner join` in the WP_Query calls. Thank you in advance.


title: How To: Simple domPDF Example

text: Not quite sure if anyone here has used dompdf, but I'm in need of assistance. There's a plugin (post-pdf-export) that exports posts to PDF using dompdf. All I need to do is generate some html (`<html><body><p>PUT INVOICE HERE</p></body></html>`) and export that to a PDF object and attach it to an email. I have got all of the code "executing" but the PDF that is generated will not open in Adobe Reader, but the pdf generated by the post-pdf-export plugin will. Not sure where I'm going wrong, but here's the basics (and please, someone tell me what I'm missing): 1) Include the dompdf class (in functions.php):                   define('SSM_PLUGIN_PATH' , plugin_dir_path(  __FILE__  ) );         include(SSM_PLUGIN_PATH.'/dompdf/dompdf_config.inc.php' );      2) Add admin sub-menu item and call my function:                   add_submenu_page(              'ssm_main_menu', // Parent Slug             'Test PDF', // Page Title             'Test PDF', // Menu Title             'manage_options', // Capability             'test-pdf', // Menu Slug             'test_pdf_handler' // Function         );      3) Function exports html to pdf:               function test_pdf_handler()     {         $stuff = '<html>                     <body>                     <p>                         PLEASE WORK!!!                     </p>                 </body></html>';         set_time_limit(300);         ini_set('memory_limit', '-1');              $dompdf = new DOMPDF();         $dompdf->load_html($stuff);         $dompdf->set_paper( 'letter' , 'portrait' );         $dompdf->render();         $dompdf->stream('sample.pdf');              exit();     }      4) Result - PDF that will not open... HELP? **UPDATE:** To add to the confusion, the post-pdf-plugin dompdf directory loads perfectly, but when I go get the dompdf package directly from git and include it in my plugin, it fails to load. If someone doesn't know what's going on, can someone recommend another solution for generating PDFs in PHP in a WordPress plugin? **UPDATE 2:** After creating a blank plugin to test this (to see what I have wrong in my plugin), I did notice one difference. My plugin pushes content to the front-end using shortcodes so I used to get the error message `Warning: Cannot modify header information - headers already sent by (output started at H:\\...`. So, to get around this, I added the following to my plugin to clear that error, but I believe it is causing the creation of the PDF to fail:               add_action('init', 'do_output_buffer');          function do_output_buffer() {         ob_start();     }


title: attachment.php & flexslider—linking thumbnail to specific image

text:
I am nearly there but need the help of the community to bring me home! I am linking from a "gallery overview" page (thumbnail grid) to a single, full-size image page (attachment.php) containing a slideshow. The user should then be able to use flexslider to scroll through the additional attached images. So far, this is all working correctly—in principle. The problem is that clicking on any thumbnail brings the user to the FIRST image in the gallery, rather than the actual image represented by the thumbnail. My attachment.php code is as follows:

     <?php                 global $post;                 $args = array(                     'post_type' => 'attachment',                     'numberposts' => -1,                     'post_status' => null,                     'post_parent' => $post->post_parent,                     'order_by' => 'menu_order',                     'order' => 'ASC'                 );                 $attachments = get_posts($args);                 if ($attachments) {                     foreach ($attachments as $attachment) {                         echo '
';                         echo wp_get_attachment_image($attachment->ID, 'large');                         echo '
';                     }                 }     ?>

      Any help would be greatly appreciated. Also, the test site can be found here (simply click on one of the thumbnails to see what I mean): http://www.adamprince.us/clients/mcnairevans/projects/confessions-for-a-son/ Many thanks!!!


title: Remove inline width and height definitions from post images (single.php)

text: I have exported around 300 posts out of Blogger and into WordPress. The posts are mostly made up of images as it’s a fashion blog. Everything went great import-wise but the problem is that all images have `width` and `height` attributes applied to them. I need to find a way to remove these attributes on all existing posts and all future posts. From there I will just apply the Bootstrap 3 class to make images responsive (`img-responsive`). What exactly should I be targeting here? The images are being spit out by `the_content()` and some people are saying it’s related to the `wp_get_attachment_image_src()` function but I’m not totally sure… the WordPress support forms are a total mess and all the blog posts I come across are outdated :-( Any help on this would be appreciated, thanks in advance!


title: Extending WP_Query — Optimise SQL query

text: I'm storing posts, a user follows in a custom table that has the columns `id`, `post_id` and `user_id`. To fetch posts that a user follows I have extended the WP_Query as follows:               class WP_Query_Posts_User_Follows extends WP_Query {         function __construct($args=array()) {             if ( !empty($args['followed_by']) ) {                 $this->followed_by = $args['followed_by'];                 add_filter('posts_where', array($this, 'posts_where'));             }             parent::query($args);         }              function posts_where($where) {             global $wpdb;             $table = $wpdb->prefix . 'post_followed_by';             $where .= $wpdb->prepare(" AND ID IN (SELECT post_id FROM $table WHERE user_id = %d)", $this->followed_by);             return $where;         }     }      If you notice there is sub-query in the `WHERE` clause. My understanding is that sub-queries are bad as they hinder performance and particularly in this case where the sub-query could potentially return hundred or thousands of `post_ids` that a user follows. What are the alternatives that I have, considering that I need to work with WP_Query and cannot run a custom SQL directly using `wpdb`?


title: Prev/Next Links Broken on Static Front Page Pagination

text:
I've taken the example straight from the codex on this one, and my pagination is broken. Here's the codex page I copied/pasted the code from: https://codex.wordpress.org/Function_Reference/next_posts_link Everything is working. My posts are showing, and I get **only** the `next_posts_link`, however it only works until page `2`. The `previous_posts_link` never appears. I can only paginate to page 2, and I cannot go back or further. I'm using WordPress 3.5.2 and I have reset my permalinks after attempting this. I put a little debug section below to find how many max pages there are, the `var_dump` returns `float(87)`. And here's my PHP code. Any thoughts?               function homepage_test() {         // Set the limit of posts to show per page         $limit = 5;         // set the "paged" parameter (use 'page' if the query is on a static front page)         $paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1;              // the query         $the_query = new WP_Query( 'showposts=' . $limit . '&paged=' . $paged . '&orderby=date&order=DESC' );              if ( $the_query->have_posts() ) :         // the loop         while ( $the_query->have_posts() ) : $the_query->the_post();                   the_title();         endwhile;              // usage with max_num_pages         next_posts_link( 'Older Entries', $the_query->max_num_pages );         //Debug to show how many max pages.         var_dump($the_query->max_num_pages);         previous_posts_link( 'Newer Entries' );              // clean up after our query         wp_reset_postdata();         else: ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
         <?php endif;     }


title: wp_insert_post hook not being called with wp_publish_post or wp_insert_post?

text: I have a plugin that converts hashtags (any text that starts with #) into Wordpress tags. It's working great when I manually create a post via the Wordpress dashboard, but doesn't work when I programmatically create a post. Here's how I'm programmatically creating the posts: First I create a draft:               $post = array(       'post_content'   => $messagefordatabase,       'post_name'      => $publickey,       'post_title'     => $publickey,       'post_status'    => 'draft'     );          $post_id = wp_insert_post($post);      Then when it's time to publish the post, this code changes the draft's publish status. (This publishes the post, but doesn't run the plugin):               wp_publish_post($postid);      And lastly, here's the code from the plugin:               function hashtags_insert_post( $id, $data ) {       if (preg_match_all("/".HASHTAGS_REGEXP."/i", $data->post_content, $match)) {         $tags = implode(", ", $match[2]);              wp_add_post_tags( $data->post_parent, $tags );       }            return $id;     }     add_filter( 'wp_insert_post', 'hashtags_insert_post', 99, 2 );      So in summary, the first 2 chunks of code above don't run the plugin. How can I trigger the plugin from either of those 2 chunks of code? Thanks!!


title: trouble with featured image

text: I don't understand why this happens I created a new image size in functions.php called blog. Code looks like this                   add_theme_support( 'post-thumbnails' );     add_image_size('blog', 134, 134, false);       Yet for some reason when the featured image comes out as 134 by 58 when called like this                <?php the_post_thumbnail('blog'); ?>      Can anyone tell me why that is? The actual image uploaded to the library is much larger than that


title: Problems With Query and/or Template Part and/or PHP

text: I'm trying to show only the last article. I made content-latestnews.php and it worked before meddling with queries. Template part was shown, but after I tryed to show the actual content it would show page up to the query part. Category 1 (which is vesti ( _ser_.) = news) is there, there is like dozens of posts in that category. Nevertheless, it doesn't show anything even if query is left out. I'm using Wordpress 3.9. I've tried with:               <?php     $lastnews = new WP_Query('showposts=1&cat=1');     if ( $lastnews->have_posts() ) : while ( $lastnews->have_posts() ) : $lastnews->the_post();         // Include the latest news template.         get_template_part( 'content', 'latestnews' );     endwhile; endif;     wp_reset_postdata()     ?>      and               <?php         $lastnews = new WP_Query('showposts=1&cat=1');         while ( $lastnews->have_posts() ) : $lastnews->the_post();             // Include the latest news template.             get_template_part( 'content', 'latestnews' );         endwhile;     ?>      I even tried without query               <?php     if ( have_posts() ) :         while ( have_posts() ) : the_post();         // Include the latest news template.         get_template_part( 'content', 'latestnews' );         endwhile;     endif;     ?>      and               <?php          if ( have_posts() ) : the_post();         // Include the latest news template.         get_template_part( 'content', 'latestnews' );     endif;     ?>      Thank you for your time. This should be bare basic, but obviously I'm missing something simple.


title: Setting a homepage - doesn't seem to work

text: have a page (home) that runs a template page-home.php that I can access at mydomin.com/home. I am wanting to have this as my static homepage page, so accessible at mydomain.com/ however I cannot seem to get this to work. I have change the settings in permalinks to allow for a static homepage, and selected the page I would like to use from the dropdown select box. On saving and refreshing my site, I just get a blank a white screen. I assumed that as the suffix of the domain is no longer home that wordpress does not know to use the page-home.php I have changed the name of the file to be the following, home.php, index.php, homepage.php, page.php and all I get is white screen for my homepage, am I doing something wrong? in 5 years of using wordpress I have never had a problem setting a homepage. I have also disabled all plugins and set turn the on one by one to make there was nothing in them breaking the page, but no success. The page is very simple, it is just a loop display posts from a custom post type.


title: get_posts ignoring 'category' and displaying all posts

text: I'm going a bit crazy on this one. I'm trying to display a list of posts in a category on an Admin page in a plugin I am writing. The following code works fine on my dev server (OS X/Apache):               $args = array(         'posts_per_page' => $pageSize,         'offset'=> $offset,         'category' => 9     );          $posts = get_posts($args);          foreach ($posts as $key => $aPost) {         (...)     }      As you might suspect, I get only posts in the category with an ID of 9. Now, on my production server (Linux/Nginx) it shows all posts - as if the category argument was never set. I only mention the nginx/apache/linux/os x as everything else is running the same - same themes and plugins installed (with the exception of Jetpack on the production server). Any thoughts?


title: Tips for targeting widget dragable for WP Pointer on widgets.php page

text: I'm updating a widget plugin I wrote called Feature Me and am adding in WordPress pointers for first time users to help them find the widget after installing the plugin. However, I have come across a problem. The pointer has to have a target to go to which is either an ID `#` or a CLASS `.` (that's fine under normal circumstances). But on the widget page, all widgets are prepended with `widget-[somenumber]`. ![Screen of prepended widget number with the message I'd like to display](http://i.stack.imgur.com/ltY6N.png) If i know what [somenumber] is I can target it no problem, but 99% of the time, I won't know what the number is since it really depends on the order of the plugin's installation. On a different website, this is the ID of the widget: ![Screen of prepended widget number from a different website](http://i.stack.imgur.com/yXM5r.png) Hopefully you can see my problem. For context, I'm using this method of displaying the pointer from TutsPlus. Specific function for the above message here:               function fm_message_widget_location( $p ) {         $p['fm_message_widget_location'] = array(             'target' => '#widget-7_feature_me-__i__',             'options' => array(                 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',                     __( 'Feature Me - Getting Started' ,'plugindomain'),                     __( 'Looking for Feature Me? It\'s right here! Drag the widget to create your first call to action!',                         'plugindomain')                 ),                 'position' => array( 'edge' => 'left', 'align' => 'middle' )             )         );         return $p;     }     add_filter( 'fm_admin_pointers-widgets', 'fm_message_widget_location' );      This would work fine if my widget was always in the 7th position, but it won't be. I've attempted to pass through regex for the target, but that doesn't work, I'm assuming because the javascript code treats it as a string. ie. `'target' => '#widget-[0-9*]_feature_me-__i__'` or `'target' => 'RegExp("#widget-[0-9*]_feature_me-__i__")'` So given all of this, has anyone ever been successful at targeting these individual widget "dragables" with success in their plugins? Any advice/recommendations would be most welcome.


title: Exclude sub category posts from category display

text: I have a post category structure like this:   * news   * news / conferences   * news / newsletter In Appearance > Menu, I have added 3 menu items. One each for the categories News, Conferences, Newsletter. However, the News page also displays posts from Conferences and Newsletter. How do I exclude posts from subcategories from being displayed in the parent category's page? Thanks


title: Sub Categories Keep Redirecting to Pages With Same Slugs

text: What I want to do is have a `news` category with two sub categories (`property-registration` and `property-revitalization`). Going to /news works fine. However going to _/news/property-registration_ or _/news/property- revitalization_ redirects to same-named pages instead (`/programs/property- registration` and `/programs/property-revitalization` instead). I have downloaded a couple of plugins that let me save templates to categories but none of them worked and still got the same results. My permalink structure is `/%category%/%postname%/` for reference and no category base is set.


title: Load plugin on specific page only

text: I have plugin I would like to use only on the contact page, however the script and css is being loaded on every page. Aside from the increased http requests, it is also causing another script to not work properly on another page. Is there a way to stop this plugin from loading anywhere else on the site? I know how to do this with normal scripts in the header, but I am not sure how to do this with a plugin that automatically injects scripts into the header. Thanks in advance.


title: Contact Form 7 plugin refreshing page on submit

text: For those with experience of the Contact Form 7 plugin - When I installed it, the form worked fine, and upon pressing the submit button, there was no page load, all done via Ajax, however now the page loads upon pressing submit. I have not made any changes to the form. I have tried deactivating then activating but the problem remains. Has anyone else had this problem before? Thanks


title: Using same directory for storing all uploaded images on a Wordpress network

text: I currently use a Wordpress network in order to run a number of sites, which all use the same template, plugins and images. As posts appear on a multiple sites, it makes sense to only upload images to one location (and have one copy of an image), rather than multiple ones. Could I perhaps achieve this by creating a custom rewrite? Or is there a better way to achieve this? **Background information** I am using WPThree Broadcast to 'broadcast' an image over multiple sites, and therefore also copy the images into their respective image libraries. I don't want the server to get cluttered with ten copies of the same image so instead am checking to see if the image is already in a site's `wp_posts` table, and then if not copying the `post` and `post_meta` data into that site's tables. However, I do _not_ wish to copy the actual image into a new upload folder, as the default WP is configured to do (e.g. into `/wp- content/blogs.dir/2/files/`), so instead I want all images to be uploaded to `/wp-content/uploads/`, the default upload folder for a standard WP installation.


title: Hide Overflow on a Specific WordPress Template

text: I'm trying to hide the overflow in CSS for specific template pages but can't seem to get it to work - I know that template pages are prefixed with a class but this doesn't seem to help targeting. I think I could use the is_page_template() function to hide the overflow with JS but this should be simpler with CSS. So this works...               html {         overflow: hidden;         }      but this doesn't work...               html .page-template-showreel-php {         overflow: hidden;         }      Any ideas why? Surely this should be possible with CSS.


title: Search multiple custom post types with tags

text: I have blog with some post and pages and a forum, i need a search such that it need to search tags in post and pages and not in forum (bbpress)               if ($query->is_search()) {         $postType = array();         $tagPostType = array();         $tags = array();         if (isset($_GET['taglist']) && is_array($_GET['taglist'])) {             $tagPostType = array('page','post');             $postType = array_merge($postType, $tagPostType);             $tags = $_GET['taglist'];          } else {              $postType =  array('forum','topic','reply','page','post');          }          if(isset($_GET['forums'])) {              $tags = '';              $postType = array_merge($tagPostType, array('forum','topic','reply'));          }          print_R($postType);          $query->set('tag_slug__in', $tags);          $query->set('post_type', $postType);         return $query;     }      i need to search tags in post/pages and not in forums.


title: Add frontend editor with media buttons for Visitors and display only their media

text: I'm trying to make a frontend blog post submit for registered users. I have this working without media, now trying to add media. The standard `wp_editor`               $content = '';     $editor_id = 'mycustomeditor';     $settings = array( 'media_buttons' => true);     wp_editor( $content, $editor_id );      doesn't seem to display the media button for Visitors. How can I show the Add media button for Visitors? Also, I would need to show each user only his uploaded media. How is that possible?


title: Restrict custom post type from appearing with ?post_types=

text: When appending the querystring post_types = "name of your post type", it displays all the posts. I am using a plugin that has its own custom post type which is restricted (only users that have purchased a membership can view it).. but today while messing around with searching, i discovered that post_types querystring. Is there a way to prevent this private custom type from showing up? are there other similar "magic" querystring in wordpress?


title: wp_nav_menu list children if on parent page but sibling if on sibling page

text: For example: About Page (Parent)   * History   * Mission & Vision   * Location If I'm on the About Page, I need the wp_nav_menu to show the three children pages. But if I'm on the History page, I need it to show History (with current class), Mission & Vision and Location. Is there a way to do this? Thank you.


title: Why WordPress architecture is not pure object oriented and it don't use MVC pattern?

text: I am pretty new in WordPress and PHP development (I came from Java and C#) and I am a bit   astonished about how WP is structured. Coming from Java and C# I'm used to work on totally object oriented architectures and now, working on WP, it seems to me that it is not totaly object oriented. For example the **function.php** file ino every theme is not a class but is a simple php file containing some functions, so it respect the old procedural model. At the same time it seems to me that WP don't use MVC pattern My question is: why WordPress (that is a modern CMS) don't use a totally Object Oriented paradigm and don't adopt the MVC model?


title: How to append unique numbers to new duplicated post titles/urls?

text: As of now if you create two (2) posts with the same title you get the following: `domain.com/test/ domain.com/test-2/` If you create a third post, you then get another url like: `domain.com/test-3/` I am working on a directory, so the odds of someone having the same name is pretty good; therefore I want to append a custom url string to the end of the duplicated name - not just a 1 digit number. Is there a way for me to add a custom 4-5 digit string at the end of a duplicate post/page/listing? So that it reads: `domain.com/test/ domain.com/test-#####/ < the random string` thanks!


title: Adding category ID or slug to WP Nav Menu

text:
Is it possible to add the id or slug of a category in the output of wp_nav_menu menu's? For example, the standard output of wp_nav_menu is:

Home

Category 1

Category 2

Category 3

      I'm wondering if it is possible to add the category slug to the css class for that `<li>`, like so:

Home

Category 1

Category 2

Category 3


title: WooCommerce plugins permalinks？

text: I use WooCommerce.   My links are looking like this at the moment:               http://www.mywebsite.com/shop/sample-product/      but I want them to be like this:               http://www.mywebsite.com/shop/1.html/     http://www.mywebsite.com/shop/2.html/     http://www.mywebsite.com/shop/3.html/     http://www.mywebsite.com/shop/4.html/     http://www.mywebsite.com/shop/5.html/     http://www.mywebsite.com/shop/x.html/      how do I change them?


title: Multiple image not being Uploading inside fieldset in Custom Field Template Plugin version 2.1.5 wordpress

text: In Custom Field Template Plugin 2.1.5 Multiple image in not being uploaded/saved after clicking Update button. Can anyone kindly help me with this ? Optimistic to find the fix. http://wordpress.org/extend/plugins/custom-field-template/


title: Prioritizing wp enqueue scripts error

text: I wanted to load the following two scripts before any other script so I added priority 1 and 2, however I am getting an error. I read it on a tutorial that this is how to prioritize                add_action('wp_enqueue_scripts', array(__CLASS__, 'frontend_enqueues', 1));             add_action('print_head_scripts', array(__CLASS__, 'print_js', 2));      > Warning: call_user_func_array() expects parameter 1 to be a valid callback, > array must have exactly two members in xxx/xx/xxx/wp-includes/plugin.php on > line 406 > > Warning: call_user_func_array() expects parameter 1 to be a valid callback, > array must have exactly two members in xxx/xx/xxx/wp-includes/plugin.php on > line 173 Please advice :)


title: Question regarding WP multisite feature

text: Hi I am developing a networking website using wp multisite feature. The website will have three different sites.   1. buystuff.abc.com   2. sellstuff.abc.com   3. rentstuff.abc.com Now if "X" person register on buystuff.abc.com and complete his profile. Will he be able to access the other two sites with same credentials used on to register on buystuff.abc.com?


title: More than one dynamic sidebar

text:
I created 3 dynamic sidebars in my function.php file, everything went well, no problems. in a file named, sidebar-services.php, I have the following code.               <?php     /**      * The Sidebar containing services      *      * @package Group Joosen      */     ?>                  <?php if ( ! dynamic_sidebar( 'service1')): ?>                            <?php endif; // end sidebar widget area ?>               <?php if ( ! dynamic_sidebar( 'service2')): ?>                            <?php endif; // end sidebar widget area ?>                  <?php if ( ! dynamic_sidebar( 'service3')): ?>                            <?php endif; // end sidebar widget area ?>      In my front-page.php I have:

          <?php get_sidebar('services');?>

      **Everything is working fine** , I only have the feeling this is not the right way. Is there any possibility that I can have all the **div classes** in the sidebar-services.php file? In that file I want to "ask" for my 3 sidebars with one if-statement, otherwise it will create the classes 3 times. Hope you understand guys ------EDIT-------- * _Why is this not working? This is what I mean with "more compact code" *_               <?php if ( ! dynamic_sidebar( 'service1' ) and (! dynamic_sidebar( 'service2' ))): ?>                                <?php endif; // end sidebar widget area ?>


title: Font type by language: Latin - Greek - Cyrillic

text: How I get type of font (Latin, Greek, Cyrillic), which is required in wordpress site? It may be based on language. I need this for including Google font - I don't want to include all font sets. I need to get GET parameter `subset`               <link href='http://fonts.googleapis.com/css?family=Open+Sans&subset=latin,greek'      rel='stylesheet' type='text/css'>      Solution should work on multisites and with any multi-language plugin.


title: How to use custom fields to enable sticky posts on custom post types?

text: **Background:** The Wordpress Answers site has two questions which ask about how to enable sticky posts on custom post types (see how to make custom posts sticky? and Enable sticky posts to custom post_type ). Both questions made mention of this trac ticket ( https://core.trac.wordpress.org/ticket/12702 ). The answers provided ( _to those questions I mentioned above_ ) express a possibility of using custom post types and meta-boxes. Unfortunately the level of detail in those answers was not helpful to me (and, I presently don't have enough reputation to comment for further clarification). **My Goal:** I am using the custom post type ui plugin and the advanced custom fields plugin to display employee profile CPT's. One one of my pages lists all of the employee profiles, but the client wants certain profiles to be stick to the top. I have reviewed two possible plugins to assist me (seamless sticky custom post types and sticky custom post types). Unfortunately, those plugins seem only to output the sticky post on the homepage. For my purposes, the sticky-feature should only apply to the specialized page template that lists all the employee profiles, and not the home page. **Question Restatement:** It seems like the best solution for me involves somehow using custom fields to accomplish the desired result. Is this correct? If so, please direct me to any wordpress template tags, techniques, examples or tutorials that might help.


title: About number of posts in selected category

text: I have lots of categories. And each category contains many images in posts. I want to display '(current number of post)/(total number of posts in selected category)' for example: 3/9   where 3 = current number of post 9 = total number of posts in selected category There are so many categories and I do not want to write code for each category. Is there any way to solve it?


title: Configure Permissions in Mamp

text: I recently built a website on Mamp, and upon uploading to my hosting server, I seem to have lost permissions. My guess is that the migration from local to server brought the permissions with it. You can see here `http://162.213.156.137/~healthy/`, in the left lower area of footer that the images are not loading in. I also had the two images in the header (little girl and logo) not load in either until I used FTP to manually change permissions. I'm wondering if anyone has dealt this before and has advice or if you know how to configure MAMP to have proper settings from the get go.


How to create separate shop pages in woocommerce for each product category i.e. computers, cameras, cellphones, software, books, etc.


title: How to call custom function outside from the admin page?

text: I've created a function but i have some problems with it...                echo get_option( 'my_function', 'custom_logo' );      I try to use this in my code but it returns me an array not a string. When i use `echo $options['custom_logo'];` on my plugin backend admin page the code returns the value as a string. So how can i call it from my theme for example?


title: Show all 12 months regardless they have posts

text:
I need to show all months for a year for an archives page. All 12 months must be shown regardless of whether or not there are posts published for a month. Like this: Year: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Of course, months with published posts are links. Months with no published posts are simply the word This is my code:
          <?php         global $wpdb;         $limit = 0;         $year_prev = null;         $months = $wpdb->get_results("SELECT DISTINCT MONTH( post_date ) AS month , YEAR( post_date ) AS year, COUNT( id ) as post_count FROM $wpdb->posts WHERE post_status = 'publish' and post_date <= now( ) and post_type = 'post' GROUP BY month , year ORDER BY post_date DESC");         foreach($months as $month) : $year_current = $month->year;         if ($year_current != $year_prev){ if ($year_prev != null){ ?>              <?php } ?>
 <a class="year" href="<?php bloginfo('url') ?>/<?php echo $month->year; ?>/">> <?php echo $month->year; ?>              <?php } ?>              <a class="month" href="<?php bloginfo('url') ?>/<?php echo $month->year; ?>/<?php echo date("m", mktime(0, 0, 0, $month->month, 1, $month->year)) ?>"><?php echo date_i18n("M", mktime(0, 0, 0, $month->month, 1, $month->year)) ?>              <?php $year_prev = $year_current; if(++$limit >= 10) { break; } endforeach; ?>

      I achieved what I pretend to do except for showing all the 12 months.


title: Custom theme folder

text: Is anyone aware of an equivalent to `WP_PLUGIN_DIR` and `WP_PLUGIN_URL` for themes that I can define in `wp-config.php`, or am I stuck creating a mu- plugin and registering a new theme dir?


title: Prevent Page/Post From Being Created based on Pages/Posts per User per Time Unit

text: I'm working on new project and I want to let users have access to create pages on the site. To prevent users from "spamming" a lot of pages, I'd like to set a daily upload limit for each user. I've posted the code I'm using below but I'm not able to cancel the page upload because the event is being fired after a page has been created and added to the database. Worst case scenario, I can search the database and delete the document they just created but I don't think that that's the best solution. Is there a hook similar to pre_post_update that I can use to check and or cancel the page from being uploaded? If there isn't a hook I can use, is there a better way to solve this problem?               add_action( 'save_post', 'check_post_limit' );          function check_post_limit( $post_id ) {     global $userdata;     global $post_type;     global $wpdb;     if( $userdata->ID != 1) {         $post_count = $wpdb->get_var( "SELECT count(*) FROM $wpdb->posts WHERE DATE(post_modified) = DATE(NOW()) AND post_author = $userdata->ID" );     }     if( $post_count > 3 ) {         wp_die(); //will not work because page is already in the database     }     }


title: Woocommerce Multiple Tags Archive URL

text: I'm curious if there's any easy way to setup WooCommerce to show an archive page of multiple different tags. For example a URL like http://www.domain.com/products/?tag="toys"&tag="electronics" would show an archive page for both toys and electronics. What I'm really trying to do is have a (Gravity Forms) form that sends users to specific groups of products by tag based on their answer to a short questionnaire.


title: Pre_Get_Posts order DESC not registering

text: I've created a filter function to filter a post type `items` by it's meta value `_item_price`. The problem is that it only works in Ascending Order and I'm not sure why. My `pre_get_posts` function looks like this:               function frontend_items_filter( $query ) {         global $page_items_id              if(!is_page($page_items_id))             return;              if($query->query_vars['post_type'] == 'items' && isset($_GET['filter'])){             $sort = $_GET['item_sort'];                  // Set Ordering Parameter             if(isset($_GET['item_sort']) && !empty($_GET['item_sort'])){                 switch($_GET['item_sort']){                          case 'price_lowest':                         $query->set('meta_key', '_item_price');                         $query->set('orderby', 'meta_value_num title');                         $query->set('order', 'ASC');                             break;                          case 'price_highest':                         $query->set('meta_key', '_item_price');                         $query->set('orderby', 'meta_value_num title');                         $query->set('order', 'DESC');                              break;                          default:                         $query->set('orderby', 'post_date title');                         $query->set('order', 'ASC');                 }             }         }         return $query;     }     add_action( 'pre_get_posts', 'frontend_items_filter' );      Before I save my price meta I'm verifying it's `is_numeric()`. I tried to print out my query and run the SQL directly into PHPmyadmin, If I take the SQL below and change ASC to DESC, in my PHPmyadmin the results don't change which is peculiar.               SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts         INNER JOIN wp_term_relationships              ON (wp_posts.ID = wp_term_relationships.object_id)          INNER JOIN wp_postmeta              ON (wp_posts.ID = wp_postmeta.post_id)          WHERE 1=1           AND ( wp_term_relationships.term_taxonomy_id IN (10) )          AND wp_posts.post_type = 'items'          AND (wp_posts.post_status = 'publish'          OR wp_posts.post_status = 'private')          AND (wp_postmeta.meta_key = '_item_price' )          GROUP BY wp_posts.ID          ORDER BY wp_postmeta.meta_value+0,wp_posts.post_title ASC LIMIT 0, 10      Every time it pulls my results back in `_item_price` Ascending order (lowest price to highest price). What could the problem possibly be? What else can I check / verify? **Edit** I've tried this with a few other fields I have and it's the same result - it will show ASC but not DESC.


title: Multisite on Rackspace Cloud (ubuntu lucid)

text: First post in this astonishing exchange. Glad to be here. I've installed WP3 on Rackspace Cloud, under an Ubuntu Lucid installation, properly configured all the multisite dependancies, network blogs are being successfully created, data is stored in the database, which leads me to one conclusion regarding my failure in actually USING network blogs, and that that it's somehow connected to Apache configuration. I admit I'm still slow on my Apache, but I'm getting there. Any leads you can share with me? Thank you.


title: html mail sended with wp_mail shows plain

text: I have a invoice.html that i want to send i use the following function to replace some things in the html                foreach($variables as $key => $value){       $template = str_replace('{{ '.$key.' }}', $value, $template);     }      after that i send the mail:               $to = get_option('admin_email');     $subject = "Someone reserved from ".get_bloginfo('name');     $headers = 'From: '. $email . "\r\n" .    'Reply-To: ' . $email . "\r\n";     $headers  .= 'MIME-Version: 1.0' . "\r\n";     $headers .= 'Content-type: text/html';     add_filter( 'wp_mail_content_type', 'set_html_content_type' );     function set_html_content_type() {     return 'text/html';     }          wp_mail($to, $subject, strip_tags($template), $headers);      the mail i get in my mail is like this               Invoice article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; } audio, canvas, video { display: inline-block; } audio:not([controls]) { display: none; height: 0; } [hidden], template { display: none; } html { font-family: sans-serif; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } body { margin: 0; } a { background: transparent; } a:focus { outline: thin dotted; } a:active, a:hover { outline: 0; } h1 { margin: 0.67em 0; font-size: 2em ...       (and the rest of the css) and then some html text without the html tags...so it does recognize html because it doesnt show and stuff like that but it doesnt use the css... how come ?


title: How Do I create multiple Top Level Admin Menu Pages To submit data to the options table?

text:
I am trying to create more than one top level options page in my wordpress theme. But right now I can only save the data for one. How can I save the data for two without having to create tabbed panels?               // create custom plugin settings menu     add_action('admin_menu', 'baw_create_menu');          function baw_create_menu() {          //create new top-level menu      add_menu_page('BAW Plugin Settings', 'BAW Settings', 'administrator', 'baw-settings', 'baw_settings_page');          //call register settings function     add_action( 'admin_init', 'register_mysettings' );     }               function register_mysettings() {     //register our settings     register_setting( 'baw-settings-group', 'new_option_name' );     register_setting( 'baw-settings-group', 'some_other_option' );     register_setting( 'baw-settings-group', 'option_etc' );     }          function baw_settings_page() {     ?>

Your Plugin Name
          <form method="post" action="options.php">     <?php settings_fields( 'baw-settings-group' ); ?>     <?php do_settings_sections( 'baw-settings-group' ); ?>

         New Option Name	         <input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" />

         Some Other Option	         <input type="text" name="some_other_option" value="<?php echo get_option('some_other_option'); ?>" />

         Options, Etc.	         <input type="text" name="option_etc" value="<?php echo get_option('option_etc'); ?>" />

          <?php submit_button(); ?>             </form>
        <?php      }               // create second custom plugin settings menu     add_action('admin_menu', 'bax_create_menu');          function bax_create_menu() {          //create new top-level menu     add_menu_page('BAX Plugin Settings', 'BAX Settings', 'administrator', 'bax-settings', 'bax_settings_page');          //call register settings function     add_action( 'admin_init', 'register_settings' );     }               function register_settings() {     //register our settings     register_setting( 'bax-settings-group', 'option_name' );     register_setting( 'bax-settings-group', 'other_option' );     register_setting( 'bax-settings-group', 'etc' );     }          function bax_settings_page() {     ?>

Your Plugin Name
          <form method="post" action="options.php">     <?php settings_fields( 'bax-settings-group' ); ?>     <?php do_settings_sections( 'bax-settings-group' ); ?>

         New Option Name	         <input type="text" name="new_option_name" value="<?php echo get_option('option_name'); ?>" />

         Some Other Option	         <input type="text" name="some_other_option" value="<?php echo get_option('other_option'); ?>" />

         Options, Etc.	         <input type="text" name="option_etc" value="<?php echo get_option('etc'); ?>" />

          <?php submit_button(); ?>          </form>
     <?php      }


title: Locked out of WordPress Site Admin after enabling Force SSL on WordPress Https (SSL)

text: I am in a terrible fix. I have been locked out of Site Admin and the solutions offered by the plug-in team in their documentation aren't working. I've tried both methods using Webmatrix. I have to launch my site on Friday and I don't know what to do. This is what they suggested: How do I reset the plugin's settings?   Go to `/wp-content/plugins/wordpress-https/wordpress-https.php` and uncomment (remove the two forward slashes before) the line below, or go to your `wp- config.php` file and add this line. Hit any page on your site, and then remove it or comment it out again.               define('WPHTTPS_RESET', true);      The settings won't save! Did you reset the plugin following the steps above and forget to comment the line back out or remove it from `wp-config.php`?


title: How to Debug the 'save_post' Action?

text:
Is it possible to validate PHP code? I have a Custom Post Type (Film) with Custom Meta Boxes. Everything is working fine, I can add new Films and details to the Custom Meta Boxes. My problem is with the Update button. If I create a new film, add info and click Update a get a white screen. I know the problem is with the function.php and the Custom Post Type but how do I find the mistake? If I check of the source of the white page it shows 2 empty lines but code has no leading or trailing empty lines.                   <?php             add_action( 'admin_print_styles-post-new.php', 'film_style', 11 );             add_action( 'admin_print_styles-post.php', 'film_style', 11 );                  function film_style() {                 global $post_type;                 if( 'films' == $post_type )                     wp_enqueue_style( 'film-style', get_stylesheet_directory_uri() . '/css/filmMetaBox.css');             }         ?>              <?php             add_action('init', 'film_init');             function film_init(){                 $film_labels = array(                     'name' => _x('Film', 'post type general name'),                     'singular_name' => _x('Films', 'post type singular name'),                     'all_items' => __('All Films'),                     'add_new' => _x('Add new Film', 'film'),                     'add_new_item' => __('Add new Film'),                     'edit_item' => __('Edit Film'),                     'new_item' => __('New film'),                     'view_item' => __('View film'),                     'search_items' => __('Search in films'),                     'not_found' =>  __('No films found'),                     'not_found_in_trash' => __('No films found in trash'),                      'parent_item_colon' => ''                 );                 $args = array(                     'labels' => $film_labels,                     'public' => true,                     'publicly_queryable' => true,                     'show_ui' => true,                     'query_var' => true,                     'rewrite' => true,                     'capability_type' => 'post',                     'hierarchical' => false,                     'menu_position' => null,                     'supports' => array('title','editor'),                     'has_archive' => 'films',                     'register_meta_box_cb' => 'cd_meta_box_add'                 );                 register_post_type('films',$args);             }         ?>         <?php             add_action( 'add_meta_boxes', 'cd_meta_box_add' );             function cd_meta_box_add(){               add_meta_box( 'my-meta-box-id', 'Film Credits', 'cd_meta_box_cb', 'films', 'normal', 'high' );             }                  function cd_meta_box_cb( $post ){               $values = get_post_custom( $post->ID );                    $title = isset( $values['meta_box_title'] ) ? esc_attr( $values['meta_box_title'][0] ) : '';               $director = isset( $values['meta_box_director'] ) ? esc_attr( $values['meta_box_director'][0] ) : '';               $desc = isset( $values['meta_box_desc'] ) ? esc_attr( $values['meta_box_desc'][0] ) : '';                    wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );                    ?>

                       Film Title                       <input type="text" name="meta_box_title" id="meta_box_title" class="textInput" value="<?php echo $title; ?>" />

                       Director                       <input type="text" name="meta_box_director" id="meta_box_title" class="textInput" value="<?php echo $director; ?>" />

                       Description                       <textarea name="meta_box_desc" id="meta_box_desc" class="textInput" col="100" row="5"><?php echo $desc; ?></textarea>

               <?php             }                  add_action( 'save_post', 'cd_meta_box_save' );             function cd_meta_box_save( $post_id ){               if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;// Bail if we're doing an auto save                    // if our nonce isn't there, or we can't verify it, bail               if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;                    if( !current_user_can( 'edit_post' ) ) return;// if our current user can't edit this post, bail                    $allowed = array( // now we can actually save the data                   'a' => array( // on allow a tags                       'href' => array() // and those anchords can only have href attribute                   )               );                    if( isset( $_POST['meta_box_title'] ) )//if data set save it.                   update_post_meta( $post_id, 'meta_box_title', wp_kses( $_POST['meta_box_title'], $allowed ) );               if( isset( $_POST['meta_box_director'] ) )                   update_post_meta( $post_id, 'meta_box_director', wp_kses( $_POST['meta_box_director'], $allowed ) );               if( isset( $_POST['meta_box_desc'] ) )                   update_post_meta( $post_id, 'meta_box_desc', wp_kses( $_POST['meta_box_desc'], $allowed ) );             }         ?>


title: Wordpress mu domain mapping

text: I've asked this question on the plugin support page but can't get an answer :/ Is it possible to use the domain mapping plugin to map domains in Wordpress (multisite) that are mapped to domains with a subdirectory? I can get foo.example.com to map fine, but I can't get example.com/foo to map from blogs.mywebsite.com/bar I get a redirect back to the the route of the site blogs.mywebsite.com. I'm using the latest wordpress and the latest install of the wordpress domain mapping plugin. Is what I'm trying to do achievable?


title: call adminbar greeting in other place

text: I have disabled wordpress adminbar by adding this filter:               add_filter('show_admin_bar', '__return_false');      But I still want to use it's greeting in other place. By greeting I mean a dropdown menu which says: Howdy admin. Is there any easy way to do this?


title: Exclude categories from homepage but not from sidebar

text: I would like to exclude categories from my homepage, but I want them to still display in the sidebar shown on the homepage, how can I do that? At the moment my code excludes from both the content area and the sidebar, and I am putting the code in the functions.php file:               function exclude_category_home( $query ) {         if ( $query->is_home ) {                 $query->set( 'cat', '-5, -34' );         }         return $query;     }          add_filter( 'pre_get_posts', 'exclude_category_home' );


title: How do I change the login logo URL and hover title?

text: I am trying to change the login logo URL and hover title. I am using the code below but `return bloginfo('url');` and `return bloginfo('name');` aren't outputting the desired `href` and `title`. I'm also using a child theme if that matters at all. What do I need to use instead of `return bloginfo('url');` and `return bloginfo('name');`?               /* ==  Change Logo URL ==============================*/          function my_url_login(){         return bloginfo('url');     }     add_filter('login_headerurl', 'my_url_login');               /* ==  Change Logo URL Hover Text ==============================*/     function my_url_login_hover(){          return bloginfo('name');     }     add_filter('login_headertitle', 'my_url_login_hover');


title: Woocommerce include custom stylesheet after woocommerce styling

text: After the upgrade to WC 2.1.2 my styling seems to be overruled by the standard WC styling. Is there a way to overrule the standard WC styling without using solutions like using the `!important` or other hackish methods? Maybe by enqueueing it in a certain way in `functions.php`? A lot of people recommend to disable WC styles and to copy all the styles into your own theme styles. But isn't this bad if Woocommerce adds functionality?


title: Remove link to post thumbnail in next_image_link() in single-attachment.php

text:
I've added navigation to single-attachment.php:

<?php previous_image_link( false, ' '); ?>

<?php next_image_link(false, ' '); ?>

<a href="<?php echo get_permalink($post->post_parent) ?>" >

      and set in css own backgorund-image in .previous .next and .close works well, but I would like to remove links to thumbnails post. Anyone have any idea how to do it?


title: get_edit_post_link returning incorrect post id - why?

text:
I have an array of post-ids, something like:               Array ( [0] => 3164 [1] => 3174 [2] => 3176 [3] => 3220 [4] => 3230 [5] => 3232 )       I'm trying to fetch the post-edit-link for a custom post type, but without luck when using `get_edit_post_link()` I'm editing a CPT course and showing reserves for this course.               foreach($pupil_reserves_course as $pid) {                             $pupil_edit_link =  get_edit_post_link($pid);                          $po = get_post($pid);                 $pupil_name = $po->post_title;                                               //Post title - column is used for pupils name                 $pupil_registered = mysql2date( get_option('date_format'), $po->post_date ); //Format date from settings in admin                                             echo '' . $pupil_registered .  '' . $pupil_name . '';                 $id = $po->ID;                 echo '' . $pupil_registered .  '' . $pupil_name . '';                   echo '
';             }      The `pupil_edit_link()` returns link with post id of current post id (post ID of the course I'm editing) and not the actual id of the array `$pupil_reserves_course`. `$id` is returning the correct post id of the pupil. I could use the second link, but I really would prefer using `get_edit_post($id)`. What am I doing wrong?


title: Problem with checkbox using custom field archive

text:
How can i get archive base a custom field. I try this but my hosting say there is a problem with my code, the code make manny select in the database.. I have 1 post type, and 2 custom field >   * Post Type : produse >   * custom field : culoare >   * custom field : marime > How can i make a corect and not loading problem script... Can somebody tell me were i do rong? This i have in function.php               /* ------------ Search Avansat -----------*/          add_action('pre_get_posts', 'my_pre_get_posts');          function my_pre_get_posts( $query ) {         if( is_admin() ) { return; }         $meta_query = $query->get('meta_query'); // get original meta query              // validate type         if( (empty($_GET['culoare'])) && (empty($_GET['marime']))  )         {             return;         }              // get types as an array         // - use explode to get an array of values from type=a|b|c         $culori = explode('|', $_GET['culoare']);         $marimi = explode('|', $_GET['marime']);              // set compare for the meta_query         // - http://codex.wordpress.org/Class_Reference/WP_Query         $meta_query['relation'] = 'OR';                   foreach( $culori as $culoare )         {             $meta_query[] = array(                 'key'       => 'culoare',                 'value'     => '"' . $culoare . '"',                 'compare'   => 'LIKE',             );         }              foreach( $marimi as $marime )         {             $meta_query[] = array(                 'key'       => 'marime',                 'value'     => '"' . $marime . '"',                 'compare'   => 'LIKE',             );         }              $query->set('meta_query', $meta_query); // update the meta query args              return; // always return     }      in my php arhive file i have this               <?php      $field = get_field_object('culoare');     $values = explode(',', $_GET['culoare']);     ?>
     <form>       <fieldset>         <legend>Cauta dupa culoare:</legend>             <?php if (!empty($field['choices'])) : $i = 0; foreach( $field['choices'] as $choice_value => $choice_label ): ?>             <?php $culoareIndex = strtolower($choice_value); $i ++; ?>             <input type="checkbox" name="culoare[]" value="<?=$choice_value?>" id="checkbox-1-<?=$i?>" class="regular-checkbox-<?=$culoareIndex?>"             <?php if( in_array($choice_value, $values) ): ?> checked="checked" <?php endif; ?> />             <label for="checkbox-1-<?=$i?>">             <?php endforeach; endif; ?>              </fieldset>     </form>              The select that my hosting provider say:               15561572 cinemago_       localhost cinemago_c      1157  Query SELECT post_id, meta_key, meta_value FROM co_postmeta WHERE post_id IN (32,101) ORDER BY meta_id ASC          15561580 cinemago_       localhost cinemago_c      1156  Query SELECT post_id, meta_key, meta_value FROM co_postmeta WHERE post_id IN (32,101) ORDER BY meta_id ASC          15561603 cinemago_       localhost cinemago_c      1155  Query SELECT post_id, meta_key, meta_value FROM co_postmeta WHERE post_id IN (32,101) ORDER BY meta_id ASC


title: Custom post type with hierarchical taxonomy url structure

text: Who can help me to reach second permalink structure of my wordpess website:   * http://www.somesite.com/custom-post-type/some-tax/some-sub-tax/some-sub-tax/post-name/   * http://www.somesite.com/custom-post-type/some-tax/some-sub-tax/some-sub-tax/   * http://www.somesite.com/custom-post-type/some-tax/some-sub-tax/   * http://www.somesite.com/custom-post-type/some-tax/   * http://www.somesite.com/custom-post-type/


title: Excessive memory used by update_option()

text: I'm a newer WP developer trying to wrap his head around how to store information in the options table to support a plugin that I am writing. Unfortunately, trying to UPDATE the options table is making my site crash due to exceeding memory limits. The function below is from my class which needs the ability to update the values of the options. I wrote this so that I could overwrite the value of any single key/value pair in the options array.               private function my_update_option($str_key, $str_value) {         $arr_options = get_option( 'my_options' );         $arr_options[$str_key] = $str_value;        update_option( 'my_options', $arr_options );     }      WITHOUT the update_option() function call, one of my memory plugins says that I am using 64.01 of 128M of the allowed PHP memory limits on the server. However, as soon as I use the update_option() function, the site crashes with the following error.               PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 17652686 bytes) in [.......]      I know that I _must_ be doing something horribly wrong here, but based on everything that I have read before I feel like this should work. Why on earth does this function call suddenly add over 100M of required memory usage? I'm not interested in "just raise your memory limit" to solve the problem - I want to know WHY this is crashing so that I can actually write it better and prevent it from using so much memory. Thanks!


title: Thumbnails are not cropped even after selecting "Crop thumbnail to exact dimensions"

text: I am moving Wordpress site from one domain to another. In the old domain the WP version was 3.5.2 while in the new domain WP version is 3.8.1. There is a page named "2002" which just contains an image gallery. The text code is something like this:               [gallery columns="6" ids="318,319,320,321,322"]      In the old website it looks like this: ![Thumbnail grid view in the old website](http://i.stack.imgur.com/e9EJY.png) while in the new website it looks like this: ![Thumbnail grid view in the new website](http://i.stack.imgur.com/cAUG8.png) I have set Thumbnail size width and height to 150 and checked _Crop thumbnail to exact dimensions (normally thumbnails are proportional)_ in Settings -> Media Settings. I have also regenerated thumbnails via it's plugin after it. But still it shows the same. Am I missing something in the new website? * * * ### Update: Let's don't consider that I have moved the site. What I did is: I created a new page. Added an image gallery. Set the maximum width and height. Regenerated images. But it doesn't crop images as you can see in the second image. FYI: I have installed Jetpack app (if it may cause this issue)


title: Filter for changing MediaElement.js Settings

text: I am trying to change some of the settings that get loaded with MediaElement.js. I can't seem to find a filter or hook to alter the settings that are loaded. The only way I was able to customize the settings is by opening up the core MediaElement.js file and changing the settings there. Obviously this is less than ideal, because I'm forced to edit a core WordPress file which will be overridden on update. How can I change the settings using a filter so my settings aren't lost? I am trying to set               enableKeyboard: false


title: How is WordPress manipulating the posts like there are folders?

text: As you know, a WordPress post can usually be seen going to a link similar to this:               myblog.com/2014/03/27/sample-post/      There is no folder named `2014`, `03`, `27` or `sample-post` in the blog. Until now, I used something like this: `page.php?post_id=55`. How is WordPress and other sites (I think StackExchange sites do this too) doing this?


title: Allow roles below admin to add subscribers only

text: I want to give a group of user types (Editor + a custom role) the add_users /create_users capability. The only catch is that I wanted to limit that capability to adding 'subscriber' type users only, and nothing above that. Is there a way to do this?


title: Multiple Unique Author Profiles

text: I'd like to create multiple user profiles are unique, without just using a "if/then/else" php statement on the author.php template? All I need is the ability to create two different types of profiles.


title: Can I use multiple nav_walkers?

text: I am working on a project and I came to the conclusion that I need to use 3 nav walkers:   * one for edit and    * 2 for HTML formatting `class MY_Walker_Nav_Menu_Edit extends Walker_Nav_Menu {} // this extends the menu item edit and adds some custom fields` next is `class MY_Walker_Nav_Menu extends Walker_Nav_Menu {} // this extends the HTML formatting in the front-end for main navigation and using the custom fields values` last one is `class MY_Walker_Nav_Menu_Footer extends Walker_Nav_Menu {} // same as the above just used for another menu in the footer` Currently all walkers in one file and it does not work. I appreciate any suggestion.


title: Changing widget options via the functions.php when there are no hooks

text: **The problem** : to change a widget's options with a custom function in functions.php, when there are no useful hooks, and where there are multiple occurrences of the same widget (multiwidget). This would involve:   1. Retrieving the options from "widget_some-widget" in the "wp_options" table. (The returned option containing a string of settings (in serialized form) repeated several times corresponding to several unique occurrences of the same widget.)   2. Changing the value of say the third occurrence of an option instance called `some_name`, from "old-value" to "new-value", and another called `some_other_name`, from "some-old-value" to "some-new-value". (It may be that each occurrence of the widget has its own id within the serialized options string that could be recognised somehow?)   3. Updating the database with the altered options i.e. something along these lines -               function change_widget_configuration() {              $options = get_option('widget_some-widget');          // [code to parse $options string to ensure the correct occurrences of 'some_name' and 'some_other_name' have their values changed]          /* third-occurrence of */    $options['some_name'] = 'new value';     /* third-occurrence of */    $options['some_other_name'] = 'new value';              update_option('widget_some-widget', $options);          }      The widget's serialized options string might look something like this (minus the ellipsis) - `i:3;a:20:{s:5:"title";s:8:"My Title";s:9:"some_name";s:11:"Bit of text";s:15:"some_other_name";s:2:"17";` [...] `s:14:"more_from_this";s:29:"More articles on this subject";}s:12:"_multiwidget";i:1;}` What kind of approach can be taken (with the commented-out code above) to solve this problem? * *This would be very useful for controlling the output of third-party widgets (that do not have any useful hooks) without needing to alter their code, or repeating large chunks of it in the functions.php


title: Help display image in single post using javascript zoom image..?

text: Can someone helping me implement single post image with Javascript features with image zoom such i found here : http://www.housetohome.co.uk/galleries/bedroom/adult/Relaxed_country_bedroom_31391.html Thanks max


title: How do I target the child theme with get_bloginfo();?

text: In the code below (which is located in my `functions.php` file), in reference to `('.get_bloginfo('template_url').'`, I'm trying to target my child theme but it keeps coming up as the parent theme.               /* ==  Custom Login Logo ==============================*/     function custom_login_logo() {         echo '<style>             .login h1 a { background:url('.get_bloginfo('template_url').'/images/logo-white.png) 0 0;background-size:218px 32px;height:32px;margin-bottom:10px;margin-left:20px;padding:0;width:218px }         </style>';     }     add_action('login_head', 'custom_login_logo');      How can I make it so it targets the child theme's theme folder?


title: How to add/save Custom Field in user settings/profile "Checkbox list"

text: i have been working on a custom system for my site where users can have a seperate account, setting and profile page to make my site a bit more interactive and community type. with some other additional stuff. I am new to coding, i have managed to make the profile pages etc. Right now i am stuck in adding a check box list of tags to user settings page. where a user can select multiple tags as interest.. so i can use those to show him recommended posts randomly on his account page . i was able to add two extra fields (Twitter/facebook) in the settings page with this code :               function add_bkmrks_contactmethod( $bcontactmethods ) {     $bcontactmethods['Twitter'] = 'Twitter';     $bcontactmethods['Facebook'] = 'Facebook';     return $bcontactmethods;     }     add_filter('user_contactmethods','add_bkmrks_contactmethod',10,1);      and tehse can be easily called on pages as well by using `$userinfo->Twitter` etc. but i have no clue about the checkboxlist... and calling the array etc. If you guys came across any article or chunk of code which can help me get this resolved i wil be thankful :) cheers Ayaz


title: Code Friendly Block Quotes

text: I have a self-hosted Wordpress Blog (located at http://www.dougmolineux.com/wp if you're interesed :) I put a lot of Code Snippets on there, because I'm a programmer. How do I make these "snippets" code friendly? Right now, I am using a simple Blockquote around each one and it converts all single and double apostrophes into strange symbols that will not work when the code is actually copied and pasted. I am willing to convert to a new theme, or alter an existing one. Thanks!


title: Passing values between enclosing and enclosed shortcodes

text: Is there a way to pass data between the enclosing and enclosed shortcodes? For example, I would like to do something like:               [boxes per_row=4]         [box]foo[/box]         [box]bar[/box]         [box]baz[/box]         [box]quux[/box]     [/boxes]      And be able to have the different boxes styled differently (eg class='first', class='last', etc). Additionally, I'd like to be able to create a new row when the current row is full. Basically, I want the parent to be able to get called back in some way when the child is called.


title: 6 Recent post on front page with either featured image or content image

text:
In my frontpage.php i want 6 recent blogs with either featured image or the first content image, and if these are not available then i don't want to show that particular post. But i am not getting the first content image. I also want to skip the gallery post but not working properly. ![enter image description here](http://i.stack.imgur.com/1VySO.png)

          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>               <?php             static $count = 0;             if ($count == "6") {                 break;             } else {                 ?>                                            <?php                 if (!has_post_thumbnail()) {                     continue;                 } else {                     if (strpos($post->post_content, '[gallery') !== false) {                         continue;                     } else {                         ?>

                                                              <?php if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>                                             <a href="<?php the_permalink(); ?>">                                                 <?php the_post_thumbnail(); ?>                                                                                <?php                                         }                                         ?>                                                                                <?php                                             /* Get the Name of First Category Fetching all the categories for the post and displaying first pocket */                                             the_category(', ');                                             ?>

<?php echo get_the_time('d') ?>

<?php echo get_the_time('M') ?>

<?php echo get_the_time('Y') ?>

by <?php the_author_posts_link(); ?>

<?php comments_popup_link('No Comments.', '1 Comment.', '% Comments.'); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

                                 <?php the_excerpt(); ?>                                 <a class="read-more" href="<?php the_permalink() ?>"><?php echo READ_MORE; ?>

                                              <?php }                 }                 ?>                 <?php $count++;             }             ?>         <?php         endwhile;     else:         ?>

         <?php echo SORRY_NO_POST_MATCHED_YOUR_CRITERIA; ?>

     <?php endif; ?>


title: Wordpress as heavily personalized content management portal, and somewhat like dropbox

text: My background is not that of a Web-developer (either UI or backend), though I've dabbled a bit in PHP. So please help me improve this question if required. I am trying to evaluate if Wordpress (with a selection of certain plugins), may be a good choice as a heavily personalized content management portal, bordering in some "Dropbox-like" (the cloud storage service) functionalities. The web-portal I am looking for, would allow authorized subscribers to upload their files, while also allowing the administrator to upload, remove, archive such files from the subscriber accounts. The subscribers can access only content in their account, unless they are invited by another subscriber. I expect to have thousands, or even tens of thousands of such subscribers. **Edit _(July 21, 2013)_** To add to the requirements, which weren't very clear initially, I need Wordpress for other things as well, though, I could always limit use of Wordpress to only these additional functionalities (that one expects of a typical Wordpress site):   * Selectively publish (some of the) files, and invite comments on -- on social network sites s.a. Facebook, Twitter, Google+ etc.   * Create diary, with a sense of time-line of events, with reference to files -- some of the diary entries could be public/shared-with-friends or be absolutely private   * Host an ecommerce storefront, via which increased storage could be sold by hosting firm, apart from a marketplace for subscribers to put up some of the content/files (example -- rare vintage photographs/videos) on sale, for other subscribers to purchase. Finally, if something like this could be achieved with Wordpress, could someone suggest the plugins that I might look at ? If there are alternatives, then knowing about them would help too. Is there a consolidated source of Wordpress plugins with detailed description, documentation, use-cases and perhaps some FAQ (in the CPAN sense, for those familiar with the Perl world).


title: Custom Post Type rewrite with Custom Taxonomy and Custom Meta!

text: I have a custom post type called 'photos'.   I have a custom taxonomy called 'series'.   Each post will have a custom meta item called '_photo_number'. I want my URLs to go something like this:   Single photo: http://example.com/%series_slug%/%_photo_number%/ All photos in a series: http://example.com/%series_slug%/ I've looked into `add_rewrite_rule` and filtering `post_type_link`, as well as playing with the rewrite options when setting up the post_type and tax. I just can't seem to get my head around the right combination. Any ideas? Thanks in advance.


title: WordPress pagination with custom post type?

text: I have searched all over the web to find some solution, but none of them are working for me, can someone help me with this and explain what is wrong? I've spent 3 hours debugging and didn't find the issue. Here is my code:               global $paged;     global $wp_query;     wp_reset_query();          $per_page = get_option('posts_per_page');     $cat_cars = get_term_by('slug', 'cars', 'category');     $page_links_total = ceil($cat_cars->count / $per_page);     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(         'post_type' => 'cars',         'post_status' => 'publish',         'cat' => $cat_cars->term_id,         'orderby' => 'date',         'order' => 'DESC',         'posts_per_page' => $per_page,         'paged' => $paged     );          $page_links = paginate_links(array(                 'base' => add_query_arg('paged', '%#%'),                 'format' => '',                 'prev_text' => __('«'),                 'next_text' => __('»'),                 'end_size' => 2,                 'mid_size' => 1,                 'type' => 'plain',                 'total' => $page_links_total,                 'current' => $paged             ));          $car_query = new WP_Query($args);      And later i call `have_posts`, `the_post`, etc..   This part works, until I go to the second page of my pagination and get nothing found.


title: Remove Custom Taxonomy Base

text: I am using custom taxonomies with WordPress 3.0.4 I am wondering if anyone knows how to remove the taxonomy base from the URL? I have seen plugins that do it for categories and tags, but not for custom taxonomies. For example, I have a custom taxonomy called 'cities'. I would like my URL structure to be mydomain.com/newyork instead of mydomain.com/cities/newyork Is there a function or something I can use?


title: register_post_type & 'register_meta_box_cb' argument

text: I just tried the first time to extend a custom post type admin-UI-edit-page with some "meta" boxes (if this is the right word).               register_post_type( 'post_type', array(         'register_meta_box_cb' => 'additional_input_field'     ) );          function additional_input_field()     {         global $post;              $custom = get_post_custom( $post->ID );         $length = $custom["post_type-length"][0];              return print '<label>Length:</label><input name="post_type-length" value="'.$length.'" />';     }      So far i haven't seen any documentation or example about how to use this. A look in the core showed me that it should be equal to:               add_action( 'add_meta_boxes'.$post_type, 'additional_input_field', 10, 1 );      The appropriate hook can be found in (core) `~/wp-admin/edit-form- advanced.php` line #163. The call for add_action in (core) `~/wp- includes/post.php` line #877. The only problem is that it doesn't seem to work as expected. The field get's loaded in front (visually: on top) of everything else. If I try to hook it directly to `'add_meta_boxes'.$post_type`, I get nothing. _Simplified examples in this text to show what i mean. Typos may be there but doesn't matter. The callback fn is taken from some sample code overhere._


title: order posts by date like craigslist

text: the image is worth a thousand words. take a look at it.      you know how craigslist has posts organized by date ..ex `Tue 3` post links for tuesday `Wed 4` post links for wed `Thurs 5` post links for thur I know wordpress posts are organized by date by default. take a look at this ![alt text](http://i.stack.imgur.com/6Wm2Q.png) any ideas? btw if this did not make sense let me know. tx


title: Remove/Add widgets from/to the Available Widgets pool

text: Is it possible to remove/add widgets from/to the Available Widgets pool (either by plugin or editing core files)? There are 3 widget files located at: /wp-includes/widgets.php /wp-admin/widgets.php /wp-admin/includes/widgets.php I have tried to change both the code and the widget variables but nothing happened. thanks


title: Multiple information using custom post type

text: I made a new custom type, it's working fine. My question is: If i want to add in a single post that custom-type with different informations for about x times...how should I do this? **Example:**   Let's say I have "Reduced Price Laptops," with:   * Name    * Price   * Image   * Description I want to make a post where I will post 4 laptops and I want to fill 4 different informations. I want them to be posted in the same article, not 4 separately. Each of them will show up styled separately, but with same design. Let's say a little box. Any ideas/sugestions?


title: Adding meta boxes to custom post type

text: The `add_meta_box()` function needs a callback function as an argument to display the meta box on the edit page of a custom type post. My problem is I can not display anything, say in the `input type=text` (for example the values of an already posted post), because I don't have the ID of the post... `get_post_meta` needs the ID of the post to display the values! How can I get the ID of the post?


title: How do I make sure a plugin loads a script after jQuery

text: My client has a site running the latest version of WordPress, with Thesis. Currently, jQuery is being loaded in the footer, as the very last script to be loaded. I'm not sure what is causing jQuery to load - possibly Thesis, or something else. We are adding a plugin, which has a script that loads. The script is being loaded in the footer. But it's being loaded BEFORE jQuery, so it fails. The enqueue scripts line is this:               add_action('wp_enqueue_scripts', array($this, 'stb_enqueue_scripts'));      I edited it to be this:               $deps = array("jquery");     add_action('wp_enqueue_scripts', array($this, 'stb_enqueue_scripts', $deps));      But that didn't solve the problem - in fact, the script no longer loaded at all. How can I make sure this script loads after jQuery? Thank you!!


title: Automating deprecated call checks?

text: I've recently started revamping and re-releasing some abandoned (yet important) WordPress plugins. As I walk through the code patching other bugs, my IDE highlights deprecated function calls for me, which is fantastic! I fix them immediately when I find them and move on. Anything I _don't_ catch is called out by a Log Deprecated Calls plugin or by setting `WP_DEBUG` to true. But both of these approaches are highly ineffective. With one, I need to actually open the PHP file and manually scan through each line of code looking for a deprecated call. With the other, I need to wait for the deprecated call to be invoked by WP before it's flagged by the system. Is there an easier way or some tool I can use that scans through WP plugins and themes and identifies any use of deprecated functionality?


title: Is there a Wordpress plugin (or perhaps a Facebook social plugin) which enables users to like posts, comments, and replies?

text: Basically, it should be a plugin that allows users to like differents elements on the page: posts, comments and replies (bbPress). Any suggestions?


title: How to change my URL on intranet

text: I have a WordPress blog installed on my machine. I got a strange requirement from my team but I don't know how I should implement it: blog pages should be segregated under "blog/" or a similar sub-domain. For example: http://example.com/blog/hello-world rather than http://example.com/hello-world How should I do this? The index page of the website is the WordPress front page.


title: How to display custom taxonomies in posts?

text: Almost all themes display categories (with its permalink) by default. I am looking for similar type of code to add in my theme. From where can I get it? To create custom taxonomies, I'm using More Taxonomies plugin.


title: How to change title attribute returned by comments_popup_link()?

text: I can change label of comments by altering Comment(s) from parameter of following function: `comments_popup_link('No Comments;', '1 Comment;', '% Comments;');` But, seems that title attribute is returned from core modules. Suggest me to alter title attribute without editing core modules.


title: How do I use add_action on custom widget?

text: First hope you will take a look example widget http://pastebin.com/2cL7BmgF There have male and female option. Let say I select male and I want add male.css to `wp_head` When I put something like this into the code it's not working.               add_action('wp_head','load_face');     function load_face() {       wp_enqueue_style('style', WP_PLUGIN_URL . '/sample/'.$sex.'.css', null, null, 'screen');     }      Let me know what is the correct code to archive my goal. :)


title: Limit Number of Sticky Posts to Show

text: I'm using sticky posts as features posts on home page. I'd like to limit the number of sticky posts to show two the latest two. I found this code, but it makes only on latest sticky post to show. I'd appreciate your help.                       <?php                 /* Get all sticky posts */                 $sticky = get_option( 'sticky_posts' );                      /* Sort the stickies with the newest ones at the top */                 rsort( $sticky );                      /* Get the 2 newest stickies (change 2 for a different number) */                 $sticky = array_slice( $sticky, 0, 2 );                      /* Query sticky posts */                 query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) );             ?>


title: How to remove (or meta noindex) at page /?comments_popup=

text: I noticed that my website has many page like this:               http://example.com/?comments_popup=837          http://example.com/?comments_popup={id of the page/post}      They are causing many duplicate/thin content pages. I'd like to remove, or at least place meta noindex to this. Which is the file to edit? I presume is in the core of wordpress.


title: Show custom post type filtered by category

text: I would like to have a custom post type which contain several sliders for showing in each category page (exact category.php), one for each as planned. All sliders were assigned to related category. Currently I am using http://wordpress.org/plugins/custom-post-type-ui/ to create a custom post type called: slider. And I am having the below code for showing all posts from a category while pressing the cat name in menu. It works fine of course.               <?php $cat = get_the_category(); $cat = $cat[0];　?>     <?php query_posts($query_string . '&cat='. $cat->cat_ID .''); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>             <?php the_content(); ?>        <?php endwhile; else: endif; ?>      But the problem is I can't filter the slider (custom post type) by category. Once I call the `wp_query`, it rolls out all the sliders and ignores my get cat id arg. Thought it should show only the slider in certain category, not all category. So I am asking for a query to call the right slider only.


title: filter a loop base on specific category

text: i am going to filter my loop base on the category the problem is that when i am using the following code it display all my post.               // Query args     $custom_cat_args = array(         'posts_per_page' => 15,         'order' => 'DESC',         'orderby' => 'post_date',         'category' => get_cat_ID( 'سیاست' )     );     // Instantiate query     $custom_cat_query = new WP_Query( $custom_cat_args );     // Instantiate loop     if ( $custom_cat_query->have_posts() ) : while ( $custom_cat_query->have_posts() ) : $custom_cat_query->the_post();         // Normal loop markup here     // Close loop     endwhile; endif;     // Restore $post global     wp_reset_postdata();


title: Creating custom theme options page

text:
I am creating a theme for a client and it has a custom front page that has a slider and displays the services they offer. I am looking to add an options page where the client can easily update the slider images, service titles, descriptions and images. I have seen this functionality on other themes and am having trouble trying to implement it. I have followed a few different tutorials and I understand how to add the page to the menu, but am unsure how to get the form to update the information on the front page. Most recently, I followed this tutorial exactly but could not get it to work. When I hit submit, it says "error: options page not found". I saw this in a similar question here, but while the answer solved the error message, it still wasn't updating the information on the front page. Are there any ideas on how to do this? Or any tutorials that would be helpful? I've been looking but most of the tutorials are outdated or deal with the Settings API and not custom fields. The code I'm using is from this tutorial from Webdesigner Depot. **The main problem I have is that the inputted text does not get saved.** In functions.php:               add_action('admin_init', 'theme_options_init');     add_action('admin_menu', 'theme_options_add_page');          function theme_options_init(){         register_setting( 'sample_options', 'sample_theme_options');     }          function theme_options_add_page(){         add_theme_page( __( 'Theme Options', 'sampletheme' ),                        __('Theme Options', 'sampletheme'),                        'edit_theme_options', 'theme_options',                        'theme_options_do_page');     }          function theme_options_do_page() {          global $select_options;          if (!isset($_REQUEST['settings-updated']))             $_REQUEST['settings-updated'] = false;         ?>
             <?php screen_icon(); echo "
". __('Custom Theme Options', 'customtheme')."
";?>             <?php if ( false !== $_REQUEST['settings-updated']) : ?>

<?php_e('Options saved', 'customtheme');?>

             <?php endif;?>             <form method="post" action="">                 <?php settings_fields('sample_options');?>                      <?php $options = get_option( 'sample_theme_options');             ?>

                                                      <?php _e('Display Intro Paragraph', 'customtheme');?>                         	                                                      <input id="sample_theme_options[showintro]" name="sample_theme_options[showintro]" type="checkbox" value="1"         <?php checked( '1', $options['showintro'] ); ?>

                                                      <?php _e( 'Intro Paragraph', 'customtheme' ); ?>                    	                                                      <textarea id="sample_theme_options[introtext]"         class="large-text" cols="50" rows="10" name="sample_theme_options[introtext]">                             <?php echo esc_textarea( $options['introtext'] ); ?></textarea>

                 <input type="submit" value="<?php _e( 'Save Options', 'customtheme' ); ?>" />
             </form>
     <?php }      At the top of header.php:               <?php $options = get_option('sample_theme_options'); ?>      And in home.php:               <?php if ($options['showintro'] == 1) { ?>
                         <?php echo $options['introtext'] ?>

                 <?php } ?>


title: filter custom post type by meta key in dashboard

text: I'm looking for a way to expand e customize more this topic how to filter post listing (in WP dashboard posts listing) using a custom field (search functionnality)? I've a custom post type in the dashboard i've managed to have a small search box with a fixed search function to search a specific meta key. The things is that the search form appears on all the /edit.php pages while i need it only in the specific custom post type edit.php page. I tried with               if (isset($_GET['post_type']) && $_GET['post_type'] == 'product')      but it doesn't seem to work.


title: Preferred way to include Advanced Custom Fields in a plugin?

text: So I am building a plugin for a site that is already using Advanced Custom Fields (ACF). I wonder what would be the best way to include ACF in my plugin? The site is already using ACF, so is it possible to include ACF from the plugin directory or should I include ACF again?


title: Hide custom post type and use its slug in new plugin menu

text: I want to use custom post type in my web app and want to use that url in my plugin menu. I have created custom post type like this.               register_post_type( 'reserve',         array(             'labels' => array(                 'name' => __( 'Reserves' ),                 'singular_name' => __( 'Reserve' ),                 'all_items' => __( 'All Reserves' ),                 'add_new' => __( 'Add Reserve' ),                 'add_new_item' => __( 'Add New Reserve' ),                 'edit' => __( 'Edit'),                 'edit_item' => __( 'Edit Reserve' ),                 'new_item' => __( 'New Reserve'),                 'view' => __( 'View Reserve'),                 'view_item' => __( 'View Reserve'),                 'search_items' => __( 'Search Reserves'),                 'not_found' => __( 'No Reserves found' ),                 'not_found_in_trash' => __( 'No Reserves found in trash' ),                 'parent' => __( 'Parent Reserve')             ),                    'description' => __( 'This is where you can add new Reserves' ),         'public' => true,         'show_ui' => false,         'capability_type' => 'page',         'publicly_queryable' => true,         'exclude_from_search' => false,         'hierarchical' => true,         'rewrite' => array( 'slug' => 'reserves', 'with_front' => false ),         'query_var' => true,         'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'excerpt',/*, 'page-attributes'*/ ),         'has_archive' => true,         'show_in_nav_menus' => true         )     );      Notice that I have set show_ui as false so that my new custom type wont be displayed on admin sidebar. Now I am creating a my plugin menu as following.               $topslug = 'reserve/admin';      add_menu_page('Reserve Overview', 'Reservation', 'view_reservation_plugin', $topslug, 'show_start_page',RESERVE_URL.'images/menu_icon.png');     add_submenu_page($topslug, 'RESERVE', 'Reserve Builder', 'view_reservation_plugin', 'reserve/manage_reserve', 'show_manage_reserves');      From above code you can find that I have created a menu as Reservation having two submenus 1) Reserve Overview 2) Reserve Builder. Now my issue is I want to change my URL of Reserve Builder. Currently its 'admin.php?page=reserve/manage_reserves'. I want to change it like 'edit.php?post_type=reserve' so that i can use wordpress inbuilt facility. Say if I am passing 'edit.php?post_type=reserve' in add_submenu_page('edit.php?post_type=reserve', 'RESERVE', 'Reserve Builder', 'view_reservation_plugin', 'reserve/manage_reserve', 'show_manage_reserves').Menu gets disappeared. TIA.


title: Custom taxonomy only shows 0 in autocomplete for terms and "Choose from the most used tags"

text: I have a custom post type (`rezept` that I added a custom taxonomy `Allergiefrei` to. I got this working so far. Adding terms to the custom taxonomy's box works, too, but autocomplete and 'Choose from the most used tags' only shows "0". Here's the code where I register the custom taxonomy:               function register_rezept_taxonomies() {       register_taxonomy(         'Allergiefrei',         'rezept',         array(           'label' => 'Allergien',           'rewrite' => array('slug' => 'allergien')         )       );     }          add_action('init', 'register_rezept_taxonomies');      I'm defining custom taxonomies and the post type in a plugin.


title: Mail function is not working

text: My mail function is not working. When I submit form it says mail sent. But not receiving. I tried echo if the mail sent. It is also working. What is the issue here? Anything with mail function ?               <?php     $name    = $_POST[ 'cuf_sender' . $n ];     $email   = $_POST[ 'cuf_email' . $n ];     $subject = $this->o['subpre'] . ' ' . $_POST[ 'cuf_subject' . $n ];     $msg     = $_POST[ 'cuf_msg' . $n ];          $extra = '';     foreach ( $_POST as $k => $f ) {         if ( strpos( $k, 'cuf_field_' ) !== false ) {             $extra .= $this->o[ substr( $k, 4, 7 ) ] . ": $f\r\n";         }     }          $headers =         "MIME-Version: 1.0\r\n" .         "Reply-To: \"$name\" <$email>\r\n" .         "Content-Type: text/plain; charset=\"" . get_settings( 'blog_charset' ) . "\"\r\n";     if ( ! empty( $from ) ) {         $headers .= "From: " . get_bloginfo( 'name' ) . " - $name <$from>\r\n";     } else if ( ! empty( $email ) ) {         $headers .= "From: " . get_bloginfo( 'name' ) . " - $name <$email>\r\n";     }          $fullmsg =         "Name: $name\r\n" .         "Email: $email\r\n" .         $extra . "\r\n" .         'Subject: ' . $_POST[ 'cuf_subject' . $n ] . "\r\n\r\n" .         wordwrap( $msg, 76, "\r\n" ) . "\r\n\r\n" .         'Referer: ' . $_SERVER['HTTP_REFERER'] . "\r\n" .         'Browser: ' . $_SERVER['HTTP_USER_AGENT'] . "\r\n";          if ( wp_mail( $to, $subject, $fullmsg, $headers, $email ) ) {         echo $to;         exit();