title: Using gettext to translate wp-login.php can't translate `Back to` into other language

text: I created a plugin to translate text of wp-login.php page into Arabic, every thing translated well except `Back to` which appear at the bottom of login form, I can't catch it to translate into Arabic My site name called Foodonia, and I want to translate `← Back to Foodonia` to `العودة إلى فودنيا` , I tried each one of below:               ← Back to Foodonia     Back to     Back to Foodonia     ← Back to Foodonia     ← Back to      here is my code               function my_custom_login_label( $translated_text, $text, $domain ) {         if (in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) )) {              if ($translated_text === 'Username') $translated_text = 'اسم المستخدم';             if ($translated_text === 'Password') $translated_text = 'كلمة المرور';             if ($translated_text === '← Back to Foodonia') $translated_text = '← العودة إلى فودنيا';              return $translated_text;       }     }     add_filter( 'gettext', 'my_custom_login_label', 20, 3 );      My site URL: http://foodonia.com (changing language between English and Arabic using site nav menu will effect the login language)


title: Gallery order specified by shortcodes is ignored in gallery function

text:
I have the following gallery order in a shortcode:               [gallery ids="1996,2431,372,447,645,641,647,642,649,643,650,648,653,697,652,390"]      And I have this function, which creates a nicer looking gallery:               add_filter('post_gallery', 'pab_gallery');           function pab_gallery($attr) {              global $post;              extract(shortcode_atts(array(             //'order'      => 'ASC',             'orderby'    => 'menu_order DESC, ID ASC',             'id'         => $post->ID,             'columns'    => 3,             'size'       => 'thumbnail',             'include'    => '',             'exclude'    => ''         ), $attr));              $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => $orderby) );              #print_r($attachments);                   $output = '
';         $output .= '
';         foreach ( $attachments as $id => $attachment ) {             $link = wp_get_attachment_link($id, $size, false, true);             $output .= sprintf('
%s
', $link);         }              return $output.'

';     }      I have two problems with this: First of all, the order specified by ID is completely ignored, even though I pass "orderby". Additionally, image#1996 is also not displayed by the function, even though it's attached to the post (which I thought isn't necessary anyway when providing IDs to the short codes). This is the order I receive from the plugin :               Array ( [0] => 2431 [1] => 656 [2] => 652 [3] => 651 [4] => 648 [5] => 650 [6] => 643 [7] => 649 [8] => 642 [9] => 647 [10] => 641 [11] => 645 [12] => 629 [13] => 676 )      As you can see it's neither the order I specified using the shortcodes, nor is it in any way ascending or descending. I want the function to display the IDs in the exact order that they're specified in the shortcodes. Is this possible?


title: How to tune search argument in WP_Query to show only exactly the same results?

text: Right now I am using this:               $args_search = array(          's' => $search,         'post_type' => array( 'post' )     );          $wp_query = new WP_Query( $args_search );      But the problem is that it shows everything. E.g. if `$search` is just `"2386"` and I have in my db 3 posts: `"12386111"` `"23861111"` `"11112386"` I will get 3 results. But I want to get 0 results. because it's not a full match. Only if the search is `23861111` then I need to get the 1 result 23861111. Or when it is `11112386` I need to type the full `11112386` as a $search variable and not only 2386 or 238 to get the result `11112386` How to change my query to get the results as I want instead of everything that contains the search string?


title: Change "posts per page" depending on width

text: I'm working on a responsive theme. One part is a sort of news flow (blog). In desktop widths (above 767px) the news template is vertically divided in two. The left part is a navigation which lists titles and dates linking to the actual news item. The right part is where the content displays. "Posts page" is set to this page and "Posts per page" is set to 1, and thus the right content area displays one news item at a time. This vertically divided template structure works well in desktop widths but not so much on smaller widths. So for widths less than 768 I'm having a more traditional approach with the left nav part removed and the content displaying at 100% width (all through media queries). In a case like this "post per page" would be set to like 5-7 posts. So how can I change "posts per page" depending on sreen width? Or are there some other way to accomplish this?


title: hardened wordpress linux install

text: Are there any best practices for wordpress hardened install on Linux? I have recently had a WAMP server get malware attacked via word press so I want to harden the server up using read only apache permissions and move them and all future wordpress sites to Linux only the plan:   1. chown everything root:root -R so that apache can't write to anything    2. chmod so that only owner can write   3. chown only the uploads / updated files/ themes/ dirs of wordpress to apache: root this last bit is the bit I need help on, can you tell me which bits of auto- updatedness wordpress is likely to need? I have looked online and no-one is talking about this.


title: How to add functionality to an existing theme (using child themes)

text: The reason why I ask such a question isn't because I don't know how to do so at all, but rather I think the way I've trying to go about it may be wrong and that I don't understand how wordpress works well enough to know what is the best way to add functionality and custom fields to an existing theme. For example I have a theme for a website (a reverse auction project bidding theme) and a child theme was created so that of course changes could be made without changing the parent theme (for update/upgrade purposes). Now if I wanted to add a captcha box to an existing form, I know that I would have to change the files in the child theme (or use a plugin, which also requires a change to the file anyway). Now this is the bit where I get a bit confused, I know that template files get overriden if you have the same file name in the child theme. But what if the file isn't a template file? I read on some other answers here that unfortunately they dont get overriden, and that coincides with what I've been doing (only modifying the file in the parent theme makes a change to the actual website). The issue here is that there are many pages on the website which use one template and these other pages are just coded as normal html/php files. So my question can be asked in two ways, but I don't know which one is the right way: 1) If I wanted to add some php or html to these files (which can't be overriden), how would I do it. 2) or rather how can I get the file to be overriden in the child theme (when it is not a template file itself). As you can tell, I'm a wordpress beginner so I reckon I'm missing something basic and fundamental about how everything works. To be honest I don't even know if this is the best way to go about making changes to a website, I'm new to all this and it seems odd to me that one would use wordpress to make a website that isn't a blog and also that in order to add functionality to a website you have to change the theme. Sorry I haven't provided any code snippets, for one thing the theme was bought so I don't know whether I can show any of it, and secondly the question is more about concepts and the workings of wordpress. P.S. sorry for the long post.


title: Add inline HTML to posts published within last 24hrs

text:
Basically I'm looking to add this line of code to posts published within the last 24hrs:               New!      When the post is over 24hrs old, remove the inline HTML element. This is my code so far but have no idea how to implement this feature, anybody got any ideas?

<a href="<?php bloginfo( 'url' ); ?>/explorers">All

<a href="<?php bloginfo( 'url' ); ?>/category/stories" class="stories">Stories

<a href="<?php bloginfo( 'url' ); ?>/category/missions" class="missions">Missions

<a href="<?php bloginfo( 'url' ); ?>/category/questions" class="questions">Questions

                           <?php                 $temp = $wp_query;                 $wp_query= null;                 $wp_query = new WP_Query();                 $wp_query->query('posts_per_page=10'.'&paged='.$paged);                 while ($wp_query->have_posts()) : $wp_query->the_post();                 ?>                          <?php if (in_category(3)) {?>                          <article class="mission" id="post-<?php the_ID(); ?>">                         <a href="<?php the_permalink(); ?>">

<?php the_title(); ?> <?php echo get_the_date(); ?>
                                 <?php global $more; $more = 0; the_content(''); ?>

Accept

                          <?php } ?>                          <?php if (in_category(4)) {?>                              <article class="story" id="post-<?php the_ID(); ?>">                             <a href="<?php the_permalink(); ?>">                                     New!

<?php the_title(); ?> <?php echo get_the_date(); ?>

<?php the_field('author_details'); ?>

Read more

                          <?php } ?>                          <?php if (in_category(5)) {?>                              <article class="question" id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

                          <?php } ?>                      <?php endwhile;?>
                     <?php next_posts_link('Older Posts') ?>                     <?php previous_posts_link('Newer Posts') ?>
                                    <?php $wp_query = null; $wp_query = $temp; wp_reset_query(); ?>


title: Script to run at completion of Page Loading

text: On the home page I a have 2 lines of code I would like to run in JavaScript. Where should I put these two lines of code. Does WP have a specific way to do this. Or should I just pick the last .js file that loads and add it there?


title: meta_query with array as value

text: I am writing some PHP which allows users of my site to submit a form and query posts by their post_meta. Everything works fine except for one thing, I used Advanced Custom Fields to create the post_meta and ACF saves meta values as a serialized array. I need to keep the data in this format so ACF can pre-fill the custom fields in the admin panel. I need a way to compare an array of values (the user selects via checkboxes in the form) to a serialized array in the database. The first part of my query looks like the following, with $amenities being the array of checkbox values:               $the_query = new WP_Query(         array(             'post_type' => 'listing',             'meta_query' => array(                 array(                     'key' => 'distance',                     'value' => $distance,                     'type' => 'numeric',                     'compare' => '<='                 ),                 array(                     'key' => 'amenities',                     'value' => $amenities[0],                     'compare' => 'LIKE'                 ),                 array(                     'key' => 'amenities',                     'value' => $amenities[1],                     'compare' => 'LIKE'                 ),                 array(                     'key' => 'amenities',                     'value' => $amenities[2],                     'compare' => 'LIKE'                 )             )         )     );      The only way I can get the query to work is by querying for each possible value ($amenities[#]) the user could have entered in the checkboxes but this seems to be too cumbersome for my database to handle.


title: How to mark every 3rd post

text: I'm working on a WordPress site for my band and I'd like to mark every 3rd post on our blog page to have a special class applied to it, anybody have any pointers on how to achieve this? Any help is very very appreciated, thanks! rock n roll.


title: Style every four posts differently

text:
> **Possible Duplicate:**   >  How to mark every 3rd post Is it possible to style every four posts differently? I mean something like this:

1st post

2nd post

3rd post

4th post

     ...Repeat      I'm using cssgrid, so it would be great if I could experiment more with that.. :)


title: Style first 3 posts differently with WP_Query

text:
I've got the following code, which gets the first 3 posts. However, I am hoping to style each differently with `if statements`. But when I add `if statements` (to determine whether it is the first or second post), they are added, which on top of the first 3 posts: accidently creating 5 posts. Is there a proper way to style the posts depending on whether they are first, second and third, but keep within the `showposts => 3` attribute?                   <?php              $lifestyle_cat = array(             'category_name' => 'lifestyle',             'showposts' => 3,             'post_type' => 'post',             'post_status' => 'publish',             'orderby' => 'date',             'order' => 'DESC'         );              $lifestyle_query = new WP_Query( $lifestyle_cat );         if ( $lifestyle_query->have_posts()) {             $i = 0;              while ( $lifestyle_query->have_posts()) {                  $i++;                 $lifestyle_query->the_post();                     if ($i==1) { // these are added and not within the 3 show posts                        ?>
 <?php  the_title();?>  i = 1
 <?php                     } elseif ($i==2) { // these are added and not within the 3 show posts                          ?>
 <?php  the_title();?>  i = 2
 <?php                     } ?>
<?php the_title(); ?>
          <?php } } else {             // no posts found         }              wp_reset_postdata(); ?>


title: Split archive results in rows and columns

text: > **Possible Duplicate:**   >  How to mark every 3rd post I want to redesign my Archives template, so I want do display posts from archive in 3 columns and 6 rows. I have the following code:               <table width="100%" border="0" cellpadding="4" cellspacing="3" bgcolor="#CCB294">                    <?php                   rewind_posts();             if (have_posts()) {                 while (have_posts()) : the_post();                 global $post;                     include(TEMPLATEPATH. '/includes/templates/loop.php');                     $postcount++;                 endwhile;             } else {                 include(TEMPLATEPATH. '/includes/not-found.php');             }              ?>      but the code is displaying in one row and many moore columns. How can I force the code to display as I wwant? Thank you.


title: Wordpress custom post type odd and even styling

text:
I've got a custom post type that I would like to be able to show in the following: is this possible using the following code:               <?php query_posts(array('post_type' => 'story', 'orderby' => 'title', 'order' => 'asc', 'post_status' => 'publish', 'paged' => $paged)); ?>          <?php if ( have_posts() ) : ?>      <?php /* Start the Loop */ ?>     <?php while ( have_posts() ) : the_post(); ?>          <hgroup>
       <?php the_title(); ?>
     </hgroup>

       <?php the_post_thumbnail(184, 260); ?>

     <?php the_content(); ?>
<?php the_tags(); ?>


title: Apply class to every third list item?

text:
> **Possible Duplicate:**   >  How to mark every 3rd post I'm trying to give a class to every third list item on my page. I know how to give a class to every item, but not to specific items in a row, or in my case - the third. This is the code I am using:               <?php                 $pages = get_pages('child_of=10');                 if ($pages) {                     echo '
';                     foreach ($pages as $page) {                         echo '
ID).'">';                         echo get_the_post_thumbnail($page->ID);                         echo '';                         echo get_the_title($page->ID);                         echo '';                         echo '
';                     }                     echo '
';                 }                 ?>      I know I need to use a counter (and probably something to reset it after each third list item) but I am unsure of how to code this logic in PHP. Can anyone assist? Thanks


title: Styling every second Post differently?

text:
I wanted to style every second post inside of a query post and I found a solution which nearly works. the thing is: it outputs just two posts (older ones will be igrnored) but i want to output ALL posts but with every second one with a sepcific class. Here's what i did so far…               <?php     $paged = (get_query_var('paged')) ?   get_query_var('paged') : 1;     $wp_query = new WP_Query();     $wp_query->query('posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);                      global $wp_query;                             query_posts(array_merge($wp_query->query, array(                                 'paged'          => get_query_var('paged'),                                 'posts_per_page' => 9999999                             )));                     ?>     <?php if ($wp_query->have_posts()) : ?>     <?php $count = 0; ?>     <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>     <?php $count++; ?>          <?php if ($count == 1) : ?>

           <?php elseif ($count == 2) : ?>

           <?php endif; ?>     <?php endwhile; ?>     <?php endif; ?>


title: Woocommerce Product Categories shows invalid sub-category

text: I'm going to try my very best to explain the issue I'm experiencing. When using the widget "woocommerce product categories", I select only "Only show children for the current category". Next, when I view the widget, I see the following: ![enter image description here](http://i.stack.imgur.com/h2ekM.png) The sub-categories for Video Games/Xbox 360 are shown as expected, but one additional sub-category seems to have snuck in: Second Hand. This category is not a sub-category of Xbox 360 and is a stand-alone category. If I switch on "show hierarchy" it shows as a category above Xbox Games, see the following: ![enter image description here](http://i.stack.imgur.com/eUecb.png) This one additional (non-related) sub category seems to sneak into every single page I use the "woocommerce product categories" widget in. What is causing this and how can I remove it? Thanks in advance for your suggestions!


title: How do I add nested categories to drop-down menu in twenty-eleven?

text: I know how to do it by writing a separate ul/li css for wp_list_categories, but I find menus of "twenty eleven" already well designed and flexible, so I`d like to use them. Custom menus, when I have to add subcategories manually, are not a solution, sinse I will allow my users to create new categories. What would you do?


title: Fatal error: Call to undefined function register_new_user()

text:
Have a wordpress theme with custom registration. Registration works on the registration page. If I take the form and place it on another page , eg. Homepage.. it gives me this error. Here is the code for my form               // Form
                    <?php if(edd_get_errors()){?>

<?php __( 'Please review the following issues that occurred', 'forest' ); ?>

                           <?php forest_print_errors();?>

                     <?php } else if(isset($_GET['success']) && $_GET['success'] == "ok") {?>

<?php echo __( 'Thank you, You will receive your new password via email.  For security, please change this upon login', 'forest' ); ?>

                     <?php }?>

                             <?php if (get_option('users_can_register')){ ?>                                                  <form id=""  class="horizontal-form" action="" method="post">                                               <fieldset>
                                                                     <?php echo __( 'Username', 'forest' ); ?>:
                                                                       <input name="user_login" id="user_login" class="required" type="text" value="<?php echo isset($_POST['user_login']) ? esc_attr(stripslashes($_POST['user_login'])):''; ?>"/>

                                                                     <?php echo __( 'E-mail Addy', 'forest' ); ?>:
                                                                       <input name="user_email" id="user_email" class="required" type="text" value="<?php echo isset($_POST['user_email']) ? esc_attr(stripslashes($_POST['user_email'])):''; ?>"/>

                                                                      <?php echo __( 'The password will be e-mailed to you.', 'forest' ); ?>

                                                                      <input type="hidden" name="edd_redirect" value="<?php bloginfo('url') ?>/wp-login.php?action=register&success=ok"/>                                                                     <input type="hidden" name="edd-registre-nonce" value="<?php echo wp_create_nonce( 'edd-registre-nonce' ); ?>"/>                                                                     <input type="hidden" name="edd_action" value="user_registre"/>                                                                     <button type="submit" class="btn-icon submit"><?php echo __( 'Create Account', 'forest' ); ?></button>
                                                          </fieldset>                                         </form>                                          <?php } else {?>
<?php echo __('Registration is closed','forest'); ?>

<?php echo __('Sorry, you are not allowed to register by yourself on this site!','forest'); ?>

<?php echo __('You must either be invited by one of our team member or request an invitation by email.','forest'); ?>
                                     <?php }?>

      and here is the code for the function               function forest_process_registre_form( $data ) {             if ( wp_verify_nonce( $data['edd-registre-nonce'], 'edd-registre-nonce' ) ) {                          $errors = register_new_user($data['user_login'], $data['user_email']);                     if ( isset($errors) && is_array($errors) ){                             foreach($errors as $error) {                                     if(count($error) > 0) {                                             foreach($error as $e) {                                                     edd_set_error( 'email_incorrect', $e[0]);                                             }                                     }                             }                     }                     // Check for errors and redirect if none present                     $errors = edd_get_errors();                     if ( ! $errors ) {                             $redirect = apply_filters( 'edd_login_redirect', $data['edd_redirect'], $user_ID );                             wp_redirect( $redirect );                             exit;                     }             }     }     add_action( 'edd_user_registre', 'forest_process_registre_form' );      Full function code here Why won't register_new_user() work if the form is placed anywhere else?


title: Problem storing arrays with update_user_meta

text: I am writing a function that adds an ID number to an array and puts the array in the usermeta. $_GET['auction'] is the post_id. Here is the function:                       $reminders = get_user_meta($current_user->ID,"reminders");             print_r($reminders);             if(in_array($_GET['auction'],$reminders)) {                 echo "Failed: Auction already in list";             } else {                 array_push($reminders,intval($_GET['auction']));                 if(update_user_meta($current_user->ID,"reminders",$reminders)) {                     echo "Success";                 } else {                     echo "Failed: Could not update user meta";                 }             }             print_r($reminders);      Here is the output after adding one auction:               Array ( )      Success     Array ( [0] => 7 )       Here is the output after adding two auctions:               Array ( [0] => Array ( [0] => 7 ) )      Success     Array ( [0] => Array ( [0] => 7 ) [1] => 73 )      And here is the output after adding three auctions:               Array ( [0] => Array ( [0] => Array ( [0] => 7 ) [1] => 73 ) )      Success     Array ( [0] => Array ( [0] => Array ( [0] => 7 ) [1] => 73 ) [1] => 0 )      Notice that adding a new element to the array using array_push works fine. But when the array is stored in the usermeta then retrieved again, the last element in the array has been put into an array of its own, creating an infinitely dimensional array. I'd prefer to keep this array one dimensional. Is there a way I can run update_user_meta and get_user_meta without it changing the structure of my array?


title: List 'n' number of posts from a Tag, each with a different class or ID

text: I want to list 'n' number of posts (ordered by latest first) -- post's title linked to the post's permalink -- from a tag on my WordPress blog. I also want to assign each link its own class or ID. I checked this doc on WordPress Codex, which is very relevant to what I need, but makes little sense to me (and I'm therefore unable to modify it to my needs). Hope I am clear enough, if not, I can try to clarify. **EDIT:** Just so it's clear, I want to be able to list the posts wherever I want. Any template.


title: How to add a sub menu with AJAX?

text: What i want to do is fire up the `add_submenu_page()` function from within ajax on my plugin options page. When i click an "Add League" link, i want to display an ajax input[text] that will save into the database, then add the submenu page using the values that have been inserted. I am also hoping to be able to delete the entry as well as the newly created page.


title: How to list events by category and month with plugin Event Organiser?

text: I need to display a list of events by category and month. For example I need to list all the Mountain Bike events in July.


title: Loop not appending through infinite-scroll ajax call

text:
I'm having trouble debugging why the InfiniteScroll jQeury plugin isn't loading more of my .boxy class items. So far I've placed the div containing the selectors in different levels of heirarchy, but this isn't working to suss out any console errors.

                      <?php if (have_posts()) : ?>                     <?php while (have_posts()) : the_post(); ?>

                                 <?php echo time_ago(); ?>

                             <a href="<?php if(get_post_meta($post->ID, "url", true)) echo get_post_meta($post->ID, "url", true); else the_permalink(); ?>" rel="<?php the_ID(); ?>"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

                                     <a href="<?php if(get_post_meta($post->ID, "url", true)) echo get_post_meta($post->ID, "url", true); else the_permalink(); ?>" rel="<?php the_ID(); ?>"><?php the_title(); ?>

                       <?php endwhile; ?>                      <?php endif; ?>

                             Load more

      Here is the code I've found to be the most elegant so far for the InfiniteScroll jquery plugin:               $(document).ready(function($) {             var $container = $('#articlePost');          // infinitescroll() is called on the element that surrounds     // the items you will be loading more of       $container.infinitescroll({              navSelector  : $('#nav-below'),                // selector for the paged navigation          nextSelector : $('#nav-below a'),                        // selector for the NEXT link (to page 2)         itemSelector : $('#articlePost'),                        // selector for all items you'll retrieve       },         // trigger Isotope as a callback         function( newElements ) {           // hide new items while they are loading           var $newElems = $( newElements ).css({ opacity: 0 });           // ensure that images load before adding to Isotope layout           $newElems.imagesLoaded(function() {             // show elems now they're ready             $newElems.animate({ opacity: 1 });         $container.isotope( 'appended', $newElems );           });         }       );     });


title: Allow Authors to edit all their own comments, even on others' posts

text: I recently found on my multiuser WordPress site that people with Author access can edit their own comments only if they are commenting on their _own_ posts. As far as I know, this is all the edit_post capability allows them to do. I want them to be able to edit all the comments they have written, on _others'_ posts as well. This post mentions the edit_comment capability, which sounds promising, but the questions didn't actually clarify whether that actually allows authors to edit all their comments, or only those on their own pages/posts. If a user has edit_comment privilege, can she edit a comment she wrote on someone else's post? I would prefer to do this through a reliable plugin if that's possible, so I don't have to worry about things breaking on the back end - I don't have a lot of time to maintain this site. (Does User Role Editor allow edit_comment? The screenshots don't show it.) But if the only way to do it is through editing the PHP, it's worth knowing that too.


title: how do you use Wp-cli on Shared Hosting?

text: I Have Godaddy Deluxe linux hosting it is shared server, so I don’t have the root password of the machine. I can create, move and delete files via SSH in my home folder but not in the root directories like /opt /etc.               curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar          php wp-cli.phar --info          chmod +x wp-cli.phar          sudo mv wp-cli.phar /usr/local/bin/wp      I am not able to execute the `sudo` command. Can anyone gives me alternate way for installing it?


title: Use radio buttons & checkboxes for post categories

text: For my users, I need them to be able to have both radio buttons and checkboxes in the categories when posting. I have seen a solution to make the checkboxes when selecting a category radio buttons, so that a user can only ever choose 1 category. However, I have a scenario where two categories are mutually exclusive and the rest are a free for all. So, the user MUST choose between category A/B. But can then have free choice of categories C/D/E/F/G/H, ETC Is there a way to do this? Thanks, Ian


title: Copy wp_postmeta from one database to another

text: I had a site setup on old-domain.com, which used the database old_db. Recently, we had to migrate our website to a new server and domain, new- domain.com which uses the database new_db. I installed a fresh copy of wordpress to the new server, and using the wordpress import tool I was able to import all my posts to the current setup.The images did not copy over, so I simply copied over the wp- content/uploads folder to the new setup, and fixed the image urls using the plugin Search And Replace Now the issue is, I have all posts appearing proper with images and everything. Everything except Featured Images. The site is not showing any featured images whatsoever. I was told that I need to copy over the postmeta data from old database to new one in order to correctly link them. Both databases are on the same server. Any help would be hugely appreciated.


title: get posts from 2 categories. (2 posts)

text:
I have a custom post (it's called "items") and 2 categories there.   1\. on category page, I need to get posts which belong to 2 categories. get posts from category1="Food" and category2="featured" How can I get these posts from 2 categories? This is what I have been doing is.... I just got posts from "FOOD" like this. at the same time, I also need to get "featured" from "cate-type2". I am new here so I have no idea how to put html, php codes.. :) * * *               global $post;     $tmp_post = $post;     $args = array(         'posts_per_page'  => 5,         'post_type' => 'item',         'tax_query' => array(             array(                 'taxonomy' => 'cate-type1',                 'field' => 'id',                 'terms' => 39 // Food taxonomy id             )         )     );          $myposts = get_posts( $args );          foreach( $myposts as $post ) : setup_postdata($post); ?>      * * * ADDITION CODE: relation and AND      so I need to get posts from   tax1 : item-special (cate id: 6)   tax2 : item-category (cate id: 39)   * * * ` $custom_terms = get_terms('item-special'); $other_custom_terms = get_terms('item-category'); foreach ($custom_terms as $custom_term) { foreach ($other_custom_terms as $other_custom_term) { wp_reset_query(); $args = array('post_type' => 'item', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'item- category', 'field' => 'id', 'terms' => 6 ), array( 'taxonomy' => 'item- special', 'field' => 'id', 'terms' => 39 ), ), );                $loop = new WP_Query($args);      if($loop->have_posts()) {         echo '
'.$custom_term->name.'
';              while($loop->have_posts()) : $loop->the_post();             echo '
'.get_the_title().'
';         endwhile;      }      } } ## ` I think I have little problems with this code. it shows but duplicated and all item posts. how should I fix it? Thanks,


title: restricting the number of character for permalink

text: I have this code to set the number of characters in URL more than 20 word, But i try this and not work, Where are the problem.               add_filter( 'sanitize_title', 'wpse52690_limit_length', 1, 3 );          function wpse52690_limit_length( $title, $raw_title, $context ) {         //  filters         if( $context != 'save' )             return $title;              //  vars         $desired_length = 100; //number of chars         $desired_words = 50; //number of words         $prohibited = array(             'the'             ,'in'             ,'my'             ,'etc'             //put any more words you do not want to be in the slug in this array         );              //  do the actual work         // filter out unwanted words         $_title = explode( ' ', $title );         //if you want more than one switch to preg_split()         $_title = array_diff( $_title, $prohibited );         // count letters and recombine         $new_title = '';         for( $i=0, $count=count($_title); $i<$count; $i++ ) {             //check for number of words             if( $i > $desired_words )                 break;             //check for number of letters             if( mb_strlen( $new_title.' '.$_title[$i] ) > $desired_length )                 break;                  if( $i != 0 )                 $new_title .= ' ';             $new_title .= $_title[$i];         }              return $new_title;     }


title: Media uploader edit image direct in edit-psot view

text: I want to make available to edit custom fields (its gallery) direct in edit- post view. Im using ACF plugin so I have this view: http://grabilla.com/04906-95db6a64-4c3f-497a-b312-67fff32ab21f.html I need to integrate media uploader editing direct in this table Any ideas?


title: using jQuery Cycle by Malsup with WordPress Page and Gallery

text: I would like to modify a WP Gallery to use the jquery cycle plugin by malsup. I know this is possible but would like to know best practice for this, if anything just pulling out the url for each image should give me enough to work with. Please advise on best practice for this. Note I do not want to use a plugin and would like to build this site on WP Core.


title: How to get my loop to paginate?

text:
Below is a snippet of code that appears on one of my pages called: Featured. I created a template and then respectively created a page and activated the template in the wp-admin. However when I click the button to paginate to page 2, which looks something like: http://example.com/featured/page/2 the next page shows up blank with no content (and I have plenty of content in the respective categories to display.) Any ideas what could be wrong here? Let me know if you need further clarification with my issue and/or code. ### All Features                    <?php         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args = array(                 'post_type'=> 'post',             'category_name' => 'featured-content, podcast',             'posts_per_page' => 10,             'paged'=> $paged         );         $temp = $wp_query;         $wp_query = null;         $wp_query = new WP_Query($args);         if (function_exists('wp_pagenavi')) { wp_pagenavi(); }         if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();     ?>          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>         <a href="<?php the_permalink(); ?>">             <?php the_post_thumbnail('featured'); ?>

<?php the_title(); ?>

By <?php the_author(); ?>

               <?php endwhile; endif; ?>                    <?php if ($wp_query->max_num_pages > 1) : ?>         <?php next_posts_link( __( '← Older' ) ); ?>         <?php previous_posts_link( __( 'Newer →' ) ); ?>     <?php endif; ?>               <?php     /* PageNavi at Bottom */         if (function_exists('wp_pagenavi')){wp_pagenavi();}         $wp_query = null;         $wp_query = $temp;         wp_reset_query();     ?>


title: Contact Form 7: custom validation

text: I'm currently using the Contact Form 7 plugin, which is great and works perfectly, but what I'm now trying to achieve with it is some custom validation rules.   I found this extension: http://code-tricks.com/contact-form-7-custom- validation-in-wordpress/ that once added to `functions.php` adds a whole raft of extra validation rules.   For example:               $acceptNumbers = array('acceptNumber', 'acceptNumber1', 'acceptNumber2', 'acceptNumber3', 'acceptNumber4', 'acceptNumber5', 'acceptNumber6');          foreach($acceptNumbers as $acceptNumber){         if($name == $acceptNumber) {             $acceptNum = $_POST[$acceptNumber];                  if($acceptNum != '') {                 if(ctype_digit($acceptNum)) {                     $result['valid'] = true;                 } else {                     $result['valid'] = false;                     $result['reason'][$name] = 'Please Enter Only Numbers';                 }             }         }     }      Called in the short code like so: `[text* acceptNumber]` but what I want to validate is quite specific and I'm not sure how it'll be achieved. I'll have 1 text field, I want it to contain ONLY one word, anything more than one word won't be accepted, and this one word MUST begin with the letter `s`. I'm not even sure if this is at all achievable, any suggestions would be greatly appreciated!


title: Using Wordpress public query variables

text: Good morning. I am trying to query various Wordpress pages, using public query variables, for example               http://dmkim1979.ru/?p=37                   //  single post     http://dmkim1979.ru/?page_id=40             //  single page      But I don't understand how to use most of these variables. And I cannot find complete information about the subject anywhere. The complete list of public query variables is               var $public_query_vars = array(           'm', 'p', 'posts',            'w', 'cat',            'withcomments', 'withoutcomments',            's', 'search', 'exact',                     'sentence', 'calendar', 'page',            'paged',            'more',            'tb', 'pb',            'author', 'order', 'orderby',            'year', 'monthnum', 'day',            'hour','minute', 'second',            'name', 'category_name',            'tag', 'feed',            'author_name', 'static',            'pagename', 'page_id', 'error',            'comments_popup',            'attachment', 'attachment_id',            'subpost', 'subpost_id',            'preview', 'robots',            'taxonomy', 'term', 'cpage',                      'post_type');      and I managed to figure out intuitively the usage of part of them such as                   http://dmkim1979.ru/?p=37                   //  single post         http://dmkim1979.ru/?page_id=40             //  single page         http://dmkim1979.ru/?paged=4                //  page 4 of 10 in archive              http://dmkim1979.ru/?m=201310               //  10-2013 archive         http://dmkim1979.ru/?monthnum=10            //  month 10 archive         http://dmkim1979.ru/?year=2013              //  year archive         http://dmkim1979.ru/?day=12                 //  daily archive (current year and month)              http://dmkim1979.ru/?cat=3                  //  category archive         http://dmkim1979.ru/?tag=tag4               //  tag archive         http://dmkim1979.ru/?rating=rating4         //  custom taxonomy archive         http://dmkim1979.ru/?post_type=tickets      //  custom post type archive         http://dmkim1979.ru/?author=1               //  author archive by id         http://dmkim1979.ru/?author_name=admin      //  author archive by name         http://dmkim1979.ru/?s=uuu                  //  search archive         http://dmkim1979.ru/?error=404              //  page not found         http://dmkim1979.ru/?feed=rss2              //  output feed      but the others remain mysterious, such as               'posts', 'w', 'withcomments', 'withoutcomments', 'search', 'exact',               'sentence', 'calendar', 'page', 'more', 'tb', 'pb',      'order', 'orderby',      'hour','minute', 'second',      'name', 'category_name',            'static',      'pagename',      'comments_popup',      'attachment', 'attachment_id',      'subpost', 'subpost_id',      'preview', 'robots',      'taxonomy', 'term', 'cpage'      can anybody please shed some light on how to use them? (Sorry for my English.)


title: Customizer - Update colour picker value based on currently selected radio

text: been scratching my head over this one and think I need a little help basically im trying to change the current value for a colour picker (in this case the body bg) based on the currently selected radio option I have already got the radio working and updating in the live preview, but i want this change to also reflect on a separate colour option Anyone know how to do this? Currently the colour pickers are disabled unless the user selects custom colour on the radio field and think the above would be a lot more elegant thanks, Danny


title: remove_action conditionally for Custom Post Type

text: By default, my theme is showing an author box below my posts. I am using a custom post type, and would like to remove this author box only on this post type. Here is how the theme is calling the author box:               add_action( 'wp_head', 'woo_author', 10 );          if ( ! function_exists( 'woo_author' ) ) {     function woo_author () {         // Author box single post page         if ( is_single() && get_option( 'woo_disable_post_author' ) != 'true' ) { add_action( 'woo_post_inside_after', 'woo_author_box', 10 ); }         // Author box author page         if ( is_author() ) { add_action( 'woo_loop_before', 'woo_author_box', 10 ); }     } // End woo_author()     }      Here is the function I have tried to remove the post author box from the `wpseo_locations` single posts, but it is not working:               add_action('init', 'kiwi_remove_post_author_box');           function kiwi_remove_post_author_box () {         if (is_singular('wpseo_locations')  ) {             remove_action( 'woo_post_inside_after', 'woo_author_box', 9 );         }       }      I have also tried:               add_action('init', 'kiwi_remove_post_author_box');           function kiwi_remove_post_author_box () {         if ( 'wpseo_locations' == get_post_type() ) {             remove_action( 'woo_post_inside_after', 'woo_author_box', 9 );         }       }      I cannot seem to get that box to go away. I know that there is a check box in the theme options panel that will make it go away globally, but I want it removed only for this post type. Any help would be greatly appreciated.


title: Shortcode add styles to the <head>

text: I have shortcodes that has option for :hover color. Is there a way to include styles in the head of a page for each shortcode element to change its hover color? There can be any amount of this shortcode elements with different options anywhere on site pages. shortcode e.g.               [element color='#666666' hover_color='#111111']element text[/element]


title: wp_query inside the_loop

text: I am having this issue with my loops. I am making a shortcode that will be called from the main query. It will display on the front page from the_loop. for some reason that I can't figure out. The second query displays only one post when it should display 3. So the shortcode will go in the page content. In the settings section, I have the front page set as static to "Home" and the blog page set to "Blog" but home is not a template. It is being generated by the index.php page using WordPress 2014 theme. So in the "Home" page content area, I have the shortcode that generates the second loop to get 3 posts from a category called "featured".                $featured = new WP_Query( array( 'category_name' => $category, 'posts_per_page' => 3 ) );        if( $featured->have_posts()) : while( $featured->have_posts()): $featured->the_post();      global $more;      $more = 0;           the_title();           the_content( '' );          endwhile; endif;     wp_reset_postdata();      This loop will display the first of the three posts but not the other two. I also tried using get_posts but that didn't work out any better


title: Get a list of all Widgets registered in WordPress admin widgets-area

text: I'm trying to disable a couple standard widgets in my theme `functions.php`. Therefore I wrote this little function, which works well:               function my_widget_ctrl() {          unregister_widget('WP_Widget_Pages');          unregister_widget('WP_Widget_Calendar');          unregister_widget('WP_Widget_Archives');          unregister_widget('WP_Widget_Links');          unregister_widget('WP_Widget_Meta');                  unregister_widget('WP_Widget_Text');                 unregister_widget('WP_Widget_Recent_Posts');          unregister_widget('WP_Widget_Recent_Comments');          unregister_widget('WP_Widget_RSS');          unregister_widget('WP_Widget_Tag_Cloud');                   }      add_action('widgets_init', 'my_widget_ctrl', 11);      Now I want to disable some other Widgets, which may be installed/activated by other Plugins. But I don’t know how to get a list of all widget-class-names registered, so I can unregister them with `unregister_widget()`?


title: Wordpress main site and sub domain

text: WordPress site is configured in IIS for which i have updated the permalink structure to be www.testing.com/company, www.testing.com/products, etc... I do have another site which was created in the IIS, but the URL of the site is print.testing.com/printing, but whenever i access this print.testing.com site, WordPress site is getting connected, but not the actual site. does anyone know know to update the permalink structure / the host header so that the site redirects works correctly?


title: IF Inside A Function For Content Filter

text: Trying to use a filter for post content. But how do i make an IF work inside the function.               <?php function my_the_content_filter($content) {       } add_filter( 'the_content', 'my_the_content_filter' ); ?>      So i need to add this inside of it.               <?php if (get_post_meta($post->ID, "heading_image", true)) : ?>             <img src="<?php $image_id = get_post_meta($post->ID, "heading_image", true);          $post_image_data = wp_get_attachment_image_src( $image_id, $size='full' );                echo $post_image_data[0]; ?>" style="max-width:1000px;" />          <?php endif; ?>      I cant seem to format it correctly.


title: Multiple sites/domains on one database

text: I looked through the questions and answers but could not find a specific answer that matched my question 100%. I have developed many themes/child-themes/plugins/etc for a long time. I know my way around most WP related stuff. But now I'm a bit stuck with a challenge here. What I want to acheive is:   1. Have 2 different domains   2. Both sites share the same theme   3. Both sites share the same posts/news, but some post only appear on the other (categories, perhaps)   4. Both sites share 'some' of the content. 2 sites, same db, different contact details, different logos, all content more or less the same except for like the footer and contact details. How is this done in the easiest way?


title: how to create child WordPress plugin

text: I like to create child plugin.. Explanation :- I have one parent plugin named X. This will work independently (like other existing plugins). Now I decided to add some extra features to that plugin X (think of it as an upgrade). So I want to create extra features by way of another plugin Y, which will depend on (and inherit from) X.   This plugin Y will not work with out plugin X. How can I do this?


title: Find Total Authors

text: Please suggest a code snippet to get the total number of authors on a blog who have at least one published article. Thanks


title: I have a self hosted blog but now the WordPress.com stats plugin has stopped working

text: I've got a self hosted blog and yesterday (18th March) the stats package stopped working. I'm getting the message: > Your WordPress.com account, [account] is not authorized to view the stats of > this blog. where `[account]` is the name of my Wordpress.com account. I deleted and reinstalled the plugins package and got the following message when I entered my API key: > The API key "[apikey]" belongs to the WordPress.com account "[account]". If > you want to use a different account, please enter the correct API key. > > Note: the API key you use determines who will be registered as the "owner" > of this blog in the WordPress.com database. Please choose your key > accordingly. Do not use a temporary key. The recommended action is to "Recover stats" The other choice is to recover the stats of my blog. However, what ever I do results in the same error. If I log into Wordpress.com with [account] I get an error message: > **You are not a member of this site.** This is the only account I have registered with WordPress.com. How do I link my blog back to WordPress.com? I should add that I'm am running WordPress 3.1.


title: Making oEmbed work on the excerpt field

text: How can I make oEmbed work on the excerpt field so I only have to paste the youtube url in there and then be able to echo 'get_the_excerpt()'? I also want to filter oEmbed and change the wmode but I think I found a solution for that here: http://code.hyperspatial.com/all-code/wordpress- code/oembed-wmode/ EDIT: Crap! I was wrong, it doesn't work at all, nothing happens. Anyone got a better solution?


title: How can I update the role of a newly added user when displaying the registration form with a shortcode?

text: Basically I have a shortcode that includes a registration form(among other things). The custom form itself is also included on `wp-login.php` and `user-new.php` if the default role is set to `my_custom_role`. I want to make sure that when new users subscribe via this custom form, in the case when it is rendered by the shortcode, they have their role set to my custom role regardless of what the `default_role` is set to inside my class the code related to this is: so far I have               _construct() {         global $pagenow;              add_shortcode( 'my-shortcode' , array( &$this, 'my_shortcode' ) );              $custom_is_default_role = get_option('default_role') == 'my_custom_role' ? true:false;              // Include custom registration Form and Components              if ( $custom_is_default_role && $pagenow == 'user-new.php' || $custom_is_default_role && $pagenow == 'wp-login.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'register') {           $this->load_registration_components();         } else { // check for shortcode           add_filter('the_posts', array( &$this, 'shortcode_check' ));         }     }          // Check early on if [my-shorcode] is present on the page     public function shortcode_check($posts){         if (empty($posts)) return $posts;         $has_my_shortcode = false;         foreach ($posts as $post) {             if (stripos($post->post_content, '[my-shortcode]') !== false) {                 $has_my_shortcode = true;                 break;             }         }         if ( $has_my_shortcode ) {           $this->load_registration_components();           add_action('user_register' , array(&$this, 'update_custom_role'));              }         return $posts;     }     // Update the user role to my_custom_role     public function update_custom_role($user_id) {         //THIS ACTION NEVER TRIGGERS!         $roles = array( 'my_custom_role' => true );         update_user_meta( $user_id, 'roles', $roles);     }     public function load_registration_components() {         // Registration form         add_action('register_form', array(&$this, 'custom_register_form') );         add_filter('registration_errors', array( &$this, 'custom_registration_errors'), 10, 3);         add_action('user_register', array( &$this, 'custom_save_user_meta')); // YET THIS ONE FIRES FINE!        }     // Render shortcode html for logged out users and my_custom_role users     public function my_shortcode() {         $current_user = wp_get_current_user();         $roles = $current_user->roles;         if ( in_array('my_custom_role', $roles) || $current_user->ID === 0 ) {             add_action( 'wp_footer', array( $this, 'enqueue_styles' ) );             add_action( 'wp_footer', array( $this, 'enqueue_scripts' ) );             ob_start();             include('views/public.php');             $html = ob_get_clean();             return $html;         }     }


title: Creating tags via API

text: I'm working on using the WP API to insert posts via AJAX. What's the proper way of adding tags dynamically to a custom post type? These tags would not be predefined, but rather be created on demand by the user. Currently I'm doing this:                           $tags = explode(" ", $_POST['post_tags']);                  $new_entry = array(                 'post_title' => $_POST['post_title'],                 'post_content' => $_POST['post_content'],                 'post_status' => 'publish',                 'post_author' => $current_user->ID,                 'post_type' => 'customposttype',                 'post_tags' => $tags);                  $created = wp_insert_post( $new_entry );      (Yes, this is prototype code and I'm not sanitizing input yet :))


title: Two-level multisites in WordPress

text: I'm wondering if there is a way to implement something like sub-multisites, like parent-child multisite relation. So, what i want is a way to have something like this:               /site1     /site1/subsite1     /site1/subsite2     /site2      etc... My approach has been use mod-rewrite to change from /site1-subsite1 to /site1/subsite1 meaning that I'm aware of the permanlinks changes, etc... I will like to know if there is a more cleaner way to achieve this. Thanks in advance.


title: Current navigation highlight for a menu that may be modified by the user?

text: I'm using the following to list my pages:               <ul id="nav">        <?php wp_list_pages('title_li='); ?>     </ul>      is there a way of highlight the link of the page of the current in the navigation. It shouldn't be fixed. The user should be able to call the page whatever he or she wants, and create as much pages as he or she wants (the highlight feature should still work). Any suggestions or tutorials?


title: Remove permalink for custom post type

text: I have multiple custom post types and custom taxonomies, "staff", "games", which have the permalinks:               domain.com/staff/%staff-name%     domain.com/games/%game-name%      However, I'm only using these custom posts to store data and am displaying it collectively on different pages. How do I get the paths, such as, /staff/%staff-name% to redirect to the 404 page? Thanks!


title: Add new image size to media uploader so users can insert into post?

text: I would like to create an additional size for uploaded images which my users can then "insert into post". I understand that add_image_size() will add a new image size which I can use in my theme, but that new size isn't available on the media upload screen. Is there a way to get new sizes to appear on that screen so they're available to people as they add/edit posts? I have a tweaky theme that needs more than just the default 3 sizes + original. Thanks!


title: Single Wordpress Installation with Sub domains

text: I have installed buddypress within a wordpress blog. now my client wants to use domain like "forums.ourdomain.com" & "groups.ourdomains.com" to point buddpress forums that are installed within my wordpress blog. is that possible? actually my client dont want to install a new copy of wordpress for these sub domains and want to handle everything through single installation. any one guide me is that possible if yes then how? any help would be appreciated.


title: How can I make the descriptions in the category pages not become meta descriptions?

text: I have a category, and all the page descriptions are showing up on the pages, which is what I wanted, but they are also showing up as meta page descriptions. So I am ending up with 2 meta descriptions for every page: these and the ones I made with Yoast. How can I just have the ones made with Yoast be the only meta descriptions on the pages?


title: Is there any plugin hook that I can latch onto once a site is freshly installed?

text: To customize a fresh new WP install, there are a bunch of pluginable functions that can be overridden. Namely `wp_install()` and `wp_install_defaults()`. And `wp_new_blog_notification()`. I'd like to override a couple of default options without needing to keep custom versions of the latter in sync with core in my `wp-content/install.php` file. I'm not finding any obvious hook to do so in the `wp-includes/upgrade.php` file, however. Might I be missing anything? * * * Edit: so, the `pre_option_$option_name` is valid for options. Is there another, or some not-too-twisted procedure, that would allow to auto-enable permalinks, including (important) writing to the htaccess file as needed?


How can I store an array of all the terms existing? (for admin use)               $taxonomy = 'MYTAXONOMY';      $tax_terms = get_terms($taxonomy);          foreach ($tax_terms as $tax_term) {                echo  $tax_term->slug ;          }      seems to only work from template files, but I would like to store this array in functions.php for using in a tinyMCE select box.


title: submit extra content to wordpress post by my editors

text: i have a site where my authors post articles i want to find a way where other authors can submit a content to the post which already posted every new post , some editors may want to add extra content or comment on the bottom of the article so i need to find a way to do this ***** WITHOUT any needy of editing the post from dashboard ! i need something like a commenting system , but the content which will be submitted will be added to the bottom of the post ! even if it will be a a paid work :P


title: How to enable http (not just https) in wordpress?

text: My wp-config.php file contains               define('FORCE_SSL_ADMIN', false);      but all my permalinks are https: by default. ![enter image description here](http://i.stack.imgur.com/1MRdM.png) I want the site to be accessible by http. What do I need to change please?


title: How to make a cronjob type plugin

text: Hi i am new on wordpress and has been given a task to make such a script that will fetch posts by categories and shoot email to subscribers. The table structure for subscriber is below               Subscriber Id - primary key     Subscriber email - varchar     Category Id - int      Now the task is to fetch post for last week for each category that exists in above table an send a newsletter to the respective subscribers each monday automatically. I have an idea how to fetch post i will probably do it with get_post() method but i'm not sure how will i do it. Should i made a plugin? If yes, then can a plugin file be run like a cronjob ? Or if there is any other good approach please advice . Thanks Raheel


title: Plugin that will output submitted form data for user?

text: I have a standard HTML form that the visitor will fill out. It consists of mostly checkboxes. What I would like, is after the form is submitted, a page is then presented to the user showing what they checked. For example, if the visitor checked off Checkbox A, B, and D (but not C), then upon submission they would see the following:               You submitted:     Checkbox Value A     Checkbox Value B     Checkbox Value D      Obviously I can do this with just PHP, but my client would like to be able to modify the form options. Is there a plugin or user friendly way that this can be created?


title: Can't edit custom post type

text: I'm using the following code to create two custom post types: Pastebin Link The Spotlight custom post type is giving me the edit/permalink to edit the post. However, the cooking video isn't. I've just copied the code from the Spotlights, changed the pertinent info for Cooking Videos so I don't get why it isn't working.


title: Is WP feature image function cropping images? WP Content Slideshow

text: I am using WP Content Slideshow. I like the plugin, but am having an issue with it. I mailed the creator, but no response, so I am trying to troubleshoot what is causing the problem. You can see the issue on the homepage of elyconnect.com. The plugin uses the featured image for the image in the slideshow. I set the resolution for each image size correctly, but the images are "cropping" and I dont know why. I'm open to suggestions, or a recommendation for a better plugin if one exists.


title: Limit blogs creation

text: someone knows how to limit the number of blogs creation in a wordpress multisite? (3.6.1). In the wordpress plugins repository there is this plugin, but It doesn't work, I think it's not up to date. Any suggestion would be appreciated, thank you very much.


title: dynamically add scripts to WP_Widget widget() method

text: I have a wordpress widget that has the standard outline like:               class my_widget extends WP_Widget{          function my_widget(){        //do setup stuff     }          function form(){        //do form stuff     }          function update(){        //do update stuff     }          function widget($args, $instance){        //how can we dynamically add style and script here             //this does not work        if($instance['val'] == 'test'){           wp_register_script('test', plugins_url('test.js');           wp_print_scripts('test');        }else{           wp_register_script('diff', plugins_url('diff.js');           wp_print_scripts('diff');        }     }      } I am wondering if it's possible to somehow add scripts dynamically to a wordpress widget... I am guessing that this would have to take place within the widget() method b/c that is the only place where dynamic variables are passed, but the problem is this function appears to be fired after scripts are added. thanks for your thoughts


title: Pull images from the gallery

text: I am building a template where wordpress is being used primarily as an image CMS, I am pulling the first image from the content section of each post.               <img src="<?php echo grab_image() ?>" />          function grab_image() {     global $post, $posts;     $first_img = '';     ob_start();     ob_end_clean();     $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);     $first_img = $matches [1] [0];          if(empty($first_img)){     $first_img = "";     }     return $first_img;     }      My question is how can I, instead of grabbing it from post_content, grab the first image from the uploaded image gallery? So, the process to add an image would be to upload and then exit out (without inserting into post). I dont know what you call this or what to look for.. attachments? media library? The content area would be used strictly for text along with any extra meta boxes.


title: Delete Custom Dashboard Widgets

text: Here is the code on how to delete all dashboard widgets - the default, and plugin widgets but I want to change the code to only delete custom dashboard widgets not the default ones. * * *               // Create the function to use in the action hook     function remove_dashboard_widgets() {         global $wp_meta_boxes;         if ( !array( $wp_meta_boxes ) ) return;         foreach ( $wp_meta_boxes as $widget_section => $widget_locations ) {             if ( $widget_section == 'dashboard' ) {                 foreach ( $widget_locations as $widget_location => $widget_types ) {                     foreach ( $widget_types as $widget_type => $widgets ) {                         foreach ( $widgets as $widget_name => $widget ) {                             remove_meta_box( $widget_name, $widget_section, $widget_location );                         }                                    }                 }             }         }     }      // Hook into the 'wp_dashboard_setup' action to register our function     add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 11 );


title: Create Short code dynamically

text: I want to generate short code for my gallery dynamically. For a single gallery, it is easy to create a short code for my gallery using               add_shortcode( 'image-gallery', 'gallery' )      Now my question is how can i create multiple short code for multiple gallery? Like for gallery 1 short code will be image-gallery-1, for 2 code will be image-gallery-2. I've tried this way               $all_gallery = $wpdb->prefix . 'gallery';     $all=$wpdb->get_results("select * from $all_gallery");     if(count($all)>0){        foreach ($all as $a){           add_shortcode( 'image-gallery-'.$a->id, 'gallery' );        }     }      Its working nicely but when i deactivate the plugin and then activate the plugin again, a fatal error occurred and plugin is unable to activate.


title: Wp-admin Custom User Management

text: I am working on a plugin for which I will have to develop a backend page similar to the built-in "Users" one, in the sense that it will be basically do the same things: list the existing users ( using the `WP_List_Table` class ), edit / remove, and add new ones as well. The only difference is that it will have a couple of additional fields, as well as some other custom functionality. My question is: should I be working with the already existing WP functions for handling users: `wp_insert_user`, `wp_update_user`, `wp_remove_user` or is it recommended to make direct calls to the database? Although this may be a little more complicated, I was wondering if it's the way recommended / only way to go.


title: Create pagination in the items list of specified custom taxonomy term

text:
I've created list of custom taxonomy term and have problem with pagination. Custom post type "gallery" has his own custom taxonomy "gallery_category". The next loop lists all items of chosen Gallery category:                       /* Some info:              * http://wordpress.stackexchange.com/questions/13888/retrieve-single-term-slug              * http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters              */             $term_slug = get_queried_object()->slug;             if ( !$term_slug )                 return;                 else             $args = array(                 'tax_query' => array(                     array(                         'post_type' => 'gallery',                         'taxonomy' => 'gallery_category',                         'field' => 'slug',                         'terms' => $term_slug                     )                 ),                  'posts_per_page' => 3,                 'paged' => get_query_var( 'paged' )             );             $loop = new WP_Query( $args );                 while ( $loop->have_posts() ) : $loop->the_post(); ?>                      <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'poznaj-wilno' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

                         <?php if ( has_post_thumbnail() ) : ?>                             <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'poznaj-wilno' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail( 'gallery-thumbnail' ); ?>                         <?php endif; ?>

                              <?php endwhile; // End the loop. Whew.     /*Using WP-PageNavi plugin.      * Call based on - http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html     */ ?>
     <?php         if ( function_exists('wp_pagenavi') )      wp_pagenavi( array( 'query' => $loop ) );      ?>
          I'm using WP PageNavi plugin to create pagination and I'm facing the problem with "`get_queried_object()`" function. It takes term name from the link: `http://domain.ltd/gallery/categories/term- slug`. When I click on next page, link changes to: `../gallery/categories/term- slug/page/2`. Because link slug has been changed I'm getting an error. Maybe you have any ideas how could i solve this problem? Thanks.


title: How to solve Woocommerce Memory Limit

text: I have Woocommerce set up to run on WP multi-site with my PHP Memory Limit set to 256M in the php.ini I also have in my wp-congif.php               define("WP_MEMORY_LIMIT", 128);      However Woocommerce shows the following "WP Memory Limit: 12 B - We recommend setting memory to at least 64MB." How can I solve this


title: WP query exclude post within the last month / only show over 1 month old

text: I need to create a landing page which only shows posts that are at least a month old. Everything I've read / tried with the date query so far seems aimed at including posts between the last month and now rather than excluding.. effectively I'm looking to exclude posts between todays date and today-1month. Any pointers appreciated.


title: Illigal string offset after moving website

text: After moving my website to another host, I'm getting a few errors in my wordpress theme. > Warning: Illegal string offset 'navbar' in /home/mydomain/public_html/wp- > content/themes/karmag/subheader.php on line 42 > > Warning: Illegal string offset 'topbar' in /home/lifecx/public_html/wp- > content/themes/karmag/subheader.php on line 48                   <!-- top bar -->         <div id="navigationtop" class="tour_2 tour_2a">                   <?php $disable_sidebar = of_get_option('disable_footer', '' );              if( $disable_sidebar['topbar']==0 ) { ?>                      <?php get_template_part( 'includes/template-parts/topbar' ); ?>                  <?php } ?>      > Warning: Illegal string offset 'topmenu' in /home/mydomain/public_html/wp- > content/themes/karmag/includes/template-parts/topbar.php on line 51                               <?php if ( ! dynamic_sidebar( 'main-menu' ) ) : ?>                         <?php wp_nav_menu(array('theme_location' => 'main-menu','container'=>'','menu_class'=>'sf-menu','fallback_cb'=>'kt_main_menu')); ?>                     <?php endif; ?>                       <?php } ?>      Does anyone know a simple fix for this. Many thanks!


title: Using wordpress translations strings in plugin

text: right now I'm building a helper plugin to make it easier for me to do simple tasks, such as registering post types. When doing this, i'd like to use some of wordpress base translations. Wordpress has the string 'Add New', which is translated in to other languages. Now, is it possible for me, to utilise the base translation, or will i have to re-translate 'Add New' for all of my post types?. Does wordpress have a text domain, in the same way plugins do. like __('Add New', 'wordpress'). I tried just adding __('Add New'), but that doesn't work either. Worst comes to worst, ill just have to retranslate it - just seems silly, if i could rely on normal wordpress-strings. Thanks!


title: URLs to user page is broken

text: My domain is http://mongage.com I don't know what happened to my site. the user URL linking to author/user page is broken. I switched to a new theme, but no success. I am using thentythirteen and the following code:               <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">      in my functions.php, I am rewriting the user/author page URL with the following code:               function change_author_permalinks() {     global $wp_rewrite;     $wp_rewrite->author_base = 'membres';     $wp_rewrite->author_structure = '/' . $wp_rewrite->author_base. '/%author%/';     }      add_action('init','change_author_permalinks');      but when I mouse over an author/user name I get "http://domain.com/members//" where it simply get cut off before the author/user name. I manually type the rest in the URL, but get a 404 deleting the custom author/user URL or switching to a new theme did not fix it either. would appreciate if anyone can put me in the right direction. Actually I started from scratch twice no success. It was perfectly working fine before. By the way, I have customize the comments system to work as a petition signup allowing only 1 comment/signup per user. I have also moved my comment form to the sidebar.


title: Autodelete posts that have word in title on cerain category

text: I want to know if there is a way or plugin that autodeletes posts that a certain word in their title. Even better if that is done only to a cerain category I have one site that has autoblog on .. and thats the problem... some posts dont work like i want.. so i want them to get autodeleted ! those posts got the word video on them ! so i want a filter or a plugin or somethin that deletes every post (even better if i can do it only on specific category) that has the word video on it's title ! :)


title: 404 page is not querying my custom post

text: I have a 404 template page which is, obviously, designed for Not Found Pages. Within the code, I have the `get_header();` where I place the global code for the site. There is a `div` that contains a style atribute that is set with a `wp_query`! The goal is uploading an image in order to be the background, along with a color. Here it is:               <div style="     <?php       $args = array(         'post_type' => 'general_settings'       );       $the_query = new WP_Query( $args );       if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();         echo "background:url(";         echo the_field('set_background'); //GET THE BACKGROUND POSTED         echo ") ";         echo the_field('set_color'); //GET THE BG COLOR       endwhile; endif;     ?>     no-repeat top center;">      The background that I upload appears for all pages, except for the 404 Page. Is there something that 404 make blocks the management content of `WP_query`?? Thank you!


title: How to create a link for wordpress meta datas?

text: I would like to create a link for "Leave a comment", which name "quick comment" (here come a ajax comment form on div).   How can I do this?   I have attached a picture where I'd like to put this link:   ![enter image description here](http://i.stack.imgur.com/HBJVi.jpg) The function for this:               if( ! function_exists( 'cyberchimps_posted_in' ) ) {        //add meta entry category to single post, archive and blog list if set in options      function cyberchimps_posted_in() {     global $post;          if( is_single() ) {         $show = ( cyberchimps_get_option( 'single_post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_categories', 1 ) : false;      }     elseif( is_archive() ) {         $show = ( cyberchimps_get_option( 'archive_post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_categories', 1 ) : false;       }     else {         $show = ( cyberchimps_get_option( 'post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'post_byline_categories', 1 ) : false;       }     if( $show ):                 $categories_list = get_the_category_list( ', ' );                 if ( $categories_list ) :                 $cats = sprintf( __( 'Ebben a kategóriában:', 'cyberchimps_core' ) . ' %1$s', $categories_list );             ?>                              <?php echo apply_filters( 'cyberchimps_post_categories', $cats ); ?>                     <?php echo apply_filters( 'cyberchimps_entry_meta_sep', '|' ); ?>     <?php endif;     endif;        }       }             if( ! function_exists( 'cyberchimps_post_tags' ) ) {         //add meta entry tags to single post, archive and blog list if set in options          function cyberchimps_post_tags() {     global $post;          if( is_single() ) {         $show = ( cyberchimps_get_option( 'single_post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_tags', 1 ) : false;      }     elseif( is_archive() ) {         $show = ( cyberchimps_get_option( 'archive_post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_tags', 1 ) : false;       }     else {         $show = ( cyberchimps_get_option( 'post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'post_byline_tags', 1 ) : false;       }     if( $show ):     $tags_list = get_the_tag_list( '', ', ' );                 if ( $tags_list ) :                 $tags = sprintf( __( 'Tags:', 'cyberchimps_core' ) . ' %1$s', $tags_list );             ?>                              <?php echo apply_filters( 'cyberchimps_post_tags', $tags ); ?>                     <?php echo apply_filters( 'cyberchimps_entry_meta_sep', '|' ); ?>              <?php endif; // End if $tags_list     endif;       }       }          if( ! function_exists( 'cyberchimps_post_comments' ) ) {       //add meta entry comments to single post, archive and blog list if set in options     function cyberchimps_post_comments() {     global $post;          if( is_single() ) {         $show = ( cyberchimps_get_option( 'single_post_byline_comments', 1 ) ) ?    cyberchimps_get_option( 'single_post_byline_comments', 1 ) : false;      }     elseif( is_archive() ) {         $show = ( cyberchimps_get_option( 'archive_post_byline_comments', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_comments', 1 ) : false;       }     else {         $show = ( cyberchimps_get_option( 'post_byline_comments', 1 ) ) ? cyberchimps_get_option( 'post_byline_comments', 1 ) : false;       }     $leave_comment = ( is_single() || is_page() ) ? '' : __( 'Szólj hozzá', 'cyberchimps_core' );     if( $show ):         if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>             <?php comments_popup_link( $leave_comment, __( '1 hozzászólás', 'cyberchimps_core' ), '% ' . __( 'hozzászólás', 'cyberchimps_core' ) ); ?>        <?php echo ( $leave_comment != '' ) ? apply_filters( 'cyberchimps_entry_meta_sep', '|' ) : ''; ?>     <?php endif;     endif;        }      }          // change default comments labels and form         add_filter( 'comment_form_defaults', 'cyberchimps_comment_form_filter' );         function cyberchimps_comment_form_filter( $defaults ) {     $defaults['title_reply'] = __( 'Szólj hozzá!', 'cyberchimps_core' );     return $defaults;         }


title: How to open modal window when clicking a WP menu link?

text: I'm making my first site with WP, I'm a Joomla Developper. I'm using wisten theme, and WP 3.9.2 I want to create a link in my the navigation that opens a modal window (not a new page) on click. Example - http://kendo.mx , when you click the LOGIN link I have no clue of how I should do this in WordPress. The Jquery code for such an operation is not very difficult, the code is here :               http://jsfiddle.net/mmetsalu/hBX6E/2/      but I have no clue of how to integrate it. Any help would be appreciated


title: Is Post Type Necessary for Taxonomy Archive

text:
Symptom: The following code will only work if I include the post type. Is this a correct behavior? Note:The data being called is a Custom Post Type.               <?php     $term=get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy')); // Capture the slug and hence get the taxonomy      $parent=get_term($term->parent, get_query_var('taxonomy'));     $the_tax=get_taxonomy($term->taxonomy);     $sectionargs=array(                     'post_type'=> 'bookpage',                       'meta_key' => 'Sort Number',                     'orderby'  => 'meta_value',                     'order'    => 'ASC'                               );     query_posts($sectionargs);?>
     <?php if (have_posts()): while (have_posts()): the_post();?>
<a href="<?php the_permalink(); ?>" ><?php the_title(); ?>
     <?php endwhile;?>
              <?php else: ?>
<?php _e('Sorry, no posts matched your criteria.');?>
     <?php endif; ?>      The template is called with a url of the form /taxonomy/term. I'm assuming therefore that any type of post assigned to the term in question should be found by the URL. However, if I omit the 'post type' then nothing is found suggesting perhaps that either the code needs to have the post type defined or it defaults to post_type=post. As far as I can tell the standard category archive template doesn't specify the post type. Does anyone know if the post type should be required? Thanks


title: Using Backbone with the WordPress AJAX API

text: I'm attempting to build out a simple TODO plugin using Backbone and have run into an issue with the AJAX API. In order to get the correct AJAX call back you have to pass in the "action" parameter like this: admin-ajax.php?action=get_todos which works fine for the GET method in Backbone. However, when using DELETE Backbone will use a URL like this by default: admin-ajax.php?action=get_todos/9 where "9" is the ID of the todo being deleted. By adding on this ID it breaks the AJAX call on the WordPress side. I can manually override the URLs for each of the methods but I'd like to know if there's a more elegant way to get the AJAX API to work with Backbone. I've created a demo plugin which shows the specific issue I've run in to. Load the settings page and click on any of the X's while watching your Network inspector to see the 0 value AJAX results coming from WordPress. https://github.com/hereswhatidid/wordpress-todo-backbone-demo


title: Modify Text Widget using wp_editor()

text: I try to add Editor to Text Widget by using wp_editor() But i get a javascript error switchEditors is not defined. Could you let me know the javascript file need to load               wp_enqueue_media();      wp_editor('content', 'text-id');


title: Widget to add an different image to sidebar (by category)

text: I want to add custom content (maybe using a widget) on my website's sidebar that changes by category. For example, if a user lands on the 'Cars' category, I want to show an image related to cars. In the same location, I want a Car to show if the user lands in the 'Cats' category. What would be the best way to go about this? I know that there is a custom sidebar plugin, but I really don't need a different sidebar for every category, I just need to add a section to the current sidebar that changes by category. Thank you in advance for your help!


title: Show all sub categories?

text: Is it possible to show all child/sub categories of all parent cats? I have the following hierarchy: Parent Cat/Tax   \-- Sub 1   \-- Sub 2   Parent Cat/Tax 2   \-- Sub 1   \-- Sub 2   I would like to be able to show all the child categories on one template without the parent showing as well. Is that possible?


title: Change places custom fields with title field in post wp-admin

text: Is it possible to make custom fields at the top, when writing a new post in admin panel ? Thank you.


title: Get post terms with hierarchical relationships

text: I'm having a hard time getting a set of selected terms in a custom taxonomy presented in a specific way. I have a hierarchical taxonomy 'places' and a post with the tagged terms:               England (x)       - London (x)          - Venue1 (x)     France (x)       - Paris (x)          - Venue2     Germany       - Berlin (x)          - Venue3 (x)      I need to print out:               myPostTitle : Venue1 (London - England)                   Paris (France)                   Venue3 (Berlin)      My problem is, that I can't find a function that will return the tagged terms, in a manner that reflects the hierarchical relationships. I need to be able to determine:   * Which terms are the actual 'venues' (the 'lowest' tagged child in each of the hierarchies)   * What parents and grandparents of those 'last children' to include. I'm outside the loop, and would prefer not to run setup_postdata(). I have the post ID.


title: Custom Shortcode and Button not Working after 3.9 update

text: I have added a new button that creates a short code but it seems that after the newest WordPress update, the button is not working any more. The button is visible but when someone clicks it, nothing happens. The code I used is the following- **js part**               (function() {     tinymce.create('tinymce.plugins.affiliate', {         init : function(ed, url) {             ed.addButton('affiliate', {                 title : 'Add Affiliate Link',                 cmd : 'Affiliate link',                 image : url+'/euro.png',                 onclick : function() {                      ed.selection.setContent('[aff afftitle="" afflink=""]' + ed.selection.getContent() + '[/aff]');                      }             });         },         createControl : function(n, cm) {             return null;         },     });     tinymce.PluginManager.add('affiliate', tinymce.plugins.affiliate);     })();      Ι also have written code for the PHP Part, but I am not sure if the problem is there.I thing that the problem is in the JavaScript above. Ι know that createControl doesn't exist any more. I am trying to get around this issue but with no luck at this time.


title: WooCommerce: Change default country on the cart page

text: I'd like to change the default country on the **cart** page to _none_ , i.e. to have "Select a country…" appear as the default in the drop-down list of countries. I've looked at this WooCommerce Docs snippet which uses the `default_checkout_country` **filter** but it only seems to apply to the **checkout** page (and not the **cart** page), as its title says. I also tested this by surrounding the `apply_filters('default_checkout_country', ...` in the files where they appear with `echo` statements and they don't appear anywhere in the generated markup for the **cart** page. As we are using PayPal Express Checkout we don't use the WooCommerce built-in checkout page so it appears that the above mentioned snippet doesn't apply and another solution is needed. My next step was to look into `woocommerce/templates/cart/shipping- calculator.php` where the country option list is generated on the **cart** page. There's a call to `$woocommerce->customer->get_shipping_country()`. That function in `woocommerce/classes/class-wc-customer.php` simply picks up the `$_SESSION['customer']['shipping_country']` variables. The only place those variables are set is in the function `set_shipping_to_base()` in the same file and the only place that function is (conditionally) called is in `woocommerce/shortcodes/shortcode-cart.php` which I assume generates the **cart** from the **shortcode** used on the autogenerated **cart** page. I added a `echo` statement to the block in that file where that function is called but nothing appeared in the markup, so I got stuck there. The above investigation seems however to be somewhat of a red herring as the above mentioned session variables seem to actually be set by the **Base Country/Region** setting on the General tab, as it would vary accordingly when the `$_SESSION` variable got printed in a browser where cookies and cache had been previously deleted. So I'm kind of stuck here too. I'd like the **Base Country/Region** setting to remain the country set, but still have no default country unless the visitor actually has selected it. Any ideas?


title: Blogroll/Lins Menu not visible in my backend?

text: well, i'm confused. I can't seem to find out why my "Links" Menu doesn't show up in my wordpress admin. I have this in my `functions.php` file …               add_action( 'admin_menu', 'remove_links_menu' );          function remove_links_menu() {         remove_menu_page('themes.php'); // Appearance         remove_menu_page('tools.php'); // Tools         //remove_menu_page('link-manager.php'); // Links         //remove_menu_page('edit-comments.php'); // Comments     }      However it clearly says, that `link-manager.php` is not removed. If comment- out the entire action the `themes` and `tools` Menus are showing back up. However the link-manager is never visible. Any ideas?


title: List custom field values in alphabetical order without repetition from the current category?

text: I have this code:               global $wpdb;     $query = "SELECT DISTINCT meta_value                       FROM $wpdb->postmeta                       WHERE meta_key = 'product_brand'                       ORDER BY meta_value;";     $directors = $wpdb->get_results( $query );       foreach( $directors as $director ) :         echo $director->meta_value . ', ';     endforeach;      This code will show all meta values having the `meta_key` "product_brand". On category pages, what I want to do is list all unique meta values having the `meta_key` "product_brand" from the current category.


title: Custom Posts In Pages

text: I am new to Wordpress.Sorry for asking such easy question I have a view page in which I want to show pictures in Grid so I have created Custom Post In Wordpress Name **Pictures.** there are pages name called **Celebrities** **Models** etc the problem is I don't know how to display pictures on specific pages. For example I want to do something like this   1. Add a new picture from custom post    2. select Page on which I want to display The problem is there is no selection. So how can I assign or show different posts to different pages.


title: Admin-ajax.php appending a status code to ajax response

text: I'm writing a plugin that uses Ajax (jQuery with form plugin) via a form submission and the php function returns a JSON response.               add_action( 'wp_ajax_bubbly-upload', 'bubbly_upload_submit' );          function bubbly_upload_submit() {         // generate the response         $response = json_encode( array( 'success' => true ) );              // response output         header( "Content-Type: application/json" );         echo $response;     }      In Firefox, none of the jQuery response handlers were firing and the save file dialog was opening with the JSON response. I wouldn't have the issue if I returned HTML. However, in either case, a '0' was appended on to the end of my response. After some digging, it looks like jQuery will not trigger a handler if the JSON reponse is invalid. This '0' being added onto the end is causing the JSON to be invalid. If I look into the `admin-ajax.php` code, I see this:               default :         do_action( 'wp_ajax_' . $_POST['action'] );         die('0');         break;     endswitch;      The php docs for die say that if the parameter passed is a string, then it will be printed just before exiting, if it is an integer, it will not be printed. Without hacking the core, is there a way I can avoid this issue and still use JSON? Also, is this a bug, because I don't see how adding a zero to the end of every AJAX response would be desired...


title: Displaying custom profile fields using Mingle Plugin

text:
I am using the Mingle plugin to add some networking functionality for a website I am creating for a client. I am having Mingle handle displaying user profiles and friends, but WordPress to actually register users and put in fields. Mingle has the ability to add custom fields (ex: Twitter, Facebook, etc). However, there is no way to display these custom fields individually. So, I have added my own custom fields to WordPress using the `functions.php` file:               function add_new_contactmethods( $methods ) {         $methods['twitter'] = 'Twitter';         return $methods;     }     add_filter( 'user_contactmethods','add_new_contactmethods' );      I am displaying them **within one of the Mingle templates** (`mingle/classes/views/mngl-profiles/profile.php`):               <?php if ( get_the_author_meta( 'twitter' ) ) { ?>         <a href="http://twitter.com/<?php the_author_meta( 'twitter' ); ?>" title="Follow @<?php the_author_meta( 'twitter' ); ?> on Twitter">

                     <img src="<?php echo THEME_DIR; ?>/images/icons/twitter.png" alt="Twitter" class="socialIcon" />

                     @<?php the_author_meta( 'twitter' ); ?>

              <?php } ?>      Now whenever I go to a profile page that is generated by _Mingle_ , (`http://example.com/admin` or `http://example.com/dylan`), whoever is currently logged in at the moment will have _their_ custom fields shown, not to the user whose profile is being shown. Does that make sense? I can provide more code or elaborate if need be. I would really, really appreciate any and all help I can receive on this, the project is really time-sensitive.


title: Is it possible to pull comments from facebook into your blog?

text: I have a client who wants to be able to share his latest blog posts on Facebook (no problem there) but then he wants the comments made on his Facebook page to that share shown on his blog as part of the comments on the blog post. I have been digging around and while I can find ways to let users comment on your blog using Facebook's api (http://developers.facebook.com/blog/post/198) I can find nothing that pulls comments from Facebook to display on your site. The closest I could come is this http://wordpress.org/extend/plugins/facebook- comments/ which according to its developer is broken and can only be fixed by 'screen scraping' Facebook which, of course, is against Facebooks TOS. Does anyone know if there is a working plugin, or a relatively simple method to get this done?


title: The issue of redirecting my site to a new domain

text: I have encountered some problems after I have redirected my site, which is in a sub directory in my server, to a new domain. I have kept the same server. The origin URL of my wp site `http://www.example.com/mywpblog`, has been redirected to another new domain `http://www.example.com`. Please help me solve the following :   1. The original title of my WordPress page disappeared. My new domain name is the title which appeared in the title bar. I couldn't find it to edit while the origin is still there in the `header.php`. > Q: How can I return my new title?   2. Meta links don't work properly. For example, I try to open the "register" link (`http://example.com/mywpblog/wp-login.php?action=register`) and get a page with the following message: "the content cannot be displayed".  > Q: I assume there is some conflict with links so may be I should to edit > these links on the `sidebar.php`?   3. My post page's real link doesn't appear when I open I a post, just the `http://newexample.com` which keeps appearing in the address bar. I can't see the complete permalink.


title: Get the 'slug' of a custom taxonomy

text: Use case: I have a custom post type of 'show' for a music venue. In the sidebar we want to display any related 'show' to the current one on single-show.php. They will be related by a custom taxonomy of 'genre'. I figured I could dump the custom taxonomy slugs for a post (might be more than one) into a variable then pass that variable into a custom query for the sidebar post. Using get_the_term_list() works if there is a single taxonomy but if there are multiple it breaks (of course). Any thoughts on how to get an array of the custom taxonomy slugs for a give post into a variable?


title: Add wordpress menus to magento website

text: How to add wordrpess menus to magento website? I have installed Magento WordPress Integration, author jamesckemp. By using this plugin, i did magento menus to display it in wordpress website. Please give me any suggestions or solutions regarding this.


title: Display all categories including sub categories

text:
I am trying to display a list of all categories and sub-categories underneath that category, I have managed to get a list of all categories that are parents but am struggling to detect if it has children and then display them in the current loop. Here is my code at the moment:               $args = array(       'orderby' => 'name',       'parent' => 0       );     $categories = get_categories( $args );     foreach ( $categories as $category ) {              echo 'term_id ) . '">' . $category->name . '
';          }      I have found a few functions on here about detecting if the category has children, but am struggling to actually display the children (up to one level) under this link. Any help is greatly appreciated, Simon