title: How to get current_cat in navbar, in single post

text: In a site I have using Wordpress 3.0, when I'm in a single post, the navbar showing the categories doesn't give the parent category the class of "current_cat" and therefore that category is not highlighted. How can I make Wordpress give the parent category that class in single_post mode?


title: Post meta vs separate database tables

text: When developing plugins that requires data storage, what's the pros and cons of using one method or another ? The explanation given in the codex is not detailed: > Before jumping in with a whole new table, however, consider if storing your > plugin's data in WordPress' Post Meta (a.k.a. Custom Fields) would work. > Post Meta is the preferred method; use it when possible/practical.


title: What to do when theme and WordPress coding standards conflict?

text: I am considering different starter themes such as _s and roots. Roots looks very good, especially its sass fork. Anyway, there's one thing that concerns me. It seems like Roots doesn't follow the WordPress coding standards of themes and plugins. What standard do I then follow if I want to use Roots as a starter theme?


title: Displaying custom post type on category pages but not on blog listings

text: I think this is a fairly simple issue but I haven't got my head around it. **Question: how do I get my custom posts to show only on the category archives, but not in the blog post listing page?** Background: I have a custom post type "video", with has_archive true and 'taxonomies' => array('category', 'post_tag') - I want to use standard categories with this custom post type. I have successfully got my category pages to display by setting post_type and using the hook pre_get_posts as follows:               function my_query_post_type($query) {         if ( is_home() && false == $query->query_vars['suppress_filters'] )             $query->set( 'post_type', array( 'post', 'video', 'attachment' ) );         return $query;     }     add_filter('pre_get_posts', 'my_query_post_type');      If I don't use pre_get_posts, then my videos don't show - as expected. However, now my blog post listing page shows the custom posts - as expected because I've changed the post_type in query. **Question: how do I get my custom posts to show only on the category archives, but not in the blog post listing page?**


title: Why is WP-Query spelled like it is?

text: I'm new to PHP and WordPress, and I'm curious: Why is WP-Query capitalized like it is? Is this a PHP naming convention, based on the type of query? Or what? Thanks.


title: Taxonomy menu with post count and multiple parents

text:
I'm using WordPress 3.1.3 and trying to make a "product" menu with post count in each category. Like this:   * New Cars (4)      * BMW (2)     * Ford (1)     * Nissan (1)   * Used Cars (10)      * BMW (3)     * Ford (1)     * Nissan (6) For this, I've created custom post type `Cars` and taxonomies `Type` and `Brand`. Not sure if it the best way to do this, but here's my code:               <?php $auto_types = get_terms('type', 'hide_empty=1'); ?>
     <?php foreach( $auto_types as $auto_type ) : ?>
         <a href="<?php echo get_term_link( $auto_type->slug, 'type' ); ?>">           <?php echo $auto_type->name; ?> (<?php echo $auto_type->count; ?>)                              <?php                     $terms = get_terms('brand');                     $count = count($terms);                     if($count > 0) :                         ?>
                             <?php foreach ($terms as $term) : ?>
                                 <a href="/?type=<?php echo $auto_type->slug ?>&brand=<?php echo $term->slug ?>">                                         - - <?php echo $term->name; ?> (<?php echo $term->count; ?>)
                             <?php endforeach ?>
                         <?php endif ?>
                <?php endforeach ?>
      So my questions are:   * is this is a good way to do it?   * how do I filter post counts? **Edit** - I've managed to solve my second problem, but i'm still not sure if it's a good way to do it. Here's new code:               <?php $auto_types = get_terms('type', 'hide_empty=1'); ?>
         <?php foreach( $auto_types as $auto_type ) : ?>
             <a href="<?php echo get_term_link( $auto_type->slug, 'type' ); ?>">                  <?php echo $auto_type->name; ?>                          <?php $auto_brands = get_terms('brand', 'parent=0' ); ?>
                     <?php foreach ($auto_brands as $auto_brand) : ?>                         <?php $brand_filter['tax_query'] = array(                                 'relation' => 'AND',                                 array(                                     'taxonomy' => 'type',                                     'terms' => array($auto_type->slug),                                     'field' => 'slug',                                 ),                                 array(                                     'taxonomy' => 'brand',                                     'terms' => array($auto_brand->slug),                                     'field' => 'slug',                                 ),                             );                         $tax_query = new WP_Query($brand_filter);                             $count = 0;                         if ( $tax_query->have_posts() ) : while ( $tax_query->have_posts() ) : $tax_query->the_post();                             $count++;                         endwhile; endif; wp_reset_postdata();                             if ( $count > 0 ) : ?>
                                     <a href="/?type=<?php echo $auto_type->slug ?>&brand=<?php echo $auto_brand->slug ?>">                                         - - <?php echo $auto_brand->name; ?> (<?php echo $count; ?>)
                     <?php endif; endforeach ?>

                    <?php endforeach ?>
      **Edit 2** - Changed `query_posts()` method to `wp_query()` (thanks to VicePrez), but is it efficient to use query to only get correct post count or there's a better way to make this menu?


title: Function to get image from media library

text: Is it possible to retreive media image directly into the library... Something like get_media ('all') and it return a array with image url, caption, description etc etc..


title: auto create blog posts depending on list

text: I looked for a plugin, but couldn't find anything that suited me. What I would like to see is: Say I have a list of zipcodes. I want a blog post for EACH zipcode that contains text (same for ALL the posts), except of course for that zipcode, which will be unique in each post, in body of post, and title. is this possible? (If not.. it would be a big pain to create thousands of blog posts with all the same content (basically)...) Thanks


title: I made a custom page but Wordpress seems to strip any HTML I put in this page

text: How can I avoid wordpress stripping HTML content from a custom PAGE?


title: Hide a nav menu item based on get_user_meta results

text: I'm trying to hide a navigation menu item under certain circumstances. Specifically, if a user is logged in AND has already registered their product bar code, I want to hide the 'Register Kit' link (which has a class of 'ac- regkit'). Below is the PHP I've added to the head section of header.php, just before wp_head();.               /* If User is loggied in, hide LOG IN and SIGN UP links */     <?php if ( is_user_logged_in() ) { ?>         <style>             .ac-login { display: none; }             .ac-signup { display: none; }         </style>              /*If user has not yet registered their DNA Test Kit, show link */         <?php             $current_user = wp_get_current_user();             $user_id = $current_user;             $key = 'redeem_code';             $single = true;             $ac-barcode = wp_get_user_meta( $user_id, $key, $single);             if ( $ac-barcode = '' ) { ?>             <style>                 .ac-regkit { display: inline; font-weight: bold; }                 .ac-regkit a { color: red; }             </style>         <?php }; ?>     <?php } ?>      And this is the error I'm getting: > **Server Error** The website encountered an error while retrieving > http://athleticode.com/. It may be down for maintenance or configured > incorrectly. I'm not an expert in PHP, so I'm sure it's a syntax error or something like that -- and there is probably a better way to achieve this result -- so any help would be greatly appreciated.


title: Links in the_content not linked

text: I have alot of old posts that are being pulled with the_content() context. In the_content() there is links in the text, however none of them are hyperlinked it just shows like http://twitter.com/twitterrocks with it not linked. Is there a way to link all links in my the_content() and make them target="_blank" ? Thanks in advance!


title: How do you display posts in a dynamic table?

text: I'm currently using a plug-in called SortTable Post. It automatically takes your posts and puts them into a table that you like. It's a great idea, but the issue is that the plug-in hasn't been updated since 2011, and there are too many problems with it. Here is an example of SortTable Post >> http://chicagoexecutivecoaching.com/smartleadership/smart-leadership-archives/ I've been looking for an alternative. The maker of the TablePress plug-in answered someone asking the same question with: > Instead, you should look into implementing a Page Template with a custom > "The Loop", in which you use WordPress Template Tags to print the output as > a HTML table. You can then add the sorting/search/pagination features to > that table as well, by manually loading the DataTables JavaScript library > (www.datatables.net) into the page. That is a bit beyond my abilities at the moment. How EXACTLY would you do this? I'd need a step-by-step guide to do this. Help is greatly appreciated :)


title: Add forward slash on categories url (serve one version of a url)

text: How can I a add forward slash on categories URLs and serve only that version of a category (meaning URLs not ending in forward-slash will redirect to URLs ending in forward slash). I manage to remove the category base using the "WP No Category Base" plugin but I need to add a forward slash on the category URL. Examples:               www.example.com/es  <- this is a category (needs a forward-slash '/')          www.example.com/es/hola.html <- this is a post so, it's ok, no changes needed.      The plugin Permalink Trailing Slash Fixer doesn't solve the problem here.


title: Limit ONE link per post

text: I've been browsing around Google for quite some time now, but I have yet to find a close answer. Anyway, is there a way to limit a user to just one link (preferably outbound) per post?


title: Hide a div when a custom field is empty

