title: Break apart wp_list_pages in order to customise it

text:
I'm trying to 'break apart', (think explode is the correct terminology), wp_list_pages in order to add some definition list code into it, (dl, dt, dd). Here is the html code that I'm trying to output:

About Us

Help Desk

Email your question

Text a question

Life stories

Statistics

World Statistics

UK Statistics

South West Statistics

Research projects

Talk to us

      Here is my current outputted html code:

About Us

Child of About

Grandchild of About

Talk to us

      Which is generated using the following code from within my header.php, (can't remember which site I found this on):

                   <?php         // Query the database for all top-level page IDs, and store them in the $menuPages array under the [ID] sub-array         $menuPages = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent=0 AND post_type='page' AND post_status='publish' ORDER BY menu_order ASC");              // For each element in the $menuPages array, get the value from the [ID]-subarray to create the top-level menu and it's children         foreach($menuPages as $menuItem){             $menuItemTitle = get_the_title($menuItem->ID);                       $menuItemClass = strtolower(trim($menuItemTitle));                               $menuItemClass = preg_replace('/[^a-z0-9-]/', '-', $menuItemClass);             $menuItemClass = preg_replace('/-+/', "-", $menuItemClass);                          $menuItemPermalink = get_permalink($menuItem->ID);                 if (isset($menuItemTitle) && $menuItemTitle != 'Home'){                                      _e('
'.PHP_EOL);                     _e(''.$menuItemTitle.''.PHP_EOL);                      // Run wp_list_pages to fetch any children, and put the HTML
 list results into $menuItemChildren as a string                     $menuItemChildren = wp_list_pages('title_li=&echo=0&depth=1&sort_column=menu_order&child_of='.$menuItem->ID);                      // If results were returned, $menuItemChildren is now a string with HTML in it, so create a drop-down and echo out the HTML                     if($menuItemChildren){                                               _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                                                            echo $menuItemChildren . PHP_EOL;                         _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                         _e('
'.PHP_EOL);                                            }                     _e('
'.PHP_EOL);                             }             }         ?>

      To be honest, this is confusing the life out of me. I can see that it should work, just not sure how to make it work. I somehow need to change each child page/item into a , the grandchildren into 's, all wrapped up nicely in 's. Hope this makes sense. Any ideas/help greatly appreciated, S. (The code is being used to dynamically generate a 'mega-menu') /*Updated Walker Class code below 08-03-11, as originally provided by wyrfel - many thanks */               class My_Walker_Page extends Walker {     var $tree_type = 'page';          var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');          function start_lvl(&$output, $depth) {         $indent = str_repeat("\t", $depth);         switch ($depth) {             case 0:                 $output .= "
\n";                 $output .= "
\n";                 $output .= $indent."
\n";                 $output .= "
\n
\n";                 break;             case 1:                                 break;             default:                 break;         }     }          function end_lvl(&$output, $depth) {         $indent = str_repeat("\t", $depth);         switch ($depth) {             case 0:                 $output .= "\n
\n
\n";                 $output .= "
\n";                 $output .= "
\n";                 $output .= "
\n";                 break;             case 1:                                 break;             default:                 break;         }     }          function start_el(&$output, $page, $depth, $args, $current_page) {         if ( $depth )             $indent = str_repeat("\t", $depth);         else             $indent = '';              extract($args, EXTR_SKIP);         $css_class = array('page_item', 'page-item-'.$page->ID);         if ( !empty($current_page) ) {             $_current_page = get_page( $current_page );             _get_post_ancestors($_current_page);             if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )                 $css_class[] = 'current_page_ancestor';             if ( $page->ID == $current_page )                 $css_class[] = 'current_page_item';             elseif ( $_current_page && $page->ID == $_current_page->post_parent )                 $css_class[] = 'current_page_parent';         } elseif ( $page->ID == get_option('page_for_posts') ) {             $css_class[] = 'current_page_parent';         }              $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));              $page_link = 'ID) . '" title="' . esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '';         $top_class = strtolower(trim($page->post_title));                            $top_class = preg_replace('/[^a-z0-9-]/', '-', $top_class);         $top_class = preg_replace('/-+/', "-", $top_class);                       switch ($depth) {             case 0:                 $output .= $indent . '
'.$page_link . PHP_EOL;                 break;             case 1:                 $output .= $indent . '
'.$page_link.'
' . PHP_EOL;                 break;             default:                 $output .= $indent . '
'.$page_link.'
' . PHP_EOL;                 break;         }              if ( !empty($show_date) ) {             if ( 'modified' == $show_date )                 $time = $page->post_modified;             else                 $time = $page->post_date;             $output .= " " . mysql2date($date_format, $time);         }     }          function end_el(&$output, $page, $depth) {         switch ($depth) {             case 0:                 $output .= "
\n";                 break;             case 1:                 break;             default:                 break;         }     }     }


title: How to return results of a get_posts() in explicitly defined order

text: I'm trying to create a loop of explicity ordered posts, for example:               <?php $args = array(         'include'         => '1,3,8,4,12' ); ?>          <?php get_posts( $args ); ?>       The results are ordered by date by default, and there is no orderby option to return the posts in the order they were entered. There have been multiple bug/feature requests posted about this in Trac, but so far no luck. I've mucked around in the core files a bit but haven't gotten anywhere with it. Can anyone suggest a workaround for this behavior? Cheers, Dalton


title: Is the SEO plugin necessary?

text: I want to understand how wordpress is structured in the first place with regard to search engine friendliness. Isn't it set up for SEO by default? Is the SEO plugin necessary then? and to what extent does post name in the url make a difference as against the standard numerical format of wordpress urls?


title: Using wp_ajax and wp_ajax_nopriv hooks

text: I want to send an ajax request and want to process it if the user is logged in. Therefore I want to use following two hooks, but I am not sure if I am using them correctly. Is it correct to use same function `take_action_function` for the both hooks, and then check in the function if the user is logged in or not? Or should I create **two different functions** , one for the take action and other one just to return the message that user should be logged in?               add_action('wp_ajax_nopriv_test-action', 'take_action_function');     add_action('wp_ajax_test-action', 'take_action_function');          function take_action_function(){         if ( is_user_logged_in() ){            echo "success";            die;         } else {             echo "not logged";             die;         }     }


title: WP for main site and two blogs - implementation

text: I'm working on an open-source software project and hoping to move and combine some disparate sites that it's on. Currently there is a main info/code site. Then there are two blogs for implementations of the project (it's used in developing countries, right now there's a blog for two different countries). I was planning on simply using a single instance of WP to drive the CMS - have the main info site and create the appearance of two separate blogs by having a category label for each of the two countries. I'm realizing as I start implementing that we'd want to have sidebar items like Archives unique to each of the two "blogs". Relatively easy to do with a plugin that only shows a sidebar item only when, say, the URL contains category/country1*. However, when you look at a specific post, I lose that customization. What's a simple way to implement this? I could probably use a few more plugins and (I assume) write some code to display different sidebars based on post category. Or would it be better to create a network?


title: Store user's registration date as meta

text: I am trying to modify the following code to register it as a meta field in the user's profile to have **registration date as a meta field**. This would allow me to reach the information easily and integrate with other plugins that can fetch user meta fields. One important use of this case is when you can pass meta fields along user's information to external services or e-marketing systems. This is the original code I am also using which I am trying to adapt. The following code is used to store last login as a meta field:                       add_action('wp_login', 'set_user_last_login');                  //function for setting the last login                  function set_user_last_login($login) {                $user = get_userdatabylogin($login);                     //add or update the last login value for logged in user                update_usermeta( $user->ID, 'last_login', current_time('mysql') );             }      I've tried using this to store the registration date in a meta field but it doesn't seem to work:               //Updating User Meta with registration date     add_action( 'user_register', 'set_user_registration_date' );                  //function for setting the registration date     $users = get_users();     $udata = get_userdata( $user->ID );     $registered = $udata->user_registered;          function set_user_registration_date($registered) {     $user = get_user_by($registered);          //add or update the last login value for logged in user     update_usermeta( $registered->ID, 'registration_date', $registered->user_registered );     }      I am not a PHP coder. I try to find my way, but I don't seem to be able to get this. I would appreciate any help or if someone has a better way to achieve this? Thanks!


title: Undefined index error on options array element?

text: WP_DEBUG is telling me: > Notice: Undefined index: no_cat_base in myplugin.php on line 20 Here's the lines of code where I'm pulling the value of "no_cat_base" from my options array called "myoptions"...               $myoptions = get_option('my_settings');          if($myoptions['no_cat_base']){//This is line 20}      Is the correct fix for this...               if ( isset($myoptions['no_cat_base'])){//do something}


title: Get latest post from all categories except one

text: I trying to get all the latest post from every category, but I discovered I must ignore one of them. I don't want to show it at all. My problem is I don't know what syntax to write `ifelse` in this code. Here is my code :               <?php       while($i<count($output_categories)):            $latest_cat_post_6 =         new WP_Query( array('posts_per_page' => 1,'category__in'=>$output_categories[$i]));             if($latest_cat_post_6 == 48){                  //do nothung                   } else {       if( $latest_cat_post_6->have_posts() ) :       while( $latest_cat_post_6->have_posts() ) : $latest_cat_post_6->the_post();         }       ?>


title: How to call a function in wordpress plugin from another site

text: I create a plugin and install it in any wordpress sites. For any reason I need to call a function on those plugin from another site (not wordpress site). I've already try to using cURL and file_get_contents to call the function, in some wordpress site it's worked well, but in some another wordpress site it's not working. It's failed on calling the function because the wordpress site has the redirect URL or the wordpress site has another plugins installed like captcha, security, etc. These are the code/function in my plugins:               Class Myplugin{           ..........            function get_wp_version(){         // to do       }            function call_api(){         if($_GET['get_wp_version'] && $_GET['token']){            $wp_version = $this->get_wp_version();            echo $wp_version;         }       }     ........     }      And these are the code that I used to call the function from another site:               $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, 'http://mysite.com/?call_api=get_wp_version&token=xxx');     curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);     curl_setopt($ch, CURLOPT_AUTOREFERER, true);     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);      curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);     curl_setopt($ch, CURLOPT_TIMEOUT, 0);     $curl_msg = curl_exec($ch);      Any help will be appreciated! Oops, typo! The functin of my plugin should be like this:               Class Myplugin{           ..........            function get_wp_version(){         // to do       }            function call_api(){         if($_GET['call_api'] && $_GET['token']){           if($_GET['call_api'] == 'get_wp_version'){             $wp_version = $this->get_wp_version();             echo $wp_version;           }         }       }     ........     }


title: Post data in wp-admin to external database

text: I am trying to make a private form to submit data into an external database so that I can later pull from the database and display the records on a page. So far I have been trying to create a plugin that allows me to fill out the form in wp-admin but when I try to post the data to a different page to store the data I get a "You do not have sufficient permissions to access this page." error. I am basically trying to create an inventory management system to show products on multiple sites that I own. For any further questions that may help me find a solutions, I will try to respond asap. Thank you for any help you can provide. Here is an example of what I am trying to do in code               <?php     add_action('admin_menu', function() {     add_options_page('Add an Item', 'Add an Item', 'administrator', __FILE__, function() {     ?>         <div class="wrap">         <form action="http://some/url/additem.php" method="POST">             <input type="text" value="nothing" />             <input type="text" value="nothing" />             <input type="submit" value="Send" />         </form>         </div>     )};


title: Where can I find web hosting reviews?

text: I'm trying to choose a new hosting service for a WordPress blog, I've stumbled upon several services and most of them look good, so I was trying to find reviews from current user to see what they have to say, is there any website where I can find people's thoughts on the different web hosting companies / services?.


title: Redirect Wordpress MS to no-www version, excepting some dirs and prefixes

text: I have a Wordpress MultiSite, let's say:   * example.com   * two.example.com   * tree.example.com   * ...   * xyz.example.com Currently, I'm using this:               RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]     RewriteRule ^(.*)$ http://%1/$1 [R=301,L]       to redirect the entry MS to the no-www version. Now I want to exclude some directories (i.e wp-admin) and pages:   * www.%.example.com/wp-admin/whatever -> no effect   * www.%.example.com/prefixwhatever -> no effect   * www.%.example.com/whatever -> %.example.com/samethever I saw this code in another question, but it needs some fixes to works for me (i.e. not exclude home page and take the HTTP HOST as a variable).               <IfModule mod_rewrite.c>     RewriteEngine on         #Home: Exclude the home Page     RewriteCond %{REQUEST_URI} !^/$ [OR]         #News: exclude anything that starts with /prefix, /prefix-2 etc     RewriteCond %{REQUEST_URI} !^/(prefix|prefix-2|wp-admin) [NC]     RewriteRule (.*) http://example.com/$1 [R=301,L]     </IfModule>      Any ideas? :D Thank you! **EDIT** The following is **NOT** working. It is not redirecting nothing. :(               <IfModule mod_rewrite.c>     RewriteEngine On     # If yes-www     RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]      # If the request doesn't start /prefix     RewriteCond %{REQUEST_URI} !^/prefix     RewriteCond %{REQUEST_URI} !^/prefiix-2     RewriteCond %{REQUEST_URI} !^/wp-admin     # Rewrite it:     RewriteRule ^/(.*) http://example.com/$1 [L,R=301]     </IfModule>      **EDIT 2** This code:               <IfModule mod_rewrite.c>     RewriteEngine on     RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]     RewriteCond %{REQUEST_URI} !^/host #physical file     RewriteCond %{REQUEST_URI} !^/test #Wordpress page     RewriteCond %{REQUEST_URI} !^/wp-admin #physical dir     RewriteCond %{REQUEST_URI} !^/wp-login.php #physical file     RewriteRule ^(.*)$ http://%1/$1 [R=301,L]      </IfModule>      Seems to be working fine with physical files/dirs. With Wordpress pages this is what happen:   * www.example.com/test -> example.com/index.php   * www.example.com/testwhatever -> example.com/index.php :( **EDIT 3** Now it seems to be working fine, just added a new Cond:               <IfModule mod_rewrite.c>     RewriteEngine on        #If whe're using www.     RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]         #prefixes to !^ ignore     RewriteCond %{REQUEST_URI} !^/host     RewriteCond %{REQUEST_URI} !^/aprobar     RewriteCond %{REQUEST_URI} !^/wp-admin     RewriteCond %{REQUEST_URI} !^/wp-login.php         #See at the end about index.php     RewriteCond %{REQUEST_URI} !^/index.php     RewriteRule ^(.*)$ http://%1/$1 [R=301,L]      </IfModule>      When you're using permalinks, Wordpress do something like this to get the content:   * www.example.com/pretty-url -> www.example.com/index.php?pretty-url So we need to avoid redirecting index.php The new problem is that we are NOT doing this:   * www.example.com/index.php -> example.com/index.php -> example.com/ I think we can set a new rule at the very end of .htaccess to rewrite this particular case.


title: Pre-fill fields with content from outside when creating a new post

text: I'd like to find a way to fill some of the fields from the `/wp-admin/post- new.php` page from an external source. It works for the title: loading `/wp-admin/post-new.php?post_title=title1` fills the title input with `title1`. You get the idea, what would be great is something like `/wp-admin/post- new.php?post_title=title1&content=content1&tags=tag1,tag2&cat=cat1,cat2`... so that when I arrive on the `post-new.php` with most fields already filled from an outside script. I would need to fill in custom fields as well. How can I do that? What's the best option? A full external script that connects to the base my himself and run insert queries? A plugin? If so, do you have some suggestions?


title: An empty Custom Post Type Archive page returns 404 in WP 3.1

text: I have set up a Custom Post Type called "Portfolio". If I view the CPT's Archive page without adding any posts to it (/portfolio or /?post_type=portfolio), it returns a 404 page. Is there a way to show the archive page but personalize the message? Ie "there are currently no portfolio items here right now". As soon as I add 1 post into the portfolio custom post type, the archive page loads fine. Here are other posts that match my issue http://wordpress.org/support/topic/empty-archives-returning-404 Custom Post Type Archives with 0 Posts Redirects as 404


title: How do I query_posts in cat=1 AND not in cat=2

text: Let's say I have 3 categories, College (cat=1), Corporate (cat=2), and Idea of the Week (cat=3) There is a home page for College and a home page for Corporate. On the College home page, in one section I want to show recent post that is in College but not not in Idea of the Week. My initial attempt:               <?php query_posts( 'cat=1&cat=-3' ); the_post(); ?>'      but this appears to pull post found in EITHER cat 1 OR cat 3. Same home page, in a second section I want to show recent post that is in College AND in Idea of the Week. I'm using:               <?php query_posts( array( 'category__and' => array(1,3), 'posts_per_page=1&orderby=date&order=DESC' )); the_post(); ?>      This seems to work as needed. Is there a similar 'category_ _and_ _not' function that I can use for the first query?


title: pass object/JSON to wp_localize_script

text: I've got a working piece of javascript that contains an object literal. But I need to localize it, and I'm ytrying to figure out how to rewrite it so that I can get wp_localize_script() to accet it, and output the correct format. The non-localized (non dynamic) version looks like this:               var layoyt_config = {         'header'        : 1      ,   'footer'        : 1     ,   'ls'            : {'sb1':1}     ,   'rs'            : {'sb1':1,'sb2':1}     ,   'align'         : 'center'     };        Now, to have those values generated by php (based on some wp_settings) I want to use wp_localize_script, so I can take it from there:               var layoyt_config = my_localized_data.layoyt_config;      And to get that data in to that object property I 'thought' I could do this, but obviously not:               $data = array(         'layout_config' => {             'header' : 1         ,   'footer' : 1         ,   'ls' : {'sb1': 1}         ,    'rs' : {'sb1': 1,'sb2': 1}         ,    'align' : 'center'         }     );     wp_localize_script('my-script-handle', 'my_localized_data', $data);      As this will cause PHP parse error I've tried to rewrite the json to array syntax, as wp_localize_script will convert that back to object notation, but this also does not work for me:               $data = array(         'layout_config' => array(             'header' => 1         ,   'footer' => 1         ,   'ls' => array('sb1'=>1)         ,    'rs' => array('sb1'=>1,'sb2'=>1)         ,    'align' => 'center'         )     );     wp_localize_script('my-script-handle', 'my_localized_data', $data);      And while this runs smoothly trhough the php parser, I do not get the expected output in my page source, as my_localized_data.layout_config becomes a String "Array", here is the output:               <script type='text/javascript'>         /* <![CDATA[ */         var wpkit_localized_data = {         layout_config: "Array"         };         /* ]]> */     </script>      So.. How can I do this (or do I just have to accept that I must 'flatten' my object into discrete vars like:               lc_header = '1';     ls_ls_sb1 = '1';     etc...


title: TwentyTen: Overloading template.php files vs. get_template_part

text: I'm studying TwentyTen, under the assumption that it contains the best practices for writing themes and modifying them using child themes. I'm noticing what looks like a really redundant practice, which is to overload not the base template file (eg: attachment.php) but instead to overload the template-part file (eg: loop-attachment.php). Can someone explain the benefit of this approach? If you look at attachment.php, for example, inside TwentyTen, it's really nothing more than a shell - gets header, creates some divs, then calls the REAL attachment file using get_template_part - then displays the footer. And then if you look at single.php, it's almost exactly the same deal. I can understand wanting to define an outer structure once, and then using different parts of the loop as internals, but that's not what TwentyTen is doing, since it redefines this outer structure over and over in all these different template files. Can someone either confirm that the approach taken in TwentyTen is overkill and just obfuscates theme overloading, or point me to some good examples where this technique can actually make your life easier. Right now I'm feeling I should ignore the whole get_template_part thing, and just overload the base template file. Thanks!


title: How to automatically add rounded corners to thumbnails?

text: I want to created automatically rounded corner thumbnails for a particular project I'm working on, using something like this: http://webdeveloperplus.com/php/create-thumbnail-images-with-rounded-corners/ What I'd ideally like to do is find a way to hook something like this into the thumbnail creation process itself and cache it serverside. `/wp- includes/media.php` doesn't seem to have any applicable hooks, so I might have to roll my own. Any clues on where to start? EDIT: **Not in CSS.** There have been some good suggestions about this but I'm using border-radius all over the site, and the images specifically need to be rounded on the server side. Thanks


title: Return count for characters in the comment and perform action based on the length

text: I am calling recent comments into my template with               $comment->post_title        the variable length is specified like this :               SUBSTRING(comment_content,1,180)      how could I write a conditional statement just for comments that exceed the limits of the vairable >180 ? I was thinking It would be good to have a ... for longer comments and a more link.


title: Resizing to bigger proportions as original not working

text: E.g. if I use this code inside functions.php               add_image_size( 'featured-extra-image', 600, 300, true );      and the uploaded image is only 550px width, it does not resize it to 600x300 px but only to 550x300 px. How to force WP to resize it to my custom size, even it is bigger than original uploaded image?


title: How to change wordpress Log In text

text: I just started learning WordPress and in my current project I want to change WordPress default: > Log In Text to: > Welcom To Monastery Any ideas or suggestions?


title: Adding Widgets to Masonry Layouts Correctly - jQuery &&|| PHP

text:
I tried incrementally adding in my widget area to the masonry layout (PHP below) it appears but I cannot get it included into the masonry like the other blocks.                       $counts = 0 ;             $addin = get_sidebar('masonry');                   foreach ($posts as $post) : setup_postdata($post); $counts++; ?>
                     <?php  if($count == 9) {echo $addin;} else {?>                     <a href="<?php the_permalink() ?>">
<?php the_title(); echo $counts; // just to see ?>
                     <?php if (has_post_thumbnail()) {                         the_post_thumbnail('thumbnail');                     }?>                     <?php the_content();?>
<?php } endforeach; ?>      I also tried this jQuery but it broke my masonry:               jQuery(document).ready(function($){         $('.arrange').masonry({            itemSelector: '.box',            isFitWidth: true,         });      $('#addinWidget').click(function(){             var $container = $('#mas-widget');             var addinWidget = $('
<?php get_sidebar('masonry');?>
');             addinWidget.insertAfter($container.find('.element').eq(3));             $container.masonry('reload');         });      Could someone lead me in the right direction to place my widgets correctly inside the masonry layout AT/NEXT TO or IN FRONT OF a specified block number?


title: WordPress MultiSite Active Directory integration and site privacy

text: Here's the overview of the setup:   * I have a multisite installation of WordPress 3.4.2.   * I've installed the Active Directory Authentication Integration plugin (http://wordpress.org/extend/plugins/active-directory-authentication-integration/) to allow users to use their AD credentials. This also allows assigning AD groups to each site, so that the site admins do not manually have to assign permissions.   * I have installed the Network Privacy plugin (http://wordpress.org/extend/plugins/network-privacy/), so that certain sites must be logged into before you are able to see any content. Anonymous users only see the login page. In many regards, this setup works. I am having one problem however, which is stopping me from rolling this out to our primary WordPress multisite installation:   * Bob is a member of the "ITSupport" group in AD.   * Bob is also a member of the "Domain Users" group in AD.   * The main site (www.mysite.com) is locked down to only allow "Domain Users" members to login.   * The sub-site (www.mysite.com/itsupport) is locked down to only allow "ITSupport" members to login.   * Bob visits www.mysite.com and is prompted for authentication. He enters his AD credentials and is allowed into the site.   * Now that he's logged in on www.mysite.com, Bob clicks the link to go to www.mysite.com/itsupport and receives an error that he is not a member of the site.      * It appears that no user entry has been created in the WordPress database for this sub-site.   * Bob logs out of www.mysite.com.   * Now that he is logged out, Bob goes directly to www.mysite.com/itsupport and is prompted for authentication. He enters his AD credentials and is allowed into the site.      * It appears that the user entry in the WordPress database is created at this point for this sub-site.   * Now if he logs out and logs into www.mysite.com, he can traverse to the itsupport site without any issues. If I delete Bob's user entries for both sites and disable the Network Privacy plugin, Bob is able to login to www.mysite.com and then traverse to the itsupport site. But if I delete his user entries and re-enable the Network Privacy plugin, the problem reappears. I had the same problem with one other privacy plugin, though I can't remember which one. If you can spot the problem or if you have setup something similar, I'm willing to try anything, as long as I meet the basic criteria of using AD groups and being able to lock down certain sites.


title: Custom Post Type supports author

text: I am using 'author' in 'supports' array for my 'custom post type', that shows a list of all users of the site on add or edit post screen to assign author for the post. But I want to filter that list to a role. How can I filter authors list for a particular role? I don't want to show a long list of users there. Thanks in advance.


title: Can't attach Javascript to theme

text: I'm currently learning theme development, and tweaking the twentytwelve theme. I've got an external javascript file I'm trying to link, but it won't seem to register. The codex tells me:               <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/pathto/yourscript.js"></script>      which I've changed the filename, to suit my purpose:               <script type="text/javascript" src="<?php bloginfo('template_url'); ?>//trans.js"></script>      However, this is still not working. Am I missing something?


title: Removing Post Meta from Category Pages?

text: This should be an easy one for everyone here. I am trying to remove the post meta function from my category pages only and keep it everywhere else. I currently have a function:               /** Customize the post meta function */     add_filter( 'genesis_post_meta', 'post_meta_filter' );     function post_meta_filter($post_meta) {     if (!is_page()) {     $post_meta = '[post_categories]';     return $post_meta;     }}      How can I add an if statement in there to make it so if (is_category()) to make $post_meta = ''; Any ideas? Will be waiting your responses guys, thank you!


title: Target post type edit page to change view post button, how do I?

text: I am trying to change the link of the "View Post" button that appears next to the "Change Permalinks" button above the editor on post edit screens for a custom post type. I have altered all the messages when a post is updated, published etc. but cannot figure out how to alter the button link. I'll need to do this for the "Preview" button as well. The custom post type is not publicly queryable so I need my client to be able to click these buttons and be taken to the page that displays this custom post type (using a page template). Any and all help is appreciated!


title: Show list of custom taxonomies when another taxonomy is selected

text: Hard question to explain here. So here goes: I have a chapter/section scenario I'm trying to work out. The custom post type of "Books" has two custom taxonomies, "Chapters" and "Sections". The Chapters, are sort of like the higher level taxonomy with Sections being inside each chapter. So it would look something like this:   * Chapter 1     * Section 1.1     * Section 1.2     * Section 1.3     * Section 1.4   * Chapter 2     * Section 1.1     * Section 1.2 Basically, I'm trying to list out the sections, relative to the specific Chapter on a Chapter taxonomy page. I'm using `get_terms()` to grab the list of section taxonomies. The problem is, when I use `get_terms()` it lists out every section in all Chapters. So for instance, Chapter 2 only has posts with Sections 1.1 and 1.2 selected. But using `get_terms()` lists out Sections 1.3 and 1.4 as well for that Chapter. I need a way to isolate the sections taxonomy list to only those taxonomies which are selected in conjunction with the selected Chapter taxonomy. In a way, it's sort of like this question here


title: Wordpress slider that allows image, headline, text, and button?

text: I'm looking for a slider for Wordpress that will allow me to create a really clean-looking site—the kind of site where you land, you see text and images, and you don't even know you're looking at a slider until the text and images slide off and new ones slide in. Kind of like this: http://www.apple.com/iphone/ Or this: http://www.dolbeau.ca/ I want this slider to allow me to:   * insert headlines as text (not as images)    * insert subheadlines as text    * include call-to-action hyperlinked buttons on each slide    * have all of these things overlap on top of the image, as they do on the dolbeau.ca site  Does anyone know of such a slider? Thanks!


title: Moving Blog and Changing URL

text: I'm moving a blog with a decent amount of traffic and some good google juice. I want to try and proactively fix links that will change. How would I loop through all my categories and tags on my current blog and generate a list of all the urls so I can check where they would map to.... Thanks!


title: Interface needed to transfer contents in a table on a web page to the Add New Product interface

text: I will attempt to clarify this situation since the initial feedback was that it wasn't a question/or was vague. I am having an e-commerce site built. The developer is using a WP template purchased through Theme Forest written by Maya. It is called Maya Shop. We are also using the Woo Commerce plug in for the remaining e-commerce functions. Either Woo Commerce or WP has a product input feature called "Add Product". This interface is too complex for my intended users (who are artist-members). My goal is to create a input sheet in table format on a web page and have the artists load their products into this sheet instead of the "Add Product" interface. As this will be a loose affiliation of artists it won't be possible to train each one on the use of the standard WP interfaces. I'm sure that creating a table on a web page with the appropriate drop down choices is not an issue. What I'm being told is not possible is creating a table that will populate the Add Product interface. I am also being told that if we create such a table, and allow it to load the product info directly into the WP MySQL DB it will not work, that the coding is too complex and will likely break something else. What I'm asking is how does one create a simple input form on a web page that will successfully load the product information into either the database or the "Add Product" interface. If this is too general or basic a question, please direct me to an answer as neither I nor my developer have found it.


title: new custom theme - posts displaying on top of one another

text:
live blog I've just implemented a new, custom theme. I've noticed that my posts are now displaying all on top of one another and I can't figure out why. To test my code, I swapped out my custom loop for the plain Wordpress loop- the problem persisted. I've also disabled every single plugin and again, problem persists. Any ideas how to fix?               <?php     /*     Template Name: Blog     */     ?>          <?php get_header();?>

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

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

<?php the_tags('tags: ', ', ', '
'); ?> | <?php comments_number( 'no responses', 'one response', '% responses' ); ?> comments

                 <?php the_content('read more...'); ?>

SHARE THIS POST

         <?php endwhile; ?>         <?php else : ?>
I'm not sure what you're looking for.
         <?php endif; ?>
          <?php get_footer();?>


title: Trouble Making WP_Query paged

text: I'm using the query below in the index.php file as the main query, whenever I try to go to the 2nd page I get a 404 error, I tried using posts_per_page but to no avail.               <?php         $args = array(       'post_type' => array( 'post', 'videos', 'music' ),       'tax_query' => array(          array(            'taxonomy' => 'content',            'field'    => 'slug',            'terms'    => 'indy',            'operator' => 'NOT IN'           )        )     );             $products = new WP_Query( $args );             if( $products->have_posts() ) {                 while( $products->have_posts() ) {                     $products->the_post();                     ?>          Do stuff here.          <?php }             }             else {                 echo 'Oh boy, no posts available';             } ?>      What am I missing?


title: Scrambled Database

text: I downloaded and installed WordPress on a Mac running MAMP, then tried to do a multisite-subdomain installation. I couldn't figure it out, so I deleted the wordpress folder. Then I discovered that installing WordPress messed up my database. When I navigate to phpMyAdmin in my browser, I get this error message: > 1045 - Access denied for user 'root'@'localhost' (using password: YES) Can anyone tell me what's going on?


title: Changing footer depending on URL (poli language site)

text: I have a question. I am working on a WordPress theme, which is in English and Russian. My question is how do I change my "header" and footer depending on the URL. I have a logo, which is in Russian (Cyrillic) and in English (Latin). I would like it to show the the English version when URL contains `/en` and Russian (Cyrillic) when URL contains `/ru`. I assume that I will be able to use the same code to change the footer which should include latinic letters when URL contains `/en` and Cyrillic when URL includes `/ru`. I have been browsing the web for a while now and I came close to some answers but to be honest I am not an expert in coding (in any language). For instance:               $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];          if (false !== strpos($url,'car')) {          echo 'Car exists.'; } else {          echo 'No cars.'; }      I have no idea why `$url` doesn't work. I assume it has something to do with jQuery... No idea really. I suppose it should be something like... If URL contains `/en` then use this header, footer, else use Russian... Perhaps there exists a plug in or something that could solve my problem, but I can't find anything useful. Any help is much appreciated.


title: Customized Upload File Control not saving the files URL as value

text: I have modified a customized version of the Upload File control so that I could upload mp4 videos and use the media library. The control seems to be saving the videos as 'Array'. After uploading a video and saving them, I try to get the theme mod assigned to the control, and I just get the string 'Array' back and not the videos URL. Can anyone see what is going on here?               function wp_customize_video_upload_control($wp_customize) {         /**          * Video Upload Control          *          */      class Wp_Customize_Video_Upload_Control extends WP_Customize_Control {              public function __construct( $wp_customize, $control_id, $args = array() ) {                  // declare these first so they can be overridden             $this->l10n = array(                 'remove' => __( 'Remove Video', 'mwau' ),                 'choose' => __( 'Choose a Video', 'mwau' ),                 'set' =>    __( 'Set as Hero Video', 'mwau' ),                 'upload' => __( 'Pick or Upload Video', 'mwau' )             );                  parent::__construct( $wp_customize, $control_id, $args );         }              // this will be critical for your JS constructor         public $type = 'advancedUpload';              // this allows overriding of global labels by a specific control         public $l10n = array();              // the type of files that should be allowed by the media modal         public $mime_type = 'video/mp4';              public function enqueue() {             //Register our scripts             wp_register_style( 'advanced-upload-control', get_stylesheet_directory_uri() . '/css/advanced-upload-control.css' );             wp_register_script( 'advanced-upload-control', get_stylesheet_directory_uri() . '/js/advanced-upload-control.js', array( 'media-views', 'customize-controls', 'underscore' ), '', true );             // enqueues all needed media resources             wp_enqueue_media();             // Except for its templates - those are attached to hooks that don't exist             // in the Customizer. Just add once             if ( ! has_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' ) )                 add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' );                  // Finally, ensure our control script and style are enqueued             wp_enqueue_script( 'advanced-upload-control' );             wp_enqueue_style( 'advanced-upload-control' );         }              public function render_content() {             // We do this to allow the upload control to specify certain labels             $l10n = json_encode( $this->l10n );                  printf(                 '%s',                 esc_attr( $l10n ),                 esc_attr( $this->mime_type ),                 esc_html( $this->label )             );         }     }     }      add_action( 'customize_register', 'wp_customize_video_upload_control', 1, 1 );


title: Widget front-end fails to echo as expected from checkbox

text: **Context:** This is my first widget and I am following along with an online tutorial. I am expecting the front-end of the widget to echo some content upon checking a check-box in the back-end form, but rather I am not seeing any content displayed. **Reference Material:**   * I have attempted to follow along with these two-part tutorials http://www.wpexplorer.com/create-widget-plugin-wordpress/ and http://www.wpexplorer.com/how-to-create-a-widget-plugin-for-wordpress-part-2/ .   * My complete widget file is located here http://pastebin.com/nVTzxiTQ **screenshots:** **Back-end looks like this after saving** ![Back-end looks like this after saving](http://i.stack.imgur.com/tNOsA.png) **Front-end looks like this after saving** ![Front-end looks like this after saving](http://i.stack.imgur.com/9Hb5U.png) **Question:** Why isn't the act of checking the check-box in the back-end UI resulting in the rendering of the string 'Checkbox is checked' on the front- end, as I expect it to?


title: How to filter the description of a custom post type

text: I understand that although not used by core in any way you can set a description for a CPT:               $args = array(        [...]        'description' => "My CPT description"        [...]     );     register_post_type( 'my_cpt', $args );      You can then access it like that:               get_post_type_object( 'my_cpt' )->description;      But that leaves us directly accessing a property with no way to filter it. Am I correct that this is in fact the way it is and the only way to have this filterable is to introduce a function with a filter to access it myself? _Aside: I have seenthis but it kind of solves the use case but by actually not using the CPT description any more._ EDIT: Okay I need to clarify - I'd like to filter it when requested and not always which is not possible with `registered_post_type` as birgire suggested. I am trying to make the description user editable (also see this as linked above). But if I e.g. store the description as an option I do not want to request this option on each page load if it is only rarely needed.


title: Insert/Update DB table when making new post or update older one

text: I was wondering how can I insert a DB row (not related to WordPress tables) only when I update or add a new post. Right now I have this...               add_action( 'save_post', 'insertIntoDBatPost');     function insertIntoDBatPost()     {       global $wpdb;       global $post;            $wpdb->show_errors();            if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )         return;       if ( defined( 'DOING_AJAX' ) && DOING_AJAX )         return;            $ios_version_changelog = isset($_POST['ios_version_changelog']) ?    $_POST['ios_version_changelog'] : '';     $ios_version_release_date = isset($_POST['ios_version_release_date']) ? $_POST['ios_version_release_date'] : '';     $ios_version_download_link = isset($_POST['ios_version_download_link']) ? $_POST['ios_version_download_link'] : '';     $ios_version_log = isset($_POST['ios_version_log']) ? $_POST['ios_version_log'] : '';          if($ios_version_log != '')     {         $wpdb->insert(             'posts_details',             array(                 'post_id' => $post->ID,                 'post_changelog' => $ios_version_changelog,                 'post_release_date' => $ios_version_release_date,                 'post_download_link' => $ios_version_download_link,                 'post_ios_version' => $ios_version_log             )         );     }     }      and WordPress auto-saves from time to time, which inserts a lot of rows in my database. Any ideas?


title: Proper after_setup_theme and wp_head cleanup

text: Im trying to clean up code in my theme a little bit, remove some of the code that is not used and basically do things the right way, to decrease load time etc. Currently I have this code:               add_action('after_setup_theme', 'rm_theme_setup');          // start theme setup     function rm_theme_setup() {         add_action('init', 'rm_head_cleanup'); // * 1) calling the function below         add_action('wp_head', 'rm_remove_recent_comments_style', 1);         add_filter('gallery_style', 'rm_remove_gallery_style');              rm_add_theme_support(); // * 2) calling the function to add theme support     }      **1) This is the wp_head cleanup part:** Basically Im calling this function in the theme_setup function above. Is this the correct way to do things?               function rm_head_cleanup() {         remove_action('wp_head', 'feed_links_extra', 3);         remove_action('wp_head', 'feed_links', 2);         remove_action('wp_head', 'rsd_link');         remove_action('wp_head', 'wlwmanifest_link');         remove_action('wp_head', 'index_rel_link');         remove_action('wp_head', 'parent_post_rel_link', 10, 0);         remove_action('wp_head', 'start_post_rel_link', 10, 0);         remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);         remove_action('wp_head', 'wp_generator');         remove_action('wp_head', 'wp_shortlink_wp_head');         add_filter('style_loader_src', 'rm_remove_wp_ver_css_js');         add_filter('style_loader_tag', 'rm_clean_style_tags');         add_filter('script_loader_src', 'rm_remove_wp_ver_css_js');     }      **2)** Then later in the code I have this function, **to add theme support**. When you check the theme setup function, im just doing this: rm_add_theme_support();. Is this the correct way to do it, or should I just copy everything from this fuction and paste it to theme_setup?               function rm_add_theme_support() {     add_theme_support('post-thumbnails');          // remove the default thumbnails     update_option('thumbnail_size_h', 0);     update_option('thumbnail_size_w', 0);     update_option('medium_size_h', 0);     update_option('medium_size_w', 0);     update_option('large_size_h', 0);     update_option('large_size_w', 0);          // set_post_thumbnail_size(200, 200, true);     add_image_size('rm-slide', 960, 500);     add_image_size('rm-service-image', 380, 9999);     add_image_size('rm-service-thumbnail', 80, 60, true);          add_theme_support('menus');          register_nav_menus(         array(             'main-nav' => 'Main menu'         )     );      } Thanks for all the help, hopefully this is not too much code.


title: Assign SQL 'post_thumbnail' column as featured image

text: I have added a column called `post_thumbnail` to my wp_posts table. Is there any way I can make `post_thumbnail` to each post's featured image?


title: How to redirect homepage to actual URL?

text: I have a stupid problem. In the custom header template I include on all pages are some images. When I set the links to the images as images/image.png it works on the homepage but not on other pages. When I set the links to these images as **../** images/image.png it works on all other pages but not on the homepage.. This is because the homepage url is given as 'mysite.com' instead of 'mysite.com/home/'. Is there any easy solution to this problem? My guess was to redirect any visit to the homepage to 'mysite.com/home/'. But it looks like Wordpress itself prevents this. If I type 'mysite.com/home/' in an adress bar it redirects immediately to 'mysite.com'. I had no idea that changing these image links would give me such a weird problem :) I hope anyone here has a solution for it. Thx in advance!


title: Wordpress Multi-site Automated migaration script

text: Bit of a long shot but can anyone recommend a script to automate moving a Wordpress multisite from local to live server.


title: Getting URL of Resized Image

text: I have a Wooframework specified question. I'm using Bueno theme with WooFramework 4.5.4 . I'm trying to get url of image which resized with **Dynamic Image resizer** of WooFramework on single.php. I'm using woo_get_image('image', 490, 200); for this but this isn't returning url of image, it's displaying image on page, directly. I need to get url. So i can use it like this : `<img src="<?php get_img_url(); ?>">` . Which function should i use?


title: Pass var into wp function instead of direct string text

text: Looking to replace static string text in this function with dynamic text from a var. Current model:                 comments_number( 'no responses', '1 response', '% responses' );      Ideal Outcome (code guess):                 comments_number( '$no_responce_text', '1'.$responce_text, '%'.$responce_text );      I am sure this is an easy php question but stumped here. Any help would be nice. Thanks


title: Get post title with link

text: I am using this code to send an email from my wordpress site. It send permalinks of the posts. How can i edit this to have linked titles instead of just permalinks;               if(count($ids) > 0){                     $user_id = $usermeta['user_id'];                     $userdata = get_userdata($user_id);                     $email = $userdata->data->user_email;                     //echo $email;                     $links = '';                     foreach($ids as $id){                         $link = get_permalink($id);                         $links .= $link . ' <br>';                     }                     //echo $links;                          if (have_posts()) :                          while (have_posts()) :                              the_post();                             $emailTpl = get_the_content();                         endwhile;                     endif;                          $message = preg_replace('/\[\%urls\%\]/', $links, $emailTpl);                     $headers = "MIME-Version: 1.0\n" . "Content-Type: text/html;";                      //wp_mail('ehmudroy@gmail.com', 'New project notification', $link);                     //wp_mail('lijb@stunningtech.com', 'New project notification', $message, $headers);                     wp_mail($email, 'New project notification', $message, $headers);                 }


title: How can I offer different RSS-Feeds by category?

text: I want to write a WordPress-Blog about some quite different topics. I will write most of it in English, but some topics are only interesting for Germans. The posts in the German-category will be in german. I guess it's not interesting for most readers who read the English categories whats in the German category. So I would like to have one RSS-Feed for all posts in the German-Category and one RSS-Feed for all other posts. How can I realise this? Per default are two Feeds available:               <link rel="alternate" type="application/rss+xml" title="MyBlog RSS Feed" href="http://localhost/wordpress/feed/" />      <link rel="alternate" type="application/atom+xml" title="MyBlog Atom Feed" href="http://localhost/wordpress/feed/atom/" />


title: WordPress Admin Bar Moving Links

text: Is there a way to move the links such as Add New Appearance Comments into one menu


title: Use of apply_filter in plugin/widget class

text:
I'm having difficulties to find out what I'm doing wrong in my use of `apply_filter()` in a widget class. Here's some samples of my code:               class Byad_CountDown_Widget extends WP_Widget {       function __construct() {         parent::__construct(           'byadcd_widget',  // Base ID of widget           __('BYAD Countdown Widget', 'byad-countdown'), // Widget name will appear in UI           // Widget description & class           array(              'description' => __( 'Widget for displaying a countdown (Years (opt.), Days, Hours, Minutes, Seconds)', 'byad-countdown' ),              'classname' => 'byad-countdown',           )          );            }            public function widget( $args, $instance ) {              $title = '' . $instance['title'] . '

';         $title = apply_filters( 'byad_title', $title );//Try to add the possibility of changing the widget title via add_filter()              // before and after widget arguments are defined by themes         echo $args['before_widget'];              // some code to implement some vars              if ( is_active_widget( false, false, $this->id_base, true ) ) {           wp_enqueue_script( 'byad-countdown', plugins_url( 'js/byad-countdown.js' , __FILE__ ), array('jquery'), '1.0', true );                $params = apply_filters('byad_jsdata', array(             'byadClass' => 'countdown-display',             'byadImg' => '/byad-countdown/images/skull.png',             'byadAlt' => '.',             'year' => __('Years', 'byad-countdown'),             'month' => __('Months', 'byad-countdown'),             'day' => __('Days', 'byad-countdown'),             'hour' => __('Hours', 'byad-countdown'),             'min' => __('Minutes', 'byad-countdown'),             'sec' => __('Seconds', 'byad-countdown'),           ) ); //Try to modify the array passed to the JS file                wp_localize_script( 'byad-countdown', 'jbydCD_Data', $params );         }              echo '

';              if ( ! empty( $title ) ) {           echo $args['before_title'] . $title . $args['after_title'];         }              echo $args['after_widget'];       }            // Widget Backend        public function form( $instance ) {         if ( isset( $instance[ 'title' ] ) ) {           $title = $instance[ 'title' ];         }         else {           $title = __( 'My Default title', 'byad-countdown' );         }         //here goes Widget admin form       }            // Updating widget replacing old instances with new       public function update( $new_instance, $old_instance ) {         $instance = array();         $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';         return $instance;       }     } // Class Byad_Countdown_Widget ends here               // Register and load the widget     function byad_load_widget() {         register_widget( 'Byad_Countdown_Widget' );     }     add_action( 'widgets_init', 'byad_load_widget' );      As you can see I've made twice the use of apply_filter to be able to hook into the variable passed to my widget: `byad_title` and `byad_jsdata`. But when in my theme `function.php` file I do the following:               function my_title($title){       $title = 'you know what?';       return $title;     }     add_filter('byad_title','my_title');      Nothing happen, even if I change the priority of the `add_filter` function I'm looking for any advice, because after running the net and different answers and possibilities, I haven't had any success to make it work.


title: How do I only load a plugin js on it's settings pages?

text: I have a plugin that is conflicting with some default wordpress functions. In the post and page creating/edit areas. I only need my functions on my settings pages. I have the js file loading in admin, no problem. Can I tell the script not to load unless I'm viewing the settings pages for my plug?


title: update_post_meta only updating on last loop of foreach

text: I'm building a way to upload multiple files for an announcement custom post type on the front end. My function here uploads any number of files succesfully so I can see them under "Media" in WordPress... attached to the post. I need to be able to store the url of the file in a custom field. When I use `update_post_meta` ... it only updates the values for the last loop/file in my foreach loop below. I can't figure out why? `update_post_meta()` says it "Returns meta_id if the meta doesn't exist, otherwise returns true on success and false on failure. It also returns false if the value submitted is the same as the value that is already in the database." http://codex.wordpress.org/Function_Reference/update_post_meta See my comments in the code for where things are happening. Any ideas? Thanks!               akpsi_insert_attachment( $announcement_id, 'wpcf-announcement_attached_file' );          function akpsi_insert_attachment( $post_id, $post_meta  ) {                  if ( $_FILES['announcement_upload'] ) {                 $files = $_FILES['announcement_upload'];                 foreach ( $files['name'] as $key => $value ) {                     if ( $files['name'][$key] ) {                         $file = array(                             'name'          => $files['name'][$key],                             'type'          => $files['type'][$key],                             'tmp_name'  => $files['tmp_name'][$key],                             'error'         => $files['error'][$key],                             'size'          => $files['size'][$key]                         );                              $_FILES = array( "announcement_upload" => $file );                              foreach ( $_FILES as $file_key => $array ) {                                      // check to make sure its a successful upload                                 if ($_FILES[$file_key] !== UPLOAD_ERR_OK) __return_false();                                      require_once( ABSPATH . "wp-admin" . '/includes/image.php' );                                 require_once( ABSPATH . "wp-admin" . '/includes/file.php' );                                 require_once( ABSPATH . "wp-admin" . '/includes/media.php' );                                      // successfully uploads any file on each loop                                 $attach_id = media_handle_upload( $file_key, $post_id );                                           // this is only updating post meta once, and only the last loop/file.                                        $attach_url = wp_get_attachment_url( $attach_id );                                                           $postmeta_updated = update_post_meta( $post_id, $post_meta, $attach_url );                                       // test to see what it gives me on each loop...                                  // ex: gives me 'int(777)' for first loop/file, 'bool(true)' for second loop/file, 'bool(true)' for third loop/file                                 var_dump( $postmeta_updated );                              }                     }                 }             }          }


title: Custom Post Type loops and Disqus

text: I've created a CPT for a site I'm working on at the moment called "campaigns". I've created a page which displays some content as well a custom loop which displays the most recent Campaign. Everywhere else on the site I've used Disqus for commenting and I'd like to use Disqus here - but it doesn't seem to display. I've tried modifying the comments code to:               <?php $withcomments = "1"; comments_template(); ?>      but I get the regular comments form, rather than Disqus. Anyone any ideas how to work around that? Thanks in advance! 8-2-11 - I've found a temporary workaround - which is to overwrite the comments.php file in the theme with the comments file from the plugin - but that means keeping the two in sync, so it would be great if I could find a better solution.


title: Exclude from the query posts with meta_key and meta_value

text: I use this function to exclude from the query posts that are 30 days old,               function filter_where($where = '') {       //posts in the last 30 days       $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";       return $where;     }     // Register the filtering function     add_filter('posts_where', 'filter_where');     // Perform the query, the filter will be applied automatically     query_posts($query_string);      is it possible to do something like this to exclude posts that have a meta_key=votes and meta_value=0 ?


title: Rewriting the WP Sub Posts plugin to allow one custom post type to be a child of another custom post type

text:
I'll preface this by saying that I'm ok with CSS and Wordpress, but very new to PHP. You all seem to be an enormously smart bunch, and I was wondering if someone could help me out? I am building a Wordpress site for a friend, and they are wanting to be able to post mixtapes. I have created two custom post types: 'mixtape' and 'track', and my friend wants to be able to post a 'mixtape' and then attach several child 'track' posts that will remain in the correct order and will only display on the parent post page. I've been messing around with the WP Sub Page plugin ( http://takien.com/550/wordpress-plugin-wp-sub-post.php ) and trying to make it work with post types other than the default post type. Basically, it has the exact function that I'm looking for, but I need to be able to use it to link one post of the type 'track' to a parent post of the type 'mixtape'. Is this possible? I've included the plugin code below in case that helps. I know this is a big ask, but I've been toiling away at this for three days now, to no avail. If anyone out there has the time to help me with this, I'd be so enormously appreciative! Just trying to learn how this all works! Thanks. Code:               <?php
     /*     Plugin Name: WP Sub Post     Description: You can make a post is a child of another post.     Author: Takien     Version: 0.1 Alpha     */          ////////////////////////////          class Walker_PostDropdown extends Walker {              var $tree_type = 'post';              var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');              function start_el(&$output, $page, $depth, $args) {             $pad = str_repeat(' ', $depth * 3);                  $output .= "\tID\"";             if ( $page->ID == $args['selected'] )                 $output .= ' selected="selected"';             $output .= '>';             $title = esc_html($page->post_title);             $output .= "$pad$title";             $output .= "\n";         }     }     /////////////     function &wp_get_posts($args = '') {          global $wpdb;          $defaults = array(         'child_of' => 0, 'sort_order' => 'ASC',         'sort_column' => 'post_title', 'hierarchical' => 1,         'exclude' => '', 'include' => '',         'meta_key' => '', 'meta_value' => '',         'authors' => '', 'parent' => -1, 'exclude_tree' => '',         'number' => '', 'offset' => 0     );          $r = wp_parse_args( $args, $defaults );     extract( $r, EXTR_SKIP );     $number = (int) $number;     $offset = (int) $offset;          $cache = array();     $key = md5( serialize( compact(array_keys($defaults)) ) );     if ( $cache = wp_cache_get( 'wp_get_posts', 'posts' ) ) {         if ( is_array($cache) && isset( $cache[ $key ] ) ) {             $pages = apply_filters('wp_get_posts', $cache[ $key ], $r );             return $pages;         }     }          if ( !is_array($cache) )         $cache = array();          $inclusions = '';     if ( !empty($include) ) {         $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include         $parent = -1;         $exclude = '';         $meta_key = '';         $meta_value = '';         $hierarchical = false;         $incpages = preg_split('/[\s,]+/',$include);         if ( count($incpages) ) {             foreach ( $incpages as $incpage ) {                 if (empty($inclusions))                     $inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage);                 else                     $inclusions .= $wpdb->prepare(' OR ID = %d ', $incpage);             }         }     }     if (!empty($inclusions))         $inclusions .= ')';          $exclusions = '';     if ( !empty($exclude) ) {         $expages = preg_split('/[\s,]+/',$exclude);         if ( count($expages) ) {             foreach ( $expages as $expage ) {                 if (empty($exclusions))                     $exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage);                 else                     $exclusions .= $wpdb->prepare(' AND ID <> %d ', $expage);             }         }     }     if (!empty($exclusions))         $exclusions .= ')';          $author_query = '';     if (!empty($authors)) {         $post_authors = preg_split('/[\s,]+/',$authors);              if ( count($post_authors) ) {             foreach ( $post_authors as $post_author ) {                 //Do we have an author id or an author login?                 if ( 0 == intval($post_author) ) {                     $post_author = get_userdatabylogin($post_author);                     if ( empty($post_author) )                         continue;                     if ( empty($post_author->ID) )                         continue;                     $post_author = $post_author->ID;                 }                      if ( '' == $author_query )                     $author_query = $wpdb->prepare(' post_author = %d ', $post_author);                 else                     $author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author);             }             if ( '' != $author_query )                 $author_query = " AND ($author_query)";         }     }          $join = '';     $where = "$exclusions $inclusions ";     if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) {         $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";              // meta_key and meta_value might be slashed         $meta_key = stripslashes($meta_key);         $meta_value = stripslashes($meta_value);         if ( ! empty( $meta_key ) )             $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key);         if ( ! empty( $meta_value ) )             $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);          }          if ( $parent >= 0 )         $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);          $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'post' AND post_status = 'publish') $where ";     $query .= $author_query;     $query .= " ORDER BY " . $sort_column . " " . $sort_order ;          if ( !empty($number) )         $query .= ' LIMIT ' . $offset . ',' . $number;          $pages = $wpdb->get_results($query);          if ( empty($pages) ) {         $pages = apply_filters('wp_get_posts', array(), $r);         return $pages;     }          // Sanitize before caching so it'll only get done once     $num_pages = count($pages);     for ($i = 0; $i < $num_pages; $i++) {         $pages[$i] = sanitize_post($pages[$i], 'raw');     }          // Update cache.     update_page_cache($pages);          if ( $child_of || $hierarchical )         $pages = & get_page_children($child_of, $pages);          if ( !empty($exclude_tree) ) {         $exclude = (int) $exclude_tree;         $children = get_page_children($exclude, $pages);         $excludes = array();         foreach ( $children as $child )             $excludes[] = $child->ID;         $excludes[] = $exclude;         $num_pages = count($pages);         for ( $i = 0; $i < $num_pages; $i++ ) {             if ( in_array($pages[$i]->ID, $excludes) )                 unset($pages[$i]);         }     }          $cache[ $key ] = $pages;     wp_cache_set( 'wp_get_posts', $cache, 'posts' );          $pages = apply_filters('wp_get_posts', $pages, $r);          return $pages;     }     //////////////          function walk_post_dropdown_tree() {         $args = func_get_args();         if ( empty($args[2]['walker']) ) // the user's options are the third parameter             $walker = new Walker_PostDropdown;         else             $walker = $args[2]['walker'];              return call_user_func_array(array(&$walker, 'walk'), $args);     }          function wp_dropdown_posts($args = '') {     $defaults = array(         'depth' => 0, 'child_of' => 0,         'selected' => 0, 'echo' => 1,         'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '',         'option_none_value' => ''     );          $r = wp_parse_args( $args, $defaults );     extract( $r, EXTR_SKIP );          $pages = wp_get_posts($r);     $output = '';     $name = esc_attr($name);          if ( ! empty($pages) ) {         $output = "     <select id=""$name\"" name="\"$name\"">     <option value="\"-1\"">$show_option_no_change</option>     <option value="\""">$show_option_none</option>          \n";     }          $output = apply_filters('wp_dropdown_pages', $output);          if ( $echo )         echo $output;          return $output;     }     /////////////////////////////          /* Use the admin_menu action to define the custom boxes */     add_action('admin_menu', 'myplugin_add_custom_box');          /* Use the save_post action to do something with the data entered */     add_action('save_post', 'myplugin_save_postdata');          /* Adds a custom section to the "advanced" Post and Page edit screens */     function myplugin_add_custom_box() {            if( function_exists( 'add_meta_box' )) {         add_meta_box( 'myplugin_sectionid', __( 'WP Sub Posts', 'myplugin_textdomain' ), 'myplugin_inner_custom_box', 'post', 'side','high' );         //add_meta_box( $id,                  $title,                                      $callback,                  $page, $context, $priority );         add_meta_box( 'myplugin_sectionid', __( 'WP Sub Posts', 'myplugin_textdomain' ), 'myplugin_inner_custom_box', 'page', 'advanced' );        } else {         add_action('dbx_post_advanced', 'myplugin_old_custom_box' );         add_action('dbx_page_advanced', 'myplugin_old_custom_box' );       }     }          function myplugin_inner_custom_box() {     echo '               ';          echo '     <input id="myplugin_noncename" name="myplugin_noncename" type="hidden" value="' .         wp_create_nonce( plugin_basename(__FILE__) ) . '" />';  ?>
<?php _e('Parent') ?>
          Please select the parent of this post          <?php           $currentid = $_GET['post'];     wp_dropdown_posts(array('exclude_tree'             => $currentid,                                 'selected'             => $post->post_parent,                                 'name'                 => 'parent_id',                                 'show_option_none'     => __('Main Post (no parent)'),                                 'sort_column'        => 'menu_order, post_title'));      }          /* Prints the edit form for pre-WordPress 2.5 post/page */     function myplugin_old_custom_box() {            echo '
' . "\n";       echo '     <fieldset id="myplugin_fieldsetid" class="dbx-box">' . "\n";       echo '

' .             __( 'WP Sub Posts', 'myplugin_textdomain' ) . "

          ";               echo '

';            // output editing form            myplugin_inner_custom_box();            // end wrapper            echo "

     </fieldset>
          \n";     }          /* When the post is saved, saves our custom data */     function myplugin_save_postdata( $post_id ) {            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times            if ( !wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename(__FILE__) )) {         return $post_id;       }            // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want       // to do anything       if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )         return $post_id;            // Check permissions       if ( 'page' == $_POST['post_type'] ) {         if ( !current_user_can( 'edit_page', $post_id ) )           return $post_id;       } else {         if ( !current_user_can( 'edit_post', $post_id ) )           return $post_id;       }            // OK, we're authenticated: we need to find and save the data            $mydata = $_POST['parent_id'];             return $mydata;     }          add_filter('posts_where','where_no_parent');     add_filter ('the_content','subpost_template', 1, 2 );          function subpost_template($content) {              if(is_singular) {         remove_filter('posts_where','where_no_parent');         }         echo $content;              $idnya = get_the_ID();         $child = new WP_Query("post_type=post&post_parent=".$idnya."");              while($child->have_posts()) : $child->the_post();         echo '
          ';         echo '
';         the_title();              echo '
          ';         $childid =  get_the_ID();         the_content();              edit_post_link('Edit','','',$childid);         echo '
          ';              endwhile;         wp_reset_query();     }          function where_no_parent($where) {         global $wpdb;          $where .= " AND post_parent  = 0";          return $where;     }     ?>          ?>


title: Adding header function to theme

text: I changed the theme of my website this weekend but did not see that it wasn't supporting headers... I am now trying to create the get header image function manually, I managed to do someting in the functions.php section but I do not really know what I should do in the header.php section. When I try to put some code in the header.php my header appears on the top of the website container, above the logo. What I would like is having a full width header that replaces all the white background above the menu, and with the logo and the news ticker visible on it. Could anyone help me? Thank you in advance :)


title: Performance tips for a large user base

text: I’m preparing a site with many users (100.000+). Since the output depends on the current user’s relation to some custom post types and taxonomies a static cache won’t help much. Besides using a separate table for the users and serving static files from a cookieless domain – what else can I do for performance? For example: Should I use InnoDB or MyISAM? Hints on indexes? ## Update Obviously, I wasn’t clear enough. Sorry. All users are logged in. Always. No one else can see more than the start page. The site offers paid material for online courses. I’m looking for tips related to to a large user base only. Basic general performance optimizations like compression, lazy loading of scripts, sprites etc. are useful, but that’s not what I'm out for.


title: Can Anyone provide an example of RAW SQL for SELECTING posts by 2 or more tags

text: I need a RAW SQL, as I am working from different platform with WordPress Database. When I run `example.com/tag/first+second`, WordPress runs a query `SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (10649,7783,6336,4556,3938)` Where did this get the post IDs? I am only guessing. I do have certain thoughts about it, but first want to see if someone knows. Here is the query I have built when getting posts by SINGLE tag:               SELECT `wp_posts`.`ID`, `wp_posts`.`post_name`, `wp_posts`.`post_title`, `wp_posts`.`post_date`, `wp_posts`.`post_content` , DATEDIFF(CURDATE(),post_date) as days_ago      FROM `wp_posts`          INNER JOIN wp_term_relationships             ON (wp_posts.ID = wp_term_relationships.object_id)          INNER JOIN wp_term_taxonomy              ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)         INNER JOIN wp_terms              ON (wp_term_taxonomy.term_id = wp_terms.term_id)     WHERE 1=1         AND wp_term_taxonomy.taxonomy = 'post_tag'         AND wp_terms.slug SOUNDS LIKE 'Hennessy'         AND wp_terms.slug SOUNDS LIKE 'VS'          AND wp_posts.post_type = 'post'         AND (wp_posts.post_status = 'publish')     GROUP BY wp_posts.ID     ORDER BY wp_posts.post_date DESC      thanks.


title: Paypal API and Wordpress

text: Hi does anybody know where i can find a PayPal API tutorial that can help to point me in the right direction, What im needing is something that when payment is verified by paypal it bounces through some code to update_user_meta and also a few fields in a custom table in wp database. Information that i can find via google is pretty vague in what im requiring. regards Martin


title: Show Nav Link To Users Signed In

text: Wordpress let's users apply CSS classes to links under Appearances-->Menus. Well based off of this, I would like to know if there is a way to hide links that have a certain CSS class. So say I apply the CSS class > .members to one of my navigation links. The catch is, I would like this link to only show to users that are logged in. I am a little stuck though as I don't know how to exactly go about doing this. Could something like:               if(is_user_logged_in()) {          }      I just don't know how I could target a CSS class.


title: Widgets dissapearing in adminpanel

text: I have 2 sidebars registered. They appear as they should in the Widget are and i can drop widgets into them. When i save the widgets the widgets content appears on the website where the sidebars are registered. But when i return to the widget admin page the sidebar panels are empty, so i cant edit the content of the widgets. The content is still showing on the website though even when i reload.


title: disqus: comments that've been liked the most rise to the top...like youtube?

text: With Disqus, can I allow the most 'liked' or 'favorited' comments to rise to the top, sort of like YouTube? If not, are there any other commenting systems that have this functionality built in?


title: How to activate "custom fields" section in WP3

text: This is probably a stupid question, but I am setting up a finnish Wordpress installation. The "custom fields" section in the "write post" section is gone; I gather it is hidden by default. That is a great step, but my finnish is a bit rusty, it's my first WP install, and I can't for the life of me find the switch to turn it on. Where do I do this? > **Edit:** Martin shows a way to do this on a per-post basis, thanks for > that. In my case, it would be useful to _always_ show custom fields, so > extra brownie points for anybody who can give me a hint on how to do that. I > can't find any documentation on this.


title: Duplicated Template Does Not Load the Same as the Original Template File?

text:
I had someone code a custom theme that I had designed. I need to duplicate one of the templates this person made, give unique class names for the CSS, adjust the CSS as needed, and finally save it as an entirely new template. **What I have done so far:**   * Opened the template that I want to duplicate in Dreamweaver.   * Changed the template name at the top of the page to the name of the new template.   * Saved the template under a different name since it will become a new template.   * Saved the template on the server via FTP to the location where the rest of the templates are. **Here's the problem:** If I create a new page, and select my new template, the custom meta boxes (cmb) doesn't show up like when I select the template I copied my new template from. It only shows the default metabox. Have a look at these screenshots ![storage template](http://i.stack.imgur.com/GVK04.jpg) ![testimonial template](http://i.stack.imgur.com/nLMQR.jpg) Here is the code to the original template (template.storage.php) and my new template. Bare in mind, these templates are exactly the same, I just change the template name. I will later change some classes to add custom styling, but that is not relevant now.                 <?php     /**     Template Name: Storage     **/     ?>     <?php get_header(); ?>     <?php $container_background = get_post_meta($post->ID, '_cmb_background-container', true); ?>     <?php          $box_one_heading = get_post_meta($post->ID, '_cmb_storage-box-one-heading', true);     $box_one_content = wpautop(get_post_meta($post->ID, '_cmb_storage-box-one-content', true));          $box_two_heading = get_post_meta($post->ID, '_cmb_storage-box-two-heading', true);     $box_two_content = wpautop(get_post_meta($post->ID, '_cmb_storage-box-two-content', true));     ?>              <div id="container" class="innerpage" style="background: #fff3cb url('<?php echo ($container_background ? $container_background : "".get_stylesheet_directory_uri()."/images/corks.png"); ?>') center bottom no-repeat;">         <?php fourosix_breadcrumbs(); ?>
                 <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>                     <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                              <?php if($box_one_heading && $box_one_content) { ?>

<?php echo $box_one_heading; ?>
                             <?php echo $box_one_content; ?>
                         <?php } ?>                              <?php if($box_two_heading && $box_two_content) { ?>

<?php echo $box_two_heading; ?>
                             <?php echo $box_two_content; ?>
                         <?php } ?>

                             <?php the_post_thumbnail(485,320,true); ?>

                             <?php $beerimage = get_post_meta($post->ID, 'BeerImage', true); ?>

                         <?php if ( is_user_logged_in() ) : ?>                                                      <?php edit_post_link( __( 'edit' ), '', '' ); ?>                                                  <?php endif; ?>
                 <?php endwhile; ?>                 <?php else : ?>

page not found

                 <?php endif; ?>

               <?php get_footer(); ?>                     Here is the head for the duplicated template:               <?php     /**     Template Name: Testimonials     **/     ?>      I also include these 2 pieces of code as this might be of help Code from my "enable.php"                 <?php     /**      * Include and setup custom metaboxes and fields.      *      * @category YourThemeOrPlugin      * @package  Metaboxes      * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)      * @link     https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress      */          add_filter( 'cmb_meta_boxes', 'wsod_metaboxes' );     /**      * Define the metabox and field configurations.      *      * @param  array $meta_boxes      * @return array      */     function wsod_metaboxes( array $meta_boxes ) {              // Start with an underscore to hide fields from custom fields list         $prefix = '_cmb_';              $meta_boxes[] = array(             'id' => 'general-settings',             'title' => 'General Settings',             'pages' => array('page'),             'context' => 'normal',             'priority' => 'high',             'show_names' => 'true',             'fields' => array(                 array(                     'name' => 'Background Container',                     'desc' => 'Please upload the image you would like to use as background for the container of this page',                     'id' => $prefix . 'background-container',                     'type' => 'file'                     )             )            );              $meta_boxes[] = array(             'id' => 'page-storage',             'title' => 'Storage Content',             'pages' => array('page'),             'context' => 'normal',             'priority' => 'high',             'show_names' => 'true',             'fields' => array(                 array(                     'name' => 'Box #1 Heading',                     'desc' => 'Please input the heading of Box#1 here',                     'id' => $prefix . 'storage-box-one-heading',                     'type' => 'text_medium'                 ),                 array(                     'name' => 'Box #1 Content',                     'desc' => 'Please input the content of Box#1 here',                     'id' => $prefix . 'storage-box-one-content',                     'type' => 'wysiwyg',                     'options' => array( 'textarea_rows' => 6, )                 ),                 array(                     'name' => 'Box #2 Heading',                     'desc' => 'Please input the heading of Box#2 here',                     'id' => $prefix . 'storage-box-two-heading',                     'type' => 'text_medium'                 ),                 array(                     'name' => 'Box #2 Content',                     'desc' => 'Please input the content of Box#2 here',                     'id' => $prefix . 'storage-box-two-content',                     'type' => 'wysiwyg',                     'options' => array( 'textarea_rows' => 6, )                 )             )         );                   $meta_boxes[] = array(             'id' => 'page-services',             'title' => 'Services Content',             'pages' => array('page'),             'context' => 'normal',             'priority' => 'high',             'show_names' => 'true',             'fields' => array(                 array(                     'name' => 'Box #1 Heading',                     'desc' => 'Please input the heading of Box#1 here',                     'id' => $prefix . 'services-box-one-heading',                     'type' => 'text_medium'                 ),                 array(                     'name' => 'Box #1 Content',                     'desc' => 'Please input the text content of Box#1 here',                     'id' => $prefix . 'services-box-one-content',                     'type' => 'wysiwyg',                     'options' => array( 'textarea_rows' => 6, ),                 ),                 array(                     'name' => 'Box #2 Heading',                     'desc' => 'Please input the heading of Box#2 here',                     'id' => $prefix . 'services-box-two-heading',                     'type' => 'text_medium'                 ),                 array(                     'name' => 'Box#2 Content',                     'desc' => 'Please input the text content of Box#2 here',                     'id' => $prefix . 'services-box-two-content',                     'type' => 'wysiwyg',                     'options' => array( 'textarea_rows' => 6, ),                 ),                 array(                     'name' => 'Box #3 Heading',                     'desc' => 'Please input the heading of Box#3 here',                     'id' => $prefix . 'services-box-three-heading',                     'type' => 'text_medium'                 ),                 array(                     'name' => 'Box#3 Content',                     'desc' => 'Please input the text content of Box#3 here',                     'id' => $prefix . 'services-box-three-content',                     'type' => 'wysiwyg',                     'options' => array( 'textarea_rows' => 6, ),                 ),                 array(                     'name' => 'Box #4 Heading',                     'desc' => 'Please input the heading of Box#4 here',                     'id' => $prefix . 'services-box-four-heading',                     'type' => 'text_medium'                 ),                 array(                     'name' => 'Box#4 Content',                     'desc' => 'Please input the text content of Box#4 here',                     'id' => $prefix . 'services-box-four-content',                     'type' => 'wysiwyg',                     'options' => array( 'textarea_rows' => 6, ),                 ),                  )              );           // Rest of code          return $meta_boxes;     }          add_action( 'init', 'cmb_initialize_cmb_meta_boxes', 9999 );     /**      * Initialize the metabox class.      */     function cmb_initialize_cmb_meta_boxes() {              if ( ! class_exists( 'cmb_Meta_Box' ) )             require_once 'init.php';          }      Code from my "script-metabox-template-toggle.js"               jQuery(document).ready(function() {         // in this functions hide all the custom metaboxes that are used         function hide_all_custom_metaboxes() {             jQuery('#page-facilities').hide();             jQuery('#page-services').hide();             jQuery('#page-storage').hide();         }              function show_custom_metabox(meta_id) {             var selector = "#" + meta_id;             if(jQuery(selector).length)                 jQuery(selector).show();         }              function toggle_wp_editor(current_metabox) {             jQuery('#postdivrich').show();             switch(current_metabox) {                 case 'facility':                     //jQuery('#postdivrich').css("display","none");                     show_custom_metabox("page-facilities");                 break;                 case 'services':                     jQuery('#postdivrich').css("display","none");                     show_custom_metabox("page-services");                 break;                 case 'storage':                     jQuery('#postdivrich').css("display","none");                     show_custom_metabox("page-storage");                 break;                  }         }              function get_template_html_id() {             current_metabox = jQuery('#page_template option:selected').val();             current_metabox = current_metabox.replace('template.','');             current_metabox = current_metabox.replace('.php','');             /*if(current_metabox == "default") {                 current_metabox = "content-default";             }*/             return current_metabox;         }              hide_all_custom_metaboxes();              var current_metabox = get_template_html_id();              show_custom_metabox(current_metabox);         toggle_wp_editor(current_metabox);              jQuery('#page_template').bind("change", function() {             hide_all_custom_metaboxes();             show_custom_metabox(get_template_html_id());             toggle_wp_editor(get_template_html_id());         });          });      Any suggestions on how to make my custom template work?


title: How to modify the comments list in WP & BuddyPress?

text: I'd like to modify the **comments list** (comments left by users) on WP site using BuddyPress. In **comments.php** I narrowed it down to the following code:               <?php wp_list_comments( array( 'callback' => 'bp_dtheme_blog_comments' ) ); ?>      Any clue where I can find **bd_dtheme_blog_comments** , and the best way to modify it? Thank you.


title: When adding buttons to the tinyMCE editor, how do I make them wrap to the next line and/or display in the "Kitchen Sink" area?

text: I'm successfully adding buttons to the TinyMCE editor in Wordpress, but the problem is they all show up to the right of the Kitchen Sink button and I have so many that I need them to display on a new line. How do I make the buttons wrap to the next line and/or create a new row for my custom buttons? Here is my code:               tinymce.create('tinymce.plugins.boxlight', {         init : function(ed, url) {             ed.addButton('boxlight', {                 title : 'Add a light content box',                 image : url+'/images/box-light.png',                 theme_advanced_buttons3_add : 'boxlight',                 onclick : function() {                      ed.selection.setContent('[box_light]' + ed.selection.getContent() + '[/box_light]');                      }             });         },         createControl : function(n, cm) {             return null;         },     });          tinymce.PluginManager.add('boxlight', tinymce.plugins.boxlight);      That code just adds the buttons to the main TinyMCE toolbar and I can't figure out how to add the buttons to a new toolbar.


title: Custom Content Type with No Page View

text: I am trying to define a custom content type, more exactly I want to create some controls in a content type for a slider that I will show on the home page custom template. What I would like to know if it's possible to make the content type to don't have a view (a actual page where it would show up).