text:
I am having trouble hiding a div when the input of a custom field is empty. This is the code I am using but can not seem to get it to work. The field that displays the content is _cmb_fe_wysiwyg                <?php             if( empty( $post->post_content) ) {                //empty                }             else {                   echo '
';                         echo '
Ingredients
';                       echo wpautop( get_post_meta( get_the_ID(), $prefix . '_cmb_fe_wysiwyg', true ) );                        echo '
';                }       ?>


title: Modify hard-coded conditionals for roles to custom roles

text: Hopefully this makes sense. I'm still learning. There is a function in a plugin I'm developing that I want to modify to recognize custom roles. My function works when it is hard-coded to accept administrator, editor, author, contributor, and subscriber. However, I'm stuck on modifying the conditional to accept all editable roles. Here is the working code (but hard-coded):                   if ( $current_user->data->wp_capabilities['administrator'] ) {             $role = 'administrator';         } elseif ( $current_user->data->wp_capabilities['editor'] ) {             $role = 'editor';         } elseif ( $current_user->data->wp_capabilities['author'] ) {             $role = 'author';         } elseif ( $current_user->data->wp_capabilities['contributor'] ) {             $role = 'contributor';         } elseif ( $current_user->data->wp_capabilities['subscriber'] ) {             $role = 'subscriber';         }              if ( isset( $role ) ) {             /* If they are an admin then we grant them all permissions that they ask for */             if ( $current_user->data->wp_capabilities['administrator'] ) {                 foreach ( $new_caps as $new_cap ) {                     $capabilities[ $new_cap ] = true;                 }                 $user->add_role( $role );             } /* Otherwise lets check if their role deserves that capability    */             else {                 foreach ( $new_caps as $new_cap ) {                     if ( $wp_roles->get_role( $role )->has_cap( $new_cap ) ) {                         $capabilities[ $new_cap ] = true;                         $user->add_role( $role );                     }                 }             }         }      Instead of if ... administrator then assign role .... it should be a variable. I'm guessing but somehow editable roles should be available (?) such as the following.                   $all_roles = $wp_roles->roles;              $editable_roles = apply_filters('editable_roles', $all_roles);      Can someone help me out and suggest how to rewrite the conditional so it is not hard-coded? Thank you.


title: Which hook to use to add notification message at beginning of my <body>

text: i want to add dynamic messages to the beginning of my but I can't figure what hook to use. I have tried get_header but i can't append content to it... any idea? I don't want a solution that requires javasript as i want it to work without javascript.


title: Search in Two Categories

text: I want to search in two categories without using the search box at all. So far, I have this code to display the desired categories,               <?php wp_dropdown_categories('child_of=3&hierarchical=1&depth=1&hide_empty=0&name=cat[one]'); ?>     <?php wp_dropdown_categories('exclude=3&hierarchical=1&depth=1&hide_empty=0&name=cat[two]'); ?>      I have names as array cat as I wanted them to GET from URL and build custom query. I have tried many things but failed. I just want the user to just press search and it should display posts that are in "Both" categories. Please help. Thanks.


title: Link directly to media file through 'add link'

text: I'm trying to achieve exactly what the title says. I'm building a site for a client, and am trying to make the site as user friendly as possible. They aren't very IT literate, and already are experiencing problems with what is something that is simple. I know it's possible to use 'add media' and then change the text within the media gallery modal, but I think it's worth asking the question. I use a plugin called WP Document Revisions on another site, which sets up what looks like a document repo/custom post type called 'Documents'. You upload a file with a 'document', and then when you highlight your text, click 'add link' in a post or page, you can select the CPT directly from the editor interface under 'Or link to existing content' - the URL returned is that of the actual media file itself (PDF, .doc etc) This works perfectly and allows users to hyperlink whatever text they want, to files really easily but the plugin has a bug whereby I think if you have other CPTs, it doesn't display the 'Documents' option in wp-admin which is super frustrating. A lot of other people have this issue and there's not much going on in the support forums in terms of responses from the devs. As this plugin does what I need, but a whole load of other stuff too, I was just wondering if it's possible to replicate the small feature I need, perhaps through the use of a CPT that returns the URL of the attached file, rather than of the page. Any insight on how this might be achieve would be greatly appreciated.


title: After I set the title, it over-wrote all the titles for the individual pages

text: A few days ago I set the title tag for my home page by doing this: Settings => General but it turned out that this didn't just change the title of the home page. It actually changed the title of every page on the site to that one title. What is the way for me to correctly set the title for the home page, and not over-write the titles for all the individual pages? EDIT: To explain things further. I set the title tag to be this:               <title>0xdata - Open source software engineering developer community and events</title>      But now the individual pages have titles like this: Title - Open source software engineering developer community and events » Open source software engineering developer community and events Thank you!


title: Hiding Google Analytics code based on theme options

text: I'm doing up a WordPress theme at the moment, and I want users to be able to add Google Analytics to their site by just adding their tracking code -- you know, the `UA-20149670-1` -type number thing. At the moment I have all the Google Analytics JavaScript code sitting in the `<head>` of my pages, with the tracking code being set by the user via a theme option text input form. However, if the user _doesn't_ add a tracking code, then all the Google JavaScript is still left sitting in the `<head>`, without a tracking code, bloating up the header. How can I code this so that the Google Analytics code only appears after the user puts in their tracking code? Additionally, at the moment the Google Analytics code is all still in `header.php` -- ideally I'd like to move it instead to `functions.php`. How best would I do that? Thanks.


title: How can I replace an oEmbed URL in post with actual embed HTML

text: What I want is to get the output of the Twitter oEmbed system into my actual posts. IMHO the embed output itself is high-quality, semantic HTML and I'd rather have it inside the post than in the embed metadata in case their js stops working (in which case the tweet would display as a sensible blockquote). So what I need is to hijack the oEmbed system and, upon processing it, replace the embed URL in the post with the HTML from Twitter. Clearly the solution should also be able to handle other kinds of embeds. UPDATE: Just to be clear, I know how oEmbed works by default (i.e. the URL will be replaced with the oEmbed HTML when the 'the_content' filter is run on the post content) and that is not what I want. What I need is a way to hijack that system and, instead of only having the content replaced at display time, have the embed URL itself replaced inside the post_content in the the database with the HTML returned from the oEmbed provider.


title: Pagination for event query

text:
I'm working on a WP_Query using the Modern Tribe Events Calendar My problem is with pagination. Is this the incorrect way to paginate the WP_Query or could there be another method for paginating the Events Calendar? I found a tutorial that uses the WPNavi plugin but I would like use core wordpress functions.               <?php      $upcoming = new WP_Query();     $upcoming->query( array(         'post_type'=> 'tribe_events',         'eventDisplay' => 'upcoming',         'posts_per_page' => 1)     );          if ($upcoming->have_posts()) : while ($upcoming->have_posts()) : $upcoming->the_post(); ?>                  <?php tribe_get_template_part( 'list/single', 'event' ) ?>          <?php endwhile;          else :          echo 'no upcoming events';      endif;          wp_reset_query();      ?>

<?php posts_nav_link(); ?>


title: Automatic Wordpress Backup Plugin works, but says it's not

text: I just installed Automatic Wordpress Backup on a fresh install of wordpress, with no other plugins installed, nothing else has changed from the default install. The plugin is saying zip is not found, I verified with my host that it is, and updated the path for it in automatic-wordpress-backup.php. I also have debug turned on, and am about to have to turn it off due to the number of warnings and notices displayed. It appears to be mostly Notices about deprecated arguments and Warning: Cannot modify header information. It also causes me to just get a blank page after updating info, for example I just changed the permalinks, after I hit save it takes me to a blank page, it made & saved the changes, but I can't tell my client that it's just going to work that way. Is this normal? Any suggestions?


title: the_post_thumbnail('medium') still gives thumbnail-size img

text: All the sources mention this as if it worked. Medium size is set to 635x194, but I still get this out:               <img width="100" height="100" title="fjaril" alt="fjaril" class="attachment-thumbnail" src="http://blogg.nassjo.se/klassblogg/files/2012/12/fjaril-100x100.jpg">      As you see, it hard-links to the shrunken thumbnail size. Docs say I should get a class matching the size argument in the img HTML also. Where should I look, and what to fix? I'm just trying to get the first post on the front page to display its featured image medium-sized. I'm modifying content.php in the theme. I can search-and-replace, but that would break if the customer changes thumbnail sizes. The website is here: http://blogg.nassjo.se/ **Update:** Just made a **child theme** , and there, it works as it should. See http://blogg.nassjo.se/klassblogg/ **Update 2** I made a child theme for the main site also, but that did (unexpectedly) _not_ make it work. I have to conclude that the_post_thumbnail('medium') only works on the site where it was posted. I've put the img html in a var and search/replaced to get the medium size and url, and that hack works. I'll leave the question up for a bit, in case someone can help me find the real reason so I can remove the hack.


title: WP-types not showing per product

text: I need some assistance I have had a website written by someone, who has took my money and not finished the project. I need to get this finished ASAP and looking for some assistance with what they have done. They have created an online ordering system for a takeaway, and used wp-types plugin to setup ingredients per product. However, what they haven't then done is setup the custom types showing in the basket or in the transaction confirmation email and on the admin orders screen it only shows 1 set of custom meta for the entire order. Anyone able to help with using this plugin. Thanks in advance Simon


title: Backup Buddy Questions

text: I have two hosting accounts.   1. Account #1) My personal hosting account   2. Account #2) My reseller hosting account I am hosting a friend/client on my personal account as an `Add On` domain. I just purchased a reseller account and want to move this friend to their own cpanel as an account on my reseller. I've created the new account for them, using the domain name from the WordPress they are hosting on my personal hosting account... I've just purchased BackUp Buddy but have limited faith in the software. I have just created a BackUp Buddy of the site I am trying to save. If I don't remove the `Add On` domain from my personal hosting account the site won't propagate on the new account because it'll link back somehow. I know this because I tried this with an empty site I had. The problem is, when I **remove** an `Add On` domain it deletes ALL the folders. So I would lose the entire site. Here is my thoughts on the process I need to do.   1. Create BackUp Buddy Backup file [done]   2. Download importbuddy.php file [done]   3. FTP Copy the entire Folder structure of the WordPress install as extra measure [done]   4. Remove `Add On` domain [ _scared, not done yet_ ]   5. Change Namerservers to point to new account on my reseller [to do]   6. Run Importbuddy.php [to do]   7. Delete MySQL DB & DBUser on personal account [to do] Then... if there is a problem... I **BELIEVE** I can:   1. Change Nameservers back.   2. Upload copy of files structure. And the site is back... Am I correct? I'm very concerned that something irreversible is going to happen to this site.


title: Why do folders have Empty Index.php Pages?

text: 1. /wp-content/   2. /plugins/   3. /themes/ All have empty index.php files in it. Are they safe to delete? What is their purpose, why even be in the default install if they're empty? What is their purpose?


title: Show custom messages on dashboard menu page

text: How can add custom helper message on dashboard menu page. Say i want to add some message in "Users" menu page. Thanks in advance to all experts bro...


title: Hosting plugin with excanvas (dependency of flot, jqPlot and more) in official repository?

text: Considering using flot for graphs in plugin and a little lost with dependencies and licensing here.   1. WordPress repository demands GPLv2-compatible.   2. flot is under MIT license, which is GPL-compatible.   3. flot uses excanvas (for IE compatibility) under Apache License 2.0 which is compatible to GPLv3, but not v2. So is or is not flot compatible to repository? Aside - I had started wiki-style question if you want to suggest and discuss alternative libraries Graphing libraries for WordPress


title: Manually Removing Plugins

text: Are there any special procedures needed to remove a plugin manually? I have some plugins I need to remove but can't access the `/wp-admin` area till they are removed.


title: Need some help with "the_widget()" function

text: I am trying to create code to display certain default WordPress widgets on my e-commerce site. I have 6 content boxes which display WordPress widgets: • Pages • Latest Posts • Archive (last 12 months) • Blog Post Categories • Blog Calendar • Blog Tag Cloud I was originally using other functions to do this: wp_get_archives, wp_list_categories, etc. and the code I was using worked just fine.. However when I was looking for a way to also include the Blog Calendar and the Tag Cloud widgets, I stumbled across the "the_widget" function. So I thought it wouldn't be a bad idea to use this same function for all of my external widgets. (am I wrong here???) I have actually read the Reference page for this function.. Unfortunately the reference page is incomplete and there are not enough examples on this page or elsewhere on the web to help me figure out how to structure my code. Specifically I don't know what arguments to use to do the following: ~ Limit the number of archive links to only the last 12 months ~ Not display the widget title ~ Limit the recent posts to just the last five posts ~ Limit the number of tags in the tag cloud I cannot find ANYTHING anywhere on the web that would help me figure this out.. Hoping someone here knows the magic answers..


title: Custom post type permalink structure

text: I've browsed tons of Q/A on stackexchange, google, wordpress forums... but haven't found yet a definitive answer to what looks like to be a common issue since the introduction of custom post types. I've set my permalinks structure from Wordpress admin permalink settings page as:               /%post_id%/%post_name%/      since this is a good practice to improve database performance however, I noticed my custom post types (I have several in one configuration) still appear as:               %cpt_slug%/%post_name%/      while what I really want is               %cpt_slug%/%post_id%/%post_name%/      and actually would love if it could also work as               %cpt_slug%/%post_id%/%taxonomy%/%post_name%/      but as for now, I would like to get the post_id work in the cpt structure how to achieve this? there was a wordpress plugin but apparently it was withdrawn because had some issues (and anyway is no longer mantained)


title: Wordpress 3.2(Multisite) - How to add custom user meta fields to signup form?

text: I want to add custom user meta fields to registration page. I use WP multisite so I have to modify `wp-signup.php`. Adding some field is easy for me(I am programmer :P). But I have a problem with this line of code:               wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array()));      I have searched all Wordpress with bash command:               find -name "*" | xargs grep -ni "add_signup_meta"      And havent found where exactly is specify `add_filter` for `add_signup_meta`. Can somebody tell me where exactly `add_signup_meta` filter is located? Or maybe where is a easier way to add some fields? WordPress 3.2.1 PS I have tried many plugins for adding custom user fields. Only one is good choice(Cimy User Extra Fields) but unfortunately it doesnt add custom fields for registration(probably this is broken).


title: get post id using the $query_vars variable

text: How can I get the ID of a post (or page) based on the $query_vars variable? I want to do something like               $query_vars['post_id']      But I don't have a reference page that has the list of $query_vars perams. The code will be using the template_redirect action hook.


title: Get posts in archive page

text:
I am using this code to show posts in columns. How can I set this part ('cat=3&numberposts=5&offset=0') as so archive page should automatically get posts from clicked catagory?
          <?php $posts = get_posts('cat=3&numberposts=5&offset=0'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count1 = 0; if ($count1 == "5") { break; } else { ?>          <a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?>
<?php the_title(); ?>
     <?php the_field('price'); ?>

     <?php $count2++; } ?>     <?php endforeach; ?>

          <?php $posts = get_posts('cat=3&numberposts=5&offset=5'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count2 = 0; if ($count2 == "5") { break; } else { ?>          <a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?>
<?php the_title(); ?>
     <?php the_field('price'); ?>

     <?php $count2++; } ?>     <?php endforeach; ?>


title: Multiple editable content on page [Solved]

text:
* * * EDIT: I've found out that by using Advanced Custom Fields I can edit multiple fields on a page. Why WP doesn't have this feature by default I'll never know. This is the kind of ability I was looking for that PerchCMS has by default. Thanks for your answers. * * * I'm new to writing websites using Wordpress as a CMS, and in the past I've used a CMS called PerchCMS which allows me to add extra multiple sections by using the php tag of:               <?php perch_content('InformationTitle');?>     <?php perch_content('Information');?>     <?php perch_content('AboutTitle');?>     <?php perch_content('AboutContent');?>      With Wordpress I really don't understand how to add multiple sections in this way, I trawled the Internet for answers, but there appear to be no answers anywhere else. Part of my code is as follows:               <?php if (have_posts()) : ?>         <?php while (have_posts()) : the_post(); ?>                       <img src="<?php bloginfo('template_directory'); ?>/assets/img/logo.png" class="fg3 logo" alt="Logo" />

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

                   <?php the_content('about'); ?>

      With this method, all the content I write gets repeated. What am I doing wrong? I understand that the loop is there to loop through the posts on the page, and I've seen mention of plugins such to achieve this, but surely Wordpress should offer this by default? There are many many sites that have different sections that need to be edited independently. Any help is greatly appreciated.


title: How to localize data array in plugin's option page

text: So i am localizing data saved in an array for my plugin's options, however the data is only localized in the front end, how can I localize data in the plugin's option page as well? The following is what I use to print the data in the front end to be used by my jquery script,               /* localize array data */         $data = get_option('lu_ban_data');          wp_localize_script( 'lu_ban', 'lu_ban_object', $data);


title: Editor doesn't load properly on my self-hosted WordPress 3.3

text: I have a self hosted WordPress install on my small VPS running WordPress 3.3.1 powered by nginx. As of the last 3.3 update, the editor fails to load properly - I cannot see the toolbar etc. When trying to load and edit any existing posts, even the text of the post doesn't load. My browser's error console shows the following error: > Uncaught SyntaxError: Unexpected end of input load-scripts.php:153 > > Uncaught ReferenceError: fullscreen is not defined editor_plugin.js:1 Screenshot: ![enter image description here](http://i.stack.imgur.com/7LiqT.png) Any suggestions?


title: Why do we include jQuery in the header?

text: I was told not to mess with the core files. Also, I don't want jQuery to load on every single page.


title: Where is the content cache when using apply_filters('the_content...?

text: The following code block is giving me an accumulated result:               foreach($sections as $section) {         $content_post = get_post($section->ID);         $content = $content_post->post_content;         $content = apply_filters('the_content', $content);         echo $content;     }      If I catch the value of `$content` _before_ the `apply_filters()`, it seems to work fine, but after and each result is appended to the previous value of `$content`. If I change the final line to:               $content = wpautop($content);      It works as I want (I only need the paragraph formatting), but I am frustrated as I do not understand why the previous method hasn't worked.


title: Code that displays images - images get shown multiple times

text:
On My category.php page i've got a list of categories with the title and the description. **Here's the code:**               <?php      $cat_id = get_query_var('cat');     $catlist = get_categories('hide_empty=0&child_of=' . $cat_id);     echo "
";          foreach($catlist as $categories_item)     {     echo '
term_id ) . '" title="' . sprintf( __( "View all products in %s" ), $categories_item->name ) . '" ' . '>' . $categories_item->name.'
 ';         echo '
'. $categories_item->description . '
';     }     echo "
";     }     ?>      This code outputs categories that are children of the current category. For example if i'm on a category page called 'Products' the child categories of that will be shown. I'm also using a plugin called Taxonomy Image, so i can assign an image to a category. **Here's the code that shows the image:**               $terms = apply_filters( 'taxonomy-images-get-terms', '' );     if ( ! empty( $terms ) ) {              foreach( (array) $terms as $term ) {             print 'taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' );         }          }      The problem is i want the markup like this.
 category title
 category description             category image      I've got the h1 and the p but if i want the image in the category list the code that displays my image needs to go inside the code that displays my categories. This is where the problem lies, because all of the category images then get shown under every category. So under the first category title and description all of the images will be shown, then the same under the second category and so on. How can i combine the code to get the markup i want and only show the correct image for each category and not all of the images? I appreciate this might not be very clear but i've tried to explain it the best i can. Thanks


title: how to render dashboard widgets conditionaly in wordpress admin

text: I would like to render some custom dashboard widget conditionally. If logined user have more than or equal to editor role I would like to render some more widgets than a user with subscriber role. How to do this? Any help please...


title: Easy way to change custom post type name for permalinks?

text: I've pretty much finished building a site based around a theme that uses a custom post type called portfolio. Now, having just switched my permalinks to a custom structure, posts of that type display as www.mywebsite.com/portfolio/postname I want it to be called 'projects' instead of portfolio so it displays www.mywebsite.com/projects/postname Changing the name throughout the site take forever as it's referenced on numerous occasions in the various php files. Is there an easy way to change this without manually replacing?


title: How To make Custom page of every Category

text: Hii i have seen many blogs which posted thing in the same design for example if you see this http://www.songs-pk.info/2011/nayika-malayalam-2011/ there page create alwayz in the same style download button and play button and the same td tr combination how can i make this mean did we just have to give links once we create page ? or how this all is possible for maximum time saving


title: Setting up wordpress on a hosting server for the first time

text: I'm moving a wordpress CMS installation from one host to another. Pretty straightforward I think. I have moved applications running on a Tomcat server but not wordpress. Is the following correct - Restore the database from backup - Can I create a backup dump using wordpress admin GUI or do I need to manually restore on DB itself. Would you recommend using the 5 minute install - http://wordpress.org/download/ ? Once wordpress and the database is intalled on hosting site apply any theming to the CMS. Are there any pitfalls I should watch out for ? Am I on the right track ?


title: Editor html formatting is different from view source

text:
Here's what I see when I click on the HTML tab in the editor...
                    Test ...          test test test? test, test, i.e.,       ... Get Content Here
      And here's what I see when I look at view source in Chrome and FF:

                     Test …

                 test test test? test, test, i.e.,
                  … Get Content Here

      Any ideas what's going on?


title: Nextgen gallery show thickbox/shutter from link instead of image

text:
I'm trying to show the gallery in a thickbox or shutter window from a link. if i have a gallery [nggallery id=1] i want to have a link "view photos" and when i click on it a thickbox/shutter window should popup. i have this working for shutter:
[nggallery id=1]
     View photos      and this working for thickbox:
[nggallery id=6]
     View photos      It opens but the images count is wrong.It counts the gallery images + the images in the page.In this case my gallery has 13 images but the first image(the one in the link) appears twice and then the count is 14 instead of 13.This is really annoying!! is there a way to solve it? Is there an alternative to show the gallery via single link?


title: When and Where to use wp_insert_post()

text: I'm building a function that creates a group of pages with a common parent ID. If I run wp_insert_post() on a parent ID twice, does the function create the pages twice while altering the slugs? Or am I safe to put this in my functions.php like so:               add_action('init', 'AddMyPages');


title: Custom-Posttype & Custom Taxonomy WP_Query

text: I add a custom post type with custom taxonomy and i wish to get all postings into this by a template, but the result is 0               $args=array(       'post_type' => 'contents',       'post_status' => 'publish',       'tax_query' => array(           'taxonomy' => 'content-category',           'field' => 'id',           'terms' => array(5,26,28)       ),       'meta_key' => 'fs16'     );     $query = new WP_Query($args);      The SQL-Query is followed (don't know why):               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) JOIN wp_icl_translations t ON wp_posts.ID = t.element_id AND t.element_type = 'post_contents' JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1 AND 0 = 1 AND wp_posts.post_type = 'contents' AND (wp_posts.post_status = 'publish') AND (wp_postmeta.meta_key = 'fsk16' ) AND t.language_code='en' GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10      What's going wrong here?


title: My title won't update

text: No matter how many times I go into settings, and update my website title, it remains the same. And does not update? I've tried clearing my cache, uninstalling my old theme, searched through source files, and CANNOT figure out why - my title just won't update. Any suggestions?


title: Support for simultaneous editing

text: I'd like to allow multiple authors/editors to simultaneously edit a single page. Each author should immediately see any changes made by any other users concurrently editing the page (just like happens in Google Docs). Is there any way to do this in Wordpress? Is there any plugin that makes it possible?


title: Knowledge base high performance Live Search

text: I'm trying to build a live search function for a knowledge base plugin so that as soon as a user types something into the search field possible results are loaded below the search field as close to real time as possible. If possible, I'd like to avoid hitting the database with ajax. Instead, I'd like to store possible results in an array and search this array instead of the database. Does anyone have any idea how best to do this? Ideally, I don't want to build the array in real time, I think it should be a batch process that occurs each time the user saves a knowledge base item (this is a custom post type that I've created). So, for example, the array can be built and then stored in a single database field that's loaded as and when the live search is displayed. I have some questions:- 1) Do you think that storing results in an array rather than hitting the database is a feasible approach? 2) Do you have any suggestions as to the best approach of building this array. Should it occur on save, or perhaps it should be triggered by a "Build knowledge base index" button? Which do you think will be best for the end user?


title: Wordpress 3.3.1 Page template not showing in admin area

text: I have created a page with the php comment at the start of the file:               <?php     /*     Template Name=> Team Detail     */     ?>      and saved it as team-detail.php in my theme's root directory. Now when I want to add a page with this as the template for that page, I cannot see this template in the admin area under ->add new page-> template. Have tried reactivating the theme to no use.


title: Choosing the right kind of hosting for a Wordpress multisite

text: This question is not so much about ISPs and service providers as about the type of hosting that I should choose for a network site. > Should I go for shared hosting, dedicated hosting, VPS or cloud? I am being tasked with building a network of university portals that will be white-labeled and handed over to their respective admins. There's a lot of custom development so I would like to have control over apache modules, php ini settings and mysql. These subdomains are unlikely to be heavily trafficked but need to be secure and fast. Are there specialists out there that you would recommend? Would like to hear about past experiences (positive and negative) with service providers too. UPDATE: Let me just clarify budget here: It should be under $1000 US a year


title: How to change header dimensions in Wordpress?

text: How can I alter the requirements for the header dimensions so that I can take an uncropped image and fill the top section (centring the whole image) instead of having white space at the top? I would prefer to just be able to edit the CSS and not bother with child themes, as I don't think I will ever need to upgrade the theme. Here is my site http://carolbadre.wordpress.com/ and here is the uncropped image: http://math.stanford.edu/~vakil/11-245/grr.png


title: Reseting admin password through PHPMyadmin fails

text: Following the PHPMyAdmin instructions of this article fails to reset my password properly. I go into WP_Users, find my admin account, click edit, enter my password, change the dropdown to MD5, click save, but this password does not work when I try to login to WP-Admin with this username. Confused.


title: Pagination with $_POST and $_SESSION

text:
I have a page on my site where in the left column is a set of checkboxes representing taxonomies and in the right column is a list of posts that fall into the selected taxonomies. The user is able to check and uncheck these boxes and submit a form which then shows the results in the right column. That works great, here is the simplified code I'm using:                   <?php session_start();          if (isset($_POST)) {     $_SESSION['filters'] = $_POST;     }     ?>
         <form id="filters" method="POST">             <input type="checkbox" name="filter1" value="term1" />             <input type="checkbox" name="filter1" value="term2" />             <input type="checkbox" name="filter1" value="term3" />             <input type="checkbox" name="filter2" value="term1" />             <input type="checkbox" name="filter2" value="term2" />             <input type="checkbox" name="filter2" value="term3" />     </form>

         <?php         //The query is here, which changes dynamically based on the boxes checked above         I'm using $_SESSION['filters'] to call $_POST variables inside the query         ?>
      The problem is, when Wordpress does its navigation thing, it goes to a URL like mysite.com/thispage/page/2/ which doesn't retain the form values like I need it to. It resets them as if the form has not been submitted at all. How do I get the selected to values to follow the user when they navigate the results pages. This is the first time I'm attempting to use sessions, so I could be on the wrong track altogether. Any help is appreciated.


title: Categories sorting

text: I'm using code below to spit out custom post types along with its categories, so Category 1 ---post 1 ---post 2 Category 2 ---post 1 ---post 2 ---post 3 etc. That works well for me, however I would like to be able to sort my categories by count so orderby=count so catgories with larger amount of post will go to the top of the list at the moment that is not working in my code below, any idea why? Many thanks for help                <?php          // List posts by the terms for a custom taxonomy of any post type          $post_type = 'our_drinks';     $tax = ('our-drinks');     $tax_terms = get_terms( $tax, 'orderby=count&order=ASC&hide_empty=0&hierarchical=true');     if ($tax_terms) {         foreach ($tax_terms  as $tax_term) {         $args = array(             'post_type' => $post_type,             "$tax" => $tax_term->slug,             'post_status' => 'publish',             'order' => 'ASC',             'posts_per_page' => -1,             'caller_get_posts'=> 1         );                  $my_query = null;             $my_query = new WP_Query($args);                  if( $my_query->have_posts() ) : ?>                                    <div class="category_title">                                          <?php echo $tax_term->name; ?>                                  </div>                  <?php while ( $my_query->have_posts() ) : $my_query->the_post();  ?>                                                       LOOP CONTENT GOES HERE                                            <?php endwhile; ?>                              v<?php else : ?>             <?php endif; // if have_posts()             wp_reset_query();              } // end foreach #tax_terms     }     ?>


title: Proper way to change the path of uploads folder for existing WordPress site

text: Until now I have used default WordPress directory structure, however since I started using GIT, I plan to setup WordPress as a submodule and also change the paths of upload folder. Since the path for existing images is already set in the database, is there a way to change them automatically?


title: Add button to kitchen sink toggle

text: I have created a simple function along with a shortcode, my goal is now to add a button in the sink toggle of wordpress so that the user doesn't have to type anything. Is this hard to achieve? how can I do it. I thought this was simple, but by looking at this tutorial http://brettterpstra.com/2010/04/17/adding-a-tinymce-button/ it seems rather complex and you have to do some hacks or something. Is there a quicker way?


title: Empty permalinks settings in .htaccess

text: Permalinks not working other than set to "Default'. I want to change it to `/%postname%.html`, and default `.htaccess` is as follows:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      But sometimes it becomes …               # BEGIN WordPress          # END WordPress      … whenever I change the settings of Permalinks. I already change the permission of `.htaccess` to `777` and mod_rewrite is working. `AllowOverride All` has been set to my working directory. Any ideas?


title: Make specific tag visible only to logged in users in front-end

text: I have this specific tag I need to assign to my posts but I need to hide it from regular visitors so that only logged in people can see it. How do I go about it? What WordPress function/hook should I be looking into? I know that I could use `is_user_logged_in()` and I am also looking into `is_tag()`, but how do I put this together? Currently I'm having it displayed in my single template with `the_tags()`, but it doesn't seem to offer a parameter to exclude a particular tag. Pseudo code would be: if user is logged in then show all tags except a specific tag.


title: Control verbosity level of WP DEBUG?

text: I've been at a loss so far and so I thought I'd pose the question: Is there a way to modify the verbosity level of the WP `debug.log` via `wp-config.php` or elsewhere? Just an fyi, here is what I have in my `wp-config.php` to enable logging:               ///////////////////////////////////////////////////     // DEBUG           // Enable WP_DEBUG mode     define('WP_DEBUG', true);          // Enable Debug logging to the /wp-content/debug.log file     define('WP_DEBUG_LOG', true);          // Disable display of errors and warnings      define('WP_DEBUG_DISPLAY', false);     @ini_set('display_errors',0);          // Use dev versions of core JS and CSS files (only needed if you are modifying these core files)     define('SCRIPT_DEBUG', true);          // END DEBUG     /////////////////////////////////////////////////


title: Adding querystring variable breaks admin URLs

text: I've set up some admin pages using add_sub_menu() and whenever I add an additional querystring variable beyond the "page=" portion of the URL, I get a "Cannot load 'page-slug'." message. When I remove the every variable the page loads correctly. Here is my add menu code:               add_submenu_page(       'plugin-slug',       __( 'Post Types - Add', 'plugin-slug' ),       null,       'manage_options',       'plugin-slug-posttypes-add',       'display_admin_page_posttype_add'     );      If I browse to: /wp-admin/admin.php?page=plugin-slug-posttypes-add it works fine. But browsing to: /wp-admin/admin.php?page=plugin-slug-posttypes-add&post_type=sampletype returns: Cannot load content-toolkit-posttypes-add.


title: How to add parameter to wp_enqueue_script?

text: I have the situation that I need to include special scripts only in case a parameter in a macro is used. For the background, see the following:   * My plugin ChessTempoViewer which wraps a JavaScript library for usage in WP.   * There I add the necessary libraries by using `wp_enqueue_script`.   * I would like to internationalize the output of the viewer, which is described here. So to use that internationalization, I should have to include the relevant script depending on the locale that should be used. This should be of course defined by the user, so the user should have the option to do something like:               [ctlocale locale="de_DE"][/ctlocale]     [ctpgn] 1. e4 e5 2. Nf3 ... [/ctpgn]      which should result in an output for the moves:               1. e4 e5 2. Sf3      S for Springer in German instead of N for Night in English. My code currently looks like that:               function pgnviewer_js_and_css(){       wp_enqueue_script("jquery");       wp_enqueue_script('pgnyui', 'http://chesstempo.com/js/pgnyui.js');       wp_enqueue_script('pgnviewer', 'http://chesstempo.com/js/pgnviewer.js');       wp_enqueue_style('pgnviewer-css', 'http://chesstempo.com/css/board-min.css');       wp_enqueue_style('ctpgn', plugins_url('ctpgn.css', __FILE__));     }          add_action('wp_enqueue_scripts', 'pgnviewer_js_and_css');          function chessTempoViewer($attributes, $content = NULL) {       ..     }      How could I include an additional tag `ctlocale` as in the example above (as the first entry) to ensure that the script is included before the other scripts?


title: Selecting a dynamic sidebar via metabox in wordpress

text:
I am developing a wordpress theme where are 3 sideboxes. I want to select a sidebox through metabox in my admin page so that particular sidebar shows up in front-end. My codes are:- In function               array(                     'name'    => __( 'Select Sidebar', 'cmb' ),                     'desc'    => __( 'Select Your sidebar', 'cmb' ),                     'id'      => $prefix . 'test_select',                     'type'    => 'select',                     'options' => array(                         array( 'name' => __( 'sidebar-1', 'cmb' ), 'value' => 'sidebar-1', ),                         array( 'name' => __( 'sidebar-2', 'cmb' ), 'value' => 'sidebar-2', ),                         array( 'name' => __( 'sidebar-3', 'cmb' ), 'value' => 'sidebar-3', ),                     ),                 ),      In my theme file :-               <?php get_sidebar(); ?>      and in my sidebar.php                <?php do_action( 'before_sidebar' ); ?>             <?php                      global $post;                     $sidebar = get_post_meta($post->ID, '_cmb_test_select', true); ?>                       <?php if ( $sidebar != 'sidebar-1' ) :  ?>                           <?php ! dynamic_sidebar( $sidebar = 'sidebar-1');  ?>

          <?php  elseif( $sidebar != 'sidebar-2') : ?>                   <?php  ( ! dynamic_sidebar( 'sidebar-2' )) ?>                                                            <?php  elseif( $sidebar != 'sidebar-3')   :?>                    <?php  ( ! dynamic_sidebar( 'sidebar-3' )) ?>                                                                                <?php endif; ?>      But when I select the relevant sidebar in the admin page the same sidebar is not showing in front-end. Please help me to sort out where I am going wrong Thanks in advance.


title: All plugins deactivated. What could cause this?

text: I have an AWS server running four WordPress sites. All plugins have been deactivated on one of the sites and I cannot enable them. When I try enabling them in bulk, or individually, there is no error and it even says "Plugin activated.", but they are not. I have tried changing the ACLs temporarily, so that the webserver has full access. I have tried moving directories of plugins that have been recently updated, but nothing works. I have found that UpdraftPlus backups stopped being produced by this site and a similarly configured one (similar custom-made theme and nearly the same plugins) two days ago. Also, I have noticed that WP-CLI has not been working properly with these two similar sites over the last couple of days. I don't know what else to say. I'm completely stumped. What can I do about this?


title: Latest Posts not in the right order

text:
I have changed my website's homepage to show only latest posts on the home page by going to settings > reading and using the "Latest Posts" option, but I just can't get things to work properly. On the homepage, the entire content of a post is displayed instead of just its title and summary and this doesn't just happen on the homepage, it happens on category pages, archive pages all render this way. My website is popularitybar.com , I'm using a mobile theme to test run things at the moment. These are the contents of my theme's index.php file               <?php get_header(); ?>

                            <?php // the loop ?>             <?php if (have_posts()) : ?>                      <?php while (have_posts()) : the_post(); ?>     <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>               <?php $postformatbackground = get_post_meta($post->ID, 'PostFormatBackground', true); ?>     <div style="background-image: url(<?php echo $postformatbackground; ?>);background-size:100% auto;position:absolute !important;z-index:-1;top:0;bottom:0;left:0;right:0;width:100%:height:100%;opacity:.4;">
               <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>               <?php $featuredembed = get_post_meta($post->ID, 'FeaturedEmbed', true); ?>
<?php echo $featuredembed; ?>
                    <?php $shortcode = get_post_meta($post->ID, 'Shortcode', true); ?><?php echo do_shortcode($shortcode); ?>
     <a href="<?php the_permalink(); ?>#respond"><?php comments_number( ''.__('no comments', 'hero').'', '1 '.__('comment', 'hero').'', '% '.__('comments', 'hero').'' ); ?>     <?php the_tags('','',''); ?>

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

<?php the_content( __( 'Continues..', 'hero' ) ); ?>

          <?php endwhile; ?>                                    <?php get_template_part( 'includes/pagination'); ?>               <?php else : ?>
<?php _e( 'Sorry, nothing found.', 'hero' ); ?>
               <?php endif; ?>
                    <?php get_footer(); ?>      Thanks!


title: How WordPress is able to change locale without using setlocale

text: In my plugin I print out the current locales via                   $originalLocales = explode(";", setlocale(LC_ALL, 0));              var_export($originalLocales);die;      Obviously the result is same as the `WPLANG`defined. However, I've grep all the wordpress ' code, I cannot find a single call via `setlocale`, so how WordPress is able to change locale without using setlocale?


In wordpress site how to Redirect the non-www version of the site to the www version to remove duplicate content


title: Custom post type: Add "Edit | Quick Edit | Trash | View" links to date (if title is not shown in column)?

text: I've created a custom post type for my "Testimonials", I don't need a title(s), how can I write a function that Adds the " _Edit | Quick Edit | Trash | View_ " links to "date" if title isn't shown in the column. I'm using the plugin "Admin Columns" to hide the columns I don't wish to show. ![base](http://i.stack.imgur.com/R7ATr.png) I'm trying to re-use this code from this previous StackExchange question ( No Edit / Delete Links for Custom Post Type? ), however I have already created the fields "Author" etc. Using this code gives this result. ![result](http://i.stack.imgur.com/4y0Y1.png)


title: Custom login page problem!

text: I am trying to make custom login page by adding 1 in functions.php and 2 into theme folder. but I can't even execute the theme. I can activate the theme without 1 and 2. However, the site goes frozen both way trying to update the functions.php after pushing 2 to server and modifying the functions.php on dashboard, and trying to activate the theme after pushing the theme including 1,2 to server. The file is available at www.lastech.com.au/green.zip I tried so many different way to sort this out but it is not working. I spent almost a week. Please help me guys! 1.               function custom_login() {      echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/custom-login.css" />';      }     add_action('login_head', 'custom_login');      2.               custom-login.css file      My file is available at www.lastech.com.au/green.zip Regards BK


title: Configure which plugin custom post types get registered

text: I am writing a plugin that creates custom post types, but i want users to be able to turn them on and off via a filter in the `functions.php` file. The issue i'm having is that custom post types `register_post_type` has to be called during `init` and `functions.php` is read far after this. How can I allow users to provide an array using a filter or action that will control which post types `register_post_type` gets called?               // currently the custom post type constructor has this     if(!post_type_exists($this->name)) {       add_action("init", array($this, "register_post_type"));       add_action("init", array($this, "configure_meta_boxes"));       add_action("save_post", array($this, "save"));            add_filter('myplugin_get_shortcodes', array($this, "configure_shortcodes"));     }      The filter works just fine so I know it's being called, but for whatever reason the actions aren't.


title: WordPress fetch_feed returning only one (latest) item

text:
I am trying to get feed details, using `fetch_feed` function, from a input field populated by users. I followed the code snippet from here. It gets the items nicely, but the problem is, it is returning only the latest item from the feed. The code is almost same, only I am using it inside a function that hooked into a AJAX action. Here is the code I am using:               function display_feed_items() {              include_once( ABSPATH . WPINC . '/feed.php' );              $rss = fetch_feed( $_POST['feed'] );              if ( ! is_wp_error( $rss ) ) :                  $maxitems = $rss->get_item_quantity( 7 );                   $rss_items = $rss->get_items( 0, $maxitems );              endif;              if ( $maxitems == 0 ) :             $feeds = '
 '. _e( 'No items' ). '
';         else :             foreach ( $rss_items as $item ) :                 $feedlink = esc_url( $item->get_permalink() );                 $feedtitle = esc_html( $item->get_title() );                 $feeds = '
' . $feedtitle . '
';             endforeach;         endif;              echo $feeds;         die();     }     add_action( 'wp_ajax_getfeeddetails', 'display_feed_items' );     add_action( 'wp_ajax_nopriv_getfeeddetails', 'display_feed_items' );      Where I am doing wrong?


title: direct custom post query interferes with other queries on page

text: In a previous question, I was struggling with how to get my custom post type(s) to show when performing standard category/tag queries, since by default Wordpress doesn't include CPT's in these queries. After quite a bit of hunting I found the answer to be this:               add_filter('pre_get_posts', 'query_post_type');     function query_post_type($query) {       if($query->is_category() || $query->is_tag() || $query->is_home() && $query->is_main_query()) {          $post_type = get_query_var('post_type');          if($post_type)             $post_type = $post_type;           else             $post_type = array('post','my_custom_post_type');           $query->set('post_type',$post_type);          return $query;       }     }      And, it works great... I can now assign categories/tags to my custom post types, and then query them and see the results. HOWEVER, with this code in place, I now have an entirely new problem which ONLY happens when the above code is in place... if I now query or view my Custom Post Type directly (that is, not via a category/tag), then suddenly my standard query items on the page (such as, a category listing in the footer) go blank. I'm not understanding how this is happening, since I am checking to assure `$query->is_main_query()`, so it seems the initial if statement would be false.... Do I now have to write another separate function so that when I query or view a custom post type directly, I can then allow standard post types to function on the same page?? Any help appreciated... * * * ## UPDATE Thanks for the comments, I have figured out why this is problematic: When I had my initial solution (not shown in this post), everything worked great with basic queries from the standard and CPT - but as I progressed into multiple queries, I realized that in certain cases, such as pages with queries spread around, in main page, some in footer, suddenly I ran into a crossover effect - like my menu would disappear at times, etc. So that's when the `&& $query->is_main_query()` was added (see full code above) - and of course it worked better then, because I was only applying this to the main query, thus avoiding menu/footer issues... or so I thought. Since adding this new version of the code, all seemed well - until I queried my CPT 'DIRECTLY'... when I did this, one of my standard footer widgets (calling a simple category query) went blank. As I started looking at this, I could see that in my initial IF query in the above code, it is performing an 'OR OR OR AND' - when technically, to keep this code to ONLY the main query, I would need to do something like '(( OR OR OR ) AND )' - or, wrap the entire function in in an `if ($query->is_main_query() {` So, I went ahead and did this (see below)... and when I did it, that solved the 'Direct CPT' call problem - allowing me to now directly query a CPT without blowing up the footer query.               add_filter('pre_get_posts', 'query_post_type');     function query_post_type($query) {     if ($query->is_main_query()) {     if($query->is_category() || $query->is_tag() || $query->is_home() ) {     $post_type = get_query_var('post_type');     if($post_type)         $post_type = $post_type;      else         $post_type = array('post','my_custom_post_type');      $query->set('post_type',$post_type);     return $query;         }           }     }      So, this seems great, right?? But, not so... because since my first version of this wasn't set up as I had intended, it was allowing my CPT to be added to the standard category/tag queries at times when NOT in the main_query... so now that I have officially filtered this so it can ONLY effect the main_query in all cases, my on-page Tab query calls are failing... (these are making calls to my CPT via category within jquery tabs on each page). So my new question is: given my SECOND version of code above, which allows me to incorporate my CPT into standard cat/tag queries, AND query my CPT directly, with no ill effect to other queries on the page - how do I now determine what query my TAB calls are making? Because it is obviously not the main_query - and therefore, I now need to target those so that I can include my CPT, much like I have done for the main query?


title: get_posts - get all posts by author id

text: I want to get all posts by certain author id (current user). Later, I want to pick the first post made by this user (ASC). I guess I do not use the right arguments in get_posts, am I? $current_user_posts always contains an Array with all blog posts in multiple different WP_Post Objects.               global $current_user;     get_currentuserinfo();                                $args = array(         'author'        =>  $current_user->ID, // I could also use $user_ID, right?         'orderby'       =>  'post_date',         'order'         =>  'ASC'          );          // get his posts 'ASC'     $current_user_posts = get_posts( $args );


title: Run function AFTER theme options are saved?

text: Weird question, how can I run a custom function AFTER my theme settings are saved? I see that the register_settings() function has a sanitize callback, but that runs before the settings are changed. I need something to run after they're saved. Is there an action or filter I can use to do that? EDIT - SO I have this setting I made:               add_settings_section(         'kjd_body_background_settings_section', // ID hook name         null, // label         null, // function name         'kjd_body_background_settings' // page name     );                   add_settings_field(             'kjd_body_background_colors', // ID hook name             null, //label             null, //callback             'kjd_body_background_settings', // page name             'kjd_body_background_settings_section' // parent section      );      and this function:               function kjd_update_stylesheet( $oldvalue, $_newvalue ){        echo 'updated!';        die();     }     add_action('update_options_kjd_body_background_settings','kjd_update_stylesheet',10, 2);          //add_action('update_options_kjd_body_background_colors','kjd_update_stylesheet',10, 2);


title: Wordpress Iris Colour Picker adding iOS touch events

text: I've implemented an Iris Colour Picker into the front-end of my theme thanks to the help provided in this question and all works well on the desktop front. However, it seems as though when it comes to an iPad device the colour picker doesn't work as expected. The mouse dragging event isn't being recognised, however clicking around the colour area works, it's like the mousedrag event isn't being recognised. Is this a known issue and is there perhaps a way I can duckpunch the functionality into the colour picker?


title: Simple tree display of WordPress menu

text: I want to display my wordpress menu in the form of a simple tree like this:                 >First menu item          >sub-menu-1             >sub-sub-menu-1          >sub-menu-2          >sub-menu-3            >Second menu item          >sub-menu-1            >Third menu item          >sub-menu-1          >sub-menu-2          >sub-menu-3      I know there is this `wp_nav_menu()` but how do I add class to sub-menu so that I can give some left margin and make it look like, it's nested?


title: Attaching meta box to specific category/taxonomy in custom post type

text: I have this case here and can't figure out how to do it. I have a custom post type with taxonomies and a meta boxes to that specific post type. The idea is some metaboxes to appear only when category/taxonomy is checked. Any help appreciate.               <script type="text/javascript">          jQuery(function($)     {         function my_check_categories()         {             $('#eg_vehicles_make_model').hide();                  $('#typeschecklist input[type="checkbox"]').each(function(i,e)             {                 var id = $(this).attr('id').match(/-([0-9]*)$/i);                      id = (id && id[1]) ? parseInt(id[1]) : null ;                      if ($.inArray(id, [7,10]) > -1 && $(this).is(':checked'))                 {                     $('#eg_vehicles_make_model').show();                 }             });         }              $('#typeschecklist input[type="checkbox"]').live('click', my_check_categories);              my_check_categories();     });


title: Get multiple roles with get_users

text: I've got some code like this:               $query_args = array();     $query_args['fields'] = array( 'ID', 'display_name' );     $query_args['role'] = 'subscriber';     $users = get_users( $query_args );     foreach ($users as $user) $users_array[$user->ID] = $user->display_name;      I want to get more roles and also include `contributor`, `author` and some custom roles I created with the Role Scoper plugin e.g. `Manager`, etc. Any ideas how I can do this with `get_users`? Thanks


title: How do I implement JQueryUI dialog modal in a WP plugin?

text:
I have a Wordpress plugin I created which creates custom top level menu and submenu fine. The Submenu calls this, (entire code beneath) the BranchMaintenance php form, which shows branches in a table, ex the dbase, (using $Wpdb). It's getting the JQueryUI dialog modal form to popup which is the problem. doubtless my code is responsible, ...clueless re things like no name variable outer/toplevel functions as per in the code e.g. $(function() {   so any help extra ideas ....Thx I am trying to action the scripts I need to a) hide the dialog form initially (it appears above my table of branch data)..probably got this way wrong b) display it when called (this still as per the original demo code) Thx Neal
     <form name="Sandwich Baron Branch Maintenance" method="post" action="<?php echo str_replace( '%   7E', '~', $_SERVER['REQUEST_URI']); ?>">                      //This was placed in the head of a normal HTML form in the Demo 'http://jqueryui.com/demos/dialog/modal-        form.html'...field validation is removed for now.                    <?php     function fn_DeleteBranch(Id)     {        //$wpdb->   etc etc ; //deletes this branch (by Id) from the dbase     }     ?>                         <?php     // Hook for adding Dialog form HOPEFULLY     add_action('admin_init', "#dialog-form" );     add_action( 'admin_init', 'my_Deregister_scripts' );      add_action( 'admin_enqueue_scripts-options_page-{page}', 'myplugin_admin_scripts' );           function my_Deregister_scripts()  {                wp_deregister_script( 'jquery-ui' );  //Deregister WP's version         }            function myplugin_admin_scripts(){        //  syntax   wp_enqueue_script( $handle,$src,$deps,$ver,$in_footer );        //  $src  = the url where the scripts are stored        //  $in_footer Normally scripts are placed in the  section, so defaults to false             //wp_register_script( 'jquery-ui', plugins_url( 'js/jquery-ui.js', __FILE__ ), array( 'jquery' ) );          wp_enqueue_script('jquery');          wp_enqueue_script('jquery-ui-core');          wp_enqueue_script('jquery-ui-dialog');     wp_enqueue_script('jquery-ui-1.8.17.custom.min' );     wp_enqueue_script('jquery-bgiframe-2.1.2' );     wp_enqueue_script('jquery-ui-mouse' );     wp_enqueue_script('jquery-ui-button' );     wp_enqueue_script('jquery-ui-draggable' );     wp_enqueue_script('jquery-ui-position' );     wp_enqueue_script('jquery-ui-resizable' );     wp_enqueue_script('jquery-effects-core' );           wp_enqueue_script('jquery-ui-widget' );          //jquery-ui-1.8.17.custom         wp_enqueue_style('jquery-   style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');     }     ?>

All form fields are required.
          <form>     <fieldset>         Branch Name         <input type="text" name="txtBrname" id="txtBrName" class="text ui-widget-content ui-corner-all" />         Tel         <input type="text" name="txtTel" id="txtTel" value="" class="text ui-widget-content ui-corner-all" />                    </fieldset>     </form>

     <?php                      echo "
";          echo "
          ID	          Branch Name	          Express?	          Str.Address	          Area	         Manager	         Owner	         Tel	         Cell	         Email	         Edit	         delete
";           global $wpdb;     $myrows = $wpdb->get_results("SELECT * FROM wp_sbbranches");              // loop through results of database query, displaying them in the table           foreach ($myrows as $row) {                                echo "
";                  echo '' .$row->BrId. '	';                  echo '' .$row->BrName. '	';                  echo '' .$row->BrTel. '	';              echo '<button onclick="create-branch(' . $row->Id. ')">	';                 echo '<button onclick="fn_DeleteBranch(' . $row->Id. ')">	';                       echo "
";           }           // close table>          echo "
";     ?>      <button id="create-branch(' 0 ')" >Create new branch</button>


title: Plugin alternative to Normalize.CSS?

text: Hello Wordpress world! Since Normalize.CSS is not actually a wordpress plugin, could someone recommend me something close to it? Thanks!


title: To merge customized codes upon wordpress update

text: When using `update` feature (in `wp-admin/update-core.php` page), it seems to me that wp just replaces all the resources, and the changes that have been made in the working resources just get erased instead of getting merged. At least I've been experiencing with `wp-login.php` that gets replaced per every update and thus I have to reflect back the change from scratch (it's not easy often because the code in the file changes upon update). Am I right? If so, are there ways to merge the changes already made with the update?


title: Lightbox type effect to support a HTML/jQuery image map

text: I haven't used WP extensively before but I'm more experienced in HTML/jQuery and I'm helping a friend with their existing WP blog. I have designed an interactive map menu using the technique described here: tutorial and demo (essentially each region of the map has it's own image for both selected and non-selected states and an image map and jQuery is used to toggle the selection of each area) What I want to achieve is to have this pop up in a lightbox style box when you go to the blog homepage, and then the areas selected on the map dictate the categories of posts that are displayed. I had created this using plain HTML and jQuery (without a lightbox type plugin - just doing the fade manually) but now I need to integrate it with their website - although I imagine I may have to code this completely differently for WP. So my main questions are:   1. Is there a lightbox type WP plugin that supports all of the content I need (HTML image map and a few other buttons and options)?   2. Would the most appropriate plugin then support the jQuery method I have used from the tutorial above or is there a better way of achieving this?   3. How can I get this to automatically popup for the homepage of the blog? I hope I've included enough information, if you have any questions just let me know. Thanks a lot,


title: WordPress: Allowed Memory Size Exhausted - After Moving from Dev to Live

text: I keep getting this on my WordPress site after I moved it from my development server to the live site. It's happening in one file that is using a few functions which I think is causing it, but I don't know how to fix it. > Allowed memory size of 268435456 bytes exhausted (tried to allocate > 452314848 bytes) in **Unknown** on line **0** The code of the file that is causing the problem is here: custom.php I think it is one of these functions: `ob_flush()` or `ob_end_flush()`. How this started happening: I finished development of the site using WordPress MU (only 2 blogs in the network), originally I had it working with sub-directories. Once I moved it to the live server, I switched to sub-domains and got them working fine (both sites are showing) but I am getting that error in `custom.php`, causing some JavaScript to stop functioning. By the way, this **only happens about 85% of the time** , not every time the error shows. Let me add that I am customizing a theme called Repro, if it is of any relevance. Anyways, if anyone can help me troubleshoot on why this is happening, and what I can do to fix it, I would be very grateful, thanks! **Things I have tried:** Increasing the memory limit using `define('WP_MEMORY_LIMIT', '1024M');` in `wp-config.php`. - No luck Switching themes - The problem only persists on the Repro theme


title: How do I display the handle for all front-end enqueued scripts in plugin options page?

text: I use the following function in my plugin to display all the scripts handles in my plugin options page but it display only the handles of admin scripts:               function my_detected_scripts() {       global $wp_scripts;       foreach( $wp_scripts->queue as $handle ) :         echo $handle . ' <br /> ';       endforeach;     }      Then:               echo my_detected_scripts()      How can get the handles of all front-end enqueued scripts only? Thanks in advance!


title: Continuum Theme - Excerpt length

text: So I have been doing some digging and narrowed down the file that I believe is calling for the front page excerpts on all posts. No matter what I change it to, it doesn't seem to adjust.               //get excerpt for feed panels     function con_feed_excerpt() {     $excerpt = get_the_excerpt();            if (strlen($excerpt)>230) {         $excerpt = substr($excerpt, 0, 227) . "...";     }     echo $excerpt;     }      This looks to be where it is getting the excerpt length from the first character to the 227th char and then ending with a ... I've tried changing the 227 and re-uploading to my server and to no avail. Any clues what might be preventing it?


title: Load template inside a parent template

text: Inside of my current theme directory, I created a folder called "mobile" which contains a separate set of template files, all optimized for mobile. Now, say I setup a function that detects a mobile device, I would like wordpress to now load "mytheme/mobile/header.php" Instead of the themes root header.php and index files. Is there some way I can tell wordpress to look in a template subfolder for the template files? Many thanks


title: Different layout on search page depending on category post

text:
I would like to display different layouts for post with different categories on the search page: I tried with this code:               <?php     if(isset($_GET['the_category'])) {         $type = $_GET['the_category'];         if($type == '1') {     ?>      But it doesn't work, could someone can point out a solution? Full code:               <?php get_header(); ?>

         <?php do_action( 'bp_before_blog_search' ); ?>
         <?php if (have_posts()) : ?>           <?php bp_dtheme_content_nav( 'nav-above' ); ?>           <?php while (have_posts()) : the_post(); ?>           <?php do_action( 'bp_before_blog_post' ); ?>                <?php           if(isset($_GET['the_category'])) {             $type = $_GET['the_category'];             if( $type == '1' ) {           ?>

               <a href="<?php the_permalink() ?>" rel="bookmark"                    title="Fixed link <?php the_title_attribute(); ?>">                 <?php the_title(); ?>
             <?php if ( has_post_thumbnail() ) { ?>
               <?php the_post_thumbnail('full'); ?>
             <?php               } else {                 // no thumbnail               }             ?>
             <?php             global $more;             $more = 0;             the_content( __('Read more','OneCommunity') );             ?>

                <?php                 } elseif( $type == '4' ) {           ?>                //Display layout for post marked with category 4           <?php             }           }           ?>                <?php do_action( 'bp_after_blog_post' ); ?>           <?php endwhile; ?>           <?php bp_dtheme_content_nav( 'nav-below' ); ?>         <?php else : ?>
             <?php _e( 'No posts found. Try a different search?', 'OneCommunity' ); ?>
         <?php endif; ?>
       <?php do_action( 'bp_after_blog_search' ); ?>

       <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-blog')) : ?>       <?php endif; ?>       <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-ad-blog')) : ?>       <?php endif; ?>
     <?php get_footer(); ?>


title: Modify a plugin function output from another plugin

text: I'm writing a plugin for a wordpress site using a page template using WP Types plugin. My plugin adds a shortcode tag. Shortcode tags inside 'the_content' get processed without problem. But this page template echoes `types_render_field(...)` WP Types function which gets and returns content containing shortcode tags retrieved from the database using `get_post_custom($postid)` wordpress core function call. I want to process these shortcode tags without modifying the template or WP Types plugin, just using my plugin code. Is that possible?


title: Get the More QuickTag button back

text: I can't work out how to add the WP quicktag button back into the editor, I have customized the editor as below:               function gimko_format_tiny_mce($in) {         $in['remove_linebreaks']=false;         $in['convert_newlines_to_brs']=false;         $in['keep_styles']=true;         $in['tabfocus_elements']='major-publishing-actions';         $in['paste_remove_styles']=false;         $in['paste_remove_spans']=false;         $in['paste_strip_class_attributes']='none';         $in['paste_text_use_dialog']=true;         $in['plugins']='inlinepopups,tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen';         $in['apply_source_formatting']=false;         $in['theme_advanced_buttons1']='formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,wp_fullscreen,wp_adv';         $in['theme_advanced_buttons2']='pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo';         $in['theme_advanced_buttons3']='';         $in['theme_advanced_buttons4']='';         $in['valid_children'] = '+div[p]';         return $in;     }      What do I need to add in to get it back showing?


title: Importing from XML is ignoring serialized custom field

text: I have been trying to import something into a custom field using the WordPress Import tool but it seems to be leaving the custom field empty in the database.               <wp:meta_value><![CDATA[a:19:{s:7:"address";s:50:"52, St. Michaels Rd,Sheffield,S359YN";s:11:"gpsLatitude";s:18:"";s:12:"gpsLongitude";s:18:"";s:18:"streetViewLatitude";s:9:"";s:19:"streetViewLongitude";s:18:"";s:17:"streetViewHeading";s:17:"";s:15:"streetViewPitch";s:18:"";s:14:"streetViewZoom";s:1:"0";s:9:"telephone";s:13:"01142570288";s:5:"email";s:19:"";s:3:"web";s:17:"";s:11:"hoursMonday";s:9:"";s:12:"hoursTuesday";s:9:"";s:14:"hoursWednesday";s:9:"";s:13:"hoursThursday";s:9:"";s:11:"hoursFriday";s:9:"";s:13:"hoursSaturday";s:6:"";s:11:"hoursSunday";s:6:"";s:18:"alternativeContent";s:0:"";}]]></wp:meta_value>      There doesn't seem to be anything massive sticking out with this, but when I use the importer tool it ignores this and leaves an empty space in the database. Any ideas of what's happening or if there's something blatantly obvious that's missing?


title: Getting A Link below footer - Want to remove it. How?

text: My blog http://MyTechFlow.Com showing a link in urdu language after footer(below footer). I had tried to remove it by looking up into footer.php But unable to find something... So guyz plz help me to fix it. Here is the Screenshot: http://share.pho.to/4RtoD/t1/original


title: How can I hide the sidebar from a specific post?

text: I'd like to hide the sidebar on a specific post (not page). How can I do this? For background, I've searched quite a bit both on Google and here. I'm finding lots of solutions for showing different sidebars on posts vs. pages, or for showing (or hiding) a specific sidebar on a specific _page_ , but nothing that's about hiding the sidebar from a single specific post.


title: Get null from POST

text:
I have problem with my code. I don't know why all my $_Post have null at the end.This is my code:                   function ow_display_user() {         wp_enqueue_script('jquery-ui-datepicker');         wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');              global $wpdb;         $results = $wpdb->get_results ("SELECT adres FROM wp_ow_adres;");         ?>
Odczyt wodomierzy
     <form method="post" action="">

                     Adres zamieszkania	                     <select id="adres" name="adres">                             <option value="">Wybierz swój adres</option>                             <?php                              foreach ( $results as $result ) {             echo '<option>'.$result->adres.'</option>';         }         ?>                     </select>
                 <input type="submit" name="submit" value="Wybierz" />

     </form>     <?php      $adres = $_POST["adres"];     global $wpdb;     if (isset($_POST['submit'])){             $spr_liczbe_wodo = $wpdb->get_var("select liczba_wodomierzy from wp_ow_adres where adres='$adres'");             switch ($spr_liczbe_wodo) {                 case 1:                     ?>     <form name="adres_form" method="post" action="">

                     Adres zamieszkania:	                     <?php echo $adres;?>

                     Stan wodomierza:	                     <input type="text" name="stan_wodomierza" />

                     Data odczytu:	                     <input type="text" name="data_odczytu" id="datepicker" />

                     Kod lokalu:	                     <input type="text" name="kod_lokalu" />

                     	                     <input type="submit" name="submit" value="Zapisz" />

     </form>     <?php      break;     case 2:         ?>     <form name="adres_form" method="post" action="">

                     Adres zamieszkania:	                     <?php echo $adres;?>

                     Woda ciepła:	                     <input type="text" name="woda_ciepla" />

                     Woda zimna:	                     <input type="text" name="woda_zimna" />

                     Data odczytu:	                     <input type="text" name="data_odczytu" id="datepicker" />

                     Kod lokalu:	                     <input type="text" name="kod_lokalu" />

                     	                     <input type="submit" name="submit" value="Zapisz" />

     </form>     <?php     break;     case 4:         ?>     <form method="POST" action="">

                     Adres zamieszkania:	                     <?php echo $adres;?>

                     Woda ciepła (kuchnia):	                     <input type="text" name="woda_ciepla_kuchnia" />

                     Woda ciepła (łazienka):	                     <input type="text" name="woda_ciepla_lazienka" />

                     Woda zimna (kuchnia):	                     <input type="text" name="woda_zimna_kuchnia" />

                     Woda zimna (łazienka):	                     <input type="text" name="woda_zimna_lazienka" />

                     Data odczytu:	                     <input type="text" name="data_odczytu" id="datepicker" />

                     Kod lokalu:	                     <input type="text" name="kod_lokalu" />

                     	                     <input type="submit" name="submit" value="Zapisz" />

     </form>     <?php     if (isset($_POST['submit'])){         global $wpdb;         $kod_lokalu = $_POST['kod_lokalu'];         $spr_kod_lokalu = $wpdb->get_var("select kod_lokalu from wp_ow_adres where adres='. $adres .'");         if ($spr_kod_lokalu == $kod_lokalu) {                 $kod_lokalu = $_POST['data_odczytu'];                 $woda_ciepla_kuchnia = $_POST['woda_ciepla_kuchnia'];                 $woda_ciepla_lazienka = $_POST['woda_ciepla_lazienka'];                 $woda_zimna_kuchnia = $_POST['woda_zimna_kuchnia'];                 $woda_zimna_lazienka = $_POST['woda_zimna_lazienka'];                 $data_odczytu = '0000-00-00 00:00:00';                      $data = array(                         'id' => '',                         'adres' => $adres,                         'data_odczytu' => $data_odczytu,                         'woda_ciepla_kuchnia' => $woda_ciepla_kuchnia,                         'woda_ciepla_lazienka' => $woda_ciepla_lazienka,                         'woda_zimna_kuchnia' => $woda_zimna_kuchnia,                         'woda_zimna_lazienka' => $woda_zimna_lazienka,                 );                      $wpdb->insert(`wp_ow_odczyty`, $data);         }     }     break;     }              }     }


title: Why does publish_{custom-post-type} fire on update?

text: I'm trying to fire two different actions on both publish and update. Neither should ever fire at the same time. The problem is that `publish_pm_task` is getting fired on update and `save_post` is never getting fired? See anything wrong with this?               <?php     // Updated task notification     add_action( 'save_post', 'pm_updated_task_notification' );          // New task notification     add_action( 'publish_pm_task', 'pm_new_task_notification' );          function pm_new_task_notification() {              error_log('definitely a task');          }          function pm_updated_task_notification( $post_id ) {              $slug = 'pm_task';              /* check whether anything should be done */         $_POST += array("{$slug}_edit_nonce" => '');         if ($slug != $_POST['post_type']) {             return;         }         if (!current_user_can('edit_post', $post_id)) {             return;         }         if (!wp_verify_nonce($_POST["{$slug}_edit_nonce"], plugin_basename(__FILE__))) {             return;         }              error_log('updated a task');          }


title: Advanced Custom Fields if else issue

text: Ok, I think I have a simple fix here. I'm using ACF to link health reports to specific dogs on a breeder website. But, not all dogs have the same reports, and I don't want to show a dead link if no ACF value is available. So, I wanted to use an if statement but can't quite get it to work. Here's my code:               <?php                 $values = get_field('cardiac');                 if($values) {                 echo '<a rel="lightbox" href="'.<?php the_field('cardiac'); ?>.'">Cardiac';                 } else {                 echo '';                 }             ?>      Any help would be appreciated.


title: wp_tag_cloud inline CSS

text: I am using wp_tag_cloud but my problem is the inline CSS (for the font-size). I am doing RWD so I need full control of my markup/css. As I saw there is no property that will make it go away, so I guess I need to use another function, or the format=array. I tried using the array format but I couldn't make the tags appear. (not a php guy). Also please note tags need to be enclosed in elements, so no plaintext.. What are my solutions? Can I use wp_list_categories somehow? Thank you


title: Get_post_meta() won't return value

text: Ok guys... I'm sure this is going to be a really easy answer. I'm a complete noob at this. I have a custom field that is supposed to return a link. For some reason, it just redirects me back to my site homepage. I'm really new to Wordpress so I'm not sure what's going on but I've scoured Google and this is what I've got:                href="<?php get_post_meta(get_the_id(), 'ramco-videos-link', true);      Why won't it return the link in the custom field?


title: update a value in wordpress wp_options

text: I am trying to modify a plugin and in which i require to update a value in wp_options which has multiple values . My `option_name` is `ws_mem_options` and the `option_value` has values such as in format               s:20:"pro_sp_email_subject";s:36:"Thank You! (instructions for access)";s:20:"mem_email_message";s:309:"Thanks %%first_name%%!          %%item_name%%          Transaction ID: %%txn_id%%     Charges today: $%%amount%%          Your order can be retrieved here:     %%sp_access_url%%     ( link expires in %%sp_access_exp%% )          If you have any trouble, please feel free to contact us.          Best Regards,     Don't Just Watch TV, Participate!";s:120:"mem_coupon_codes";s:66:"CHRISTMAS-25|25%|01/01/2021     100%OFF|100%     SAVE-10|10%     dumpme|10%";s:15:"mem_default_tax";s:4:"0.0%";s:13:"mem_tax_rates";      how can i add more values to               s:120:"mem_coupon_codes";s:66:"wow-25|25%|01/01/2021         100%OFF|100%         now-10|10%         dumpme|10%";


title: database query with more than a couple meta hangs and doesn't complete

text: I have a development website with about 70 checkboxes for custom fields. The idea is the user selects one or more checkboxes, it queries the database for all posts that have a meta_key for the checkbox, and returns the results. My code below works great for 1-3 checkboxes at a time. 4 checkboxes or more results in a hosting error "Unable to Serve This Request", connection timed out message. The error is not dependent on the # of results returned. 4 checkboxes which should return around 20 results fails, while 2 checkboxes for 170 results is no problem. Here's how I have built my query - is there anything inheritly wrong with my logic?               $args=array(         'post_type' => array ( 'resources'),         'post_status' => 'publish',         'posts_per_page' => -1,         'orderby' => title,         'order' => ASC,              'meta_query' => array(                 'relation' => 'OR')                 );                   // Add filters        // I have an array above with the $name and value of the meta_key             array_push($args['meta_query'], array('key'=>$name, 'value'=> $value));               $my_query = null;         $my_query = new WP_Query($args);              if ( $my_query->have_posts() ) {              while ($my_query->have_posts()): $my_query->the_post();          // Show results         }


title: Styling the second sidebar

text:
Ok so i added a second sidebar to my site, only problem is styling the widgets. here is the code i am using in my functions.php file               // Widgets plugin: intializes the plugin after the widgets above have passed snuff     function wpbx_widgets_init() {     if ( !function_exists('register_sidebars') ) {         return;     }     // Formats the theme widgets, adding readability-improving whitespace     $p = array(         'before_widget'  =>   '
',         'after_widget'   =>   "
\n",         'before_title'   =>   '
',         'after_title'    =>   "
\n"     );          register_sidebars( 2, $p );     }      I just don't know how to style the second sidebar widget, how do i do this? I want to use the same code but different class titles


title: Ordering posts by day (not time) AND meta value

text: I would like to have a list of posts that is first ordered by day, and then within that day ordered user votes (stored as a meta field). Would it be better to convert each timestamp to the day at the time of the query, or to create another meta field that stores the day? Or is there a better solution?


title: Looking for advice for a mail sending plugin

text: I would like to write a Wordpress plugin that sends one email every day for 7 days for newly registered users but I'm not sure how to start. My plan would be:   * hook the register function to send the first email after the user registers, send some users details to a custom table(for now the colums are just the user id and a counter with the number of emails sent)   * use a cron script that runs every 24h that would get data from that table and, if needed, send the emails and increment that counter Is there a better way to approach this?