Custom post type in submenu with custom meta box as a title with custom html

I am trying to create a menu in wordpress using a custom post type as the main menu item at the top level and all of its childs are going to be included from the posts i create inside it. The html i would like to try and create is:

Home

Products

Seating

Custom post link

Custom post link

Custom post link

Desking

Custom post link

Custom post link

Custom post link

Accessories

Custom post link

Custom post link

Custom post link

column4

Custom post link

Custom post link

Custom post link

      I have created a custom post type like so:               register_post_type( 'products',             array(                 'labels' => array(                     'name' => __( 'Products' ),                     'singular_name' => __( 'Product' )                 ),                 'show_ui' => true,                      'capability_type' =>  'post',                 'has_archive' => true,                 'show_in_nav_menus' => true,                 'rewrite' => array('slug' => 'products'),                 'supports' => array(                     'title',                     'editor',                     'custom-fields',                     'revisions',                     'thumbnail',                     'page-attributes'                 )             )         );      I also have on that custom post a custom meta box to select what category the product is in like so:               function products_category_meta_box_cb($post) {         global $post;         wp_nonce_field('products_category_nonce', 'products_category_meta_box_nonce');         $values = get_post_custom($post->ID);              $menu_value = isset($values['products_category']) ? esc_attr($values['products_category'][0]): '';              $services_array = array('Seating' => 'seating', 'Desking' => 'desking', 'Accessories' => 'accessories');              echo '
Select the product category.
';              echo '<select name="products-category">';         foreach ($services_array as $key => $value) {             echo '<option value ="' . $value . '"' . selected($menu_value, $value, false) . '>' . $key . '</option>';         }         echo '</select>';     }      what i would like to do is for all of the seating products go inside one li with a class column so i can float them next to each other and the content of that li will be a title which it gets from that dropdown inside the post and then the custom post type links under that. I hope that makes sense, I know this is quite a complicated question so please ask me if you need some more explanation. Thanks for reading and would really appreciate your help Alex


How to pass multiple values in shortcode?

All I am using formidable plugin and on one page i need to use 5 shortcodes.               [frm-entry-delete-link id=9 page_id=25 field_key=hsn108]     [frm-entry-delete-link id=12 page_id=25 field_key=cp7pi]     [frm-entry-delete-link id=13 page_id=25 field_key=ksa9qv]     [frm-entry-delete-link id=14 page_id=25 field_key=9zuf6o]     [frm-entry-delete-link id=15 page_id=25 field_key=w8w7op]      Is that possible to pass this all in single short code ?


different way to achive stylesheet_url

I'd like to understand the difference between:               <?php bloginfo( 'stylesheet_url' ); ?>      and               <?php bloginfo('template_url'); ?>/style.css      because I think the second one is more flexible (is i decide to move the file in a subdirectory, for example. or if I have more stylesheet to add.. the second one seems smarter). Am I wrong? In particular, where is `'stylesheet_url'` stored? and how to change it?


How-to: Translate plural forms for themes/plugins with PoEdit

As the title says: How would you translate...   * `_n()`   * `_n_noop()`   * `_nc()`   * `_nx()`   * `_nx_noop()` ...in your .mo files?


Front Page Settings

I'm setting up a WordPress site that has Flash puzzles embedded in the pages. (My site will have pages instead of posts). Each week I'll add a new puzzle to the site's Home page. When the site loads you'll see the newest puzzle. Older puzzles would be accessed through a dropdown menu. My question is how should I design the permalink structure? Under Reading Settings, I plan to set the Front Page to static. And select the latest puzzle as the front page. The problem is that if someone bookmarks the Home page, they'll get the latest puzzle. Let's say this week's puzzle (on the Home page) is called "Astronomy". The path to the Home page would be, for example, www.mysite.com. Imagine that someone is a Carl Sagan nerd and wants to link to the Astronomy puzzle. After the week is over, a new puzzle would be on the front page. The "Astronomy" puzzle's path would now be www.mysite.com/astronomy and would be accessed through the dropdown menu. Is there a way to avoid this problem? (Other than a blurb on the Home page with a link to the puzzle)? Sorry, if this is an idiotic question. But, maybe someone has a good solution. Thank you! -Laxmidi


Method Not Implemented GET to wp-admin/post.php not supported

When I save a draft post I get this error. It hasn't happened before, and it only happens with one post. We are using commercial hosting.


wp_enqueue_script calling jQuery at different times for different browsers?

This makes no sense, but in looking at my view source across browsers, `wp_localize_script()` is inserting tags as expected for all browsers other than IE7,8,9. The script tag is simply not there in those browsers. I have it bound to "jquery", since I want to make sure it's included no matter what (rather than binding it to any specific user-defined script). It's being called in my theme's functions.php file. The documentation for wp_localize_script seems to suggest that the script must be registered before calling this function. Given that the function is always being called at the same place, it seems that perhaps jQuery is being enqueued or registered at different times depending on browser? That seems very odd indeed, as WordPress doesn't natively do a lot of browser detection out of the box. I can get wp_localize_script working if I bind it to one of my custom enqueued scripts and make sure the function call is immediately after that script is enqueued. This is why I suspect it has something to do with the queueing order of jQuery. Can anyone suggest what might be going on here?


Forcing reload of editor-style.css

Is there a method to force the refresh of `editor-style.css`, when I change manually the stylesheet for the TinyMCE editor? Modification doesn't show immediately but they will be cached in the admin side of administration backend. For example like this:               editor-style.css?ver=3393201


Add custom field to image editor

How do I add **custom field** to the **image editor** , such as under the image ' **Description** ' field? To be much clearer, it's where the settings for the images are after you upload an image in the attachment pop-up window.


How to move all theme templates into a subfolder WP

I'm looking for a wordpress function to move theme's templates into a subfolder (mytheme/templates). Anyone know? The solution can be paid (plugin) or free.


Is there a good plugin for social bookmarking on site for WordPress

I want to add a onsite social bookmarking system to a WordPress installation. is there any thing like this available?


How to create an automatic MultiColoumn MegaMenu with Categories WordPress

I'm looking for an easy to use step by step guide on how to create a MultiColoumn menu for categories on wordpress. Actually in my blog I have 10/12 "main" categories and a couple of them have something like 50 Sub-categories and I will add more so I need something Automatic to show them in my menu. Actually I have one but it is full of bugs. So I need something new please. This is my CSS (you can also write it from scratch, maybe it's better :P)               .videoCssMenucontainer {margin: 2px 0 0;}     UL.ws_css_cb_menu {background-color : #7F9DB9;width : 96%;margin:0 1.75% 10px 1.75%;font : bold 13px Arial, Helvetica, sans-serif;display : block;float : left;height : 33px;border-top-right-radius : 0;border-bottom-right-radius : 10px;border-bottom-left-radius : 10px;border-top-left-radius : 0;position:relative;z-index:10000;}     UL.ws_css_cb_menu LI {display : block;margin : 2px 0 0 2px;float : left;}     UL.ws_css_cb_menu A:hover UL, UL.ws_css_cb_menu A:hover A:hover UL, UL.ws_css_cb_menu A:hover A:hover A:hover UL {display : block;}     UL.ws_css_cb_menu A {display : block;vertical-align : middle;border-width : 0;border-color : #6655ff;border-style : solid;padding : 2px;color : #444444;text-decoration : none;text-align : left;}     UL.ws_css_cb_menu SPAN {overflow : hidden;}     UL.ws_css_cb_menu LI A:hover, UL.ws_css_cb_menu LI A {padding : 9px;color : #763319;}     UL.ws_css_cb_menum LI A:hover, UL.ws_css_cb_menum LI A {padding : 4px;font-weight : normal;color : #000;}     UL.ws_css_cb_menu UL {position : absolute;left : -1px;top : 98%;width : 160.65px;background-color : #ffffff;}     UL.ws_css_cb_menu UL UL {position : absolute;left : 98%;top : -2px;}     UL.ws_css_cb_menu, UL.ws_css_cb_menu UL {margin : 0;list-style : none;padding : 0 2px 2px 0;}     UL.ws_css_cb_menu A:active, UL.ws_css_cb_menu A:focus {outline-style : none;}     UL.ws_css_cb_menu UL LI {float : left;width : 150px;}     UL.ws_css_cb_menu UL A {white-space : nowrap;text-align : left;}     UL.ws_css_cb_menu LI:hover {position : relative;}     UL.ws_css_cb_menu LI:hover > A {background-color : #fff;color : #000;border-color : #665500;border-style : solid;text-decoration : none;}     UL.ws_css_cb_menu LI A:hover {position : relative;background-color : #fff;color : #000;text-decoration : none;border-color : #665500;border-style : solid;}     UL.ws_css_cb_menum LI A:hover {background-color : #ffc000;}     UL.ws_css_cb_menu IMG {border : none;float : left;margin-right : 4px;width : 16px;height : 16px;}     UL.ws_css_cb_menu UL IMG {width : 16px;height : 16px;}     UL.ws_css_cb_menu UL, UL.ws_css_cb_menu A:hover UL UL {display : none;z-index : 99999;}     UL.ws_css_cb_menu LI:hover > UL {display : block;}     UL.ws_css_cb_menu SPAN {display : block;padding-right : 11px;background-position : right center;background-repeat : no-repeat;}     UL.ws_css_cb_menu LI A TABLE, UL.ws_css_cb_menu LI A:hover TABLE {border-collapse : collapse;margin : -4px 0 0 -9px;border : 0 solid #000000;padding : 0;}     UL.ws_css_cb_menu LI A TABLE TR TD, UL.ws_css_cb_menu LI A:hover TABLE TR TD {padding : 0;border : 0 solid #000000;}     UL.ws_css_cb_menu LI A TABLE UL, UL.ws_css_cb_menu LI A:hover TABLE UL {border-collapse : collapse;padding : 0;margin : -4px 0 0 -9px;}     UL.videoCssMenu {font-size : 13px;width : 96%;margin:0 1.75% 10px 1.75%;background : #7F9DB9;color:#FFF;text-shadow: rgba(0, 0, 0, 0.398438) 1px 1px 1px;border : 0 solid #000000;}     UL.videoCssMenu .videoMenuTitleImage {margin : -2px 0 0 -2px;width : 79px;height : 30px;}     UL.videoCssMenu UL {left : 0;background-color : #857DA2;width : 430px;}     UL.videoCssMenu LI A {color:#FFF;text-shadow: rgba(0, 0, 0, 0.398438) 1px 1px 1px;padding: 5px !important;text-transform:uppercase;}     UL.videoCssMenu UL LI A {overflow: hidden; float:left;}     UL.videoCssMenu UL LI {width : auto;float : left;height : 27px;}     UL.videoCssMenu LI:hover > A, UL.videoCssMenu LI A:hover {background-color : #ffffff;border-radius : 5px;border-color : #fff;padding : 5px !important ;color : #000;}     UL.videoCssMenu LI UL LI:hover > A, UL.videoCssMenu LI UL LI A:hover {background-color : #ecb899;border-color : #fff;padding : 5px;color : #000;}     ul.ws_css_cb_menu ul ul ul{background:#ccc;color:#142E51;text-shadow:1px 1px 1px #000;}     ul.ws_css_cb_menu ul ul ul a{color:#142E51;text-shadow:1px 1px 1px #000;}     .ws_css_cb_menum LI {width:auto;height:20px;}      And this is my HTML/PHP:

Home

             Categorie
                 <?php wp_list_categories('sort_column=name&sort_order=name&style=list&children=true&hierarchical=true&title_li=0&dept=5&show_count=1&feed_image=/images/RSS.png'); ?>

             Pagine
                 <?php wp_list_pages('title_li='); ?>

             Hack

Proxy

Url Hider

HTML 2 bbCode Converter

             Seo

Pagerank

FREE Seo Services

Url Submitter

             Servizi CSS

CSS Button Generator

Favicon Generator

             Generatori Link Premium FREE

Supera il limite di Megavideo

Premium link generator

         <?php include('supsearch.php');?>
      I don't care about IE6 anymore, IE7 support will be enough, thank you to all for your help!


How to close wpdb connection?

Is there any method to close connection similar to mysql_close() for wpdb in wordpress? Is it not necessary to close connection for global wpdb?


Remove image in post when it's removed in media library

As the title says, I want to automatically remove a specific image in all posts where it's used when I remove the image from the media library. Because at the moment, if I remove an image from the media library the "empty image" stays in the post(so all the html code) but nothing is being displayed of course. Is there any way/plugin? Thanks in advance.


Redirect users on logout

Have multisite set up and would like to redirect users on logout to the root site home page. I know there has to be an answer for this. But I can't find it! driving me batty;-) Any help greatly appreciated.


Is the bulk_action hook stable for use in 3.2.X?

Working on a plugin for wp-ecommerce publish / unpublish all items in a category seems the cleanest place to implement this is in the categories page as a bulk action - though numerous google searches have turned up very little documentation and a series of posts on bug tracker so: Is it now safe to add a bulk_action-ID hook or should I make a custom sub- page in the admin? Thank you in advance


How to make user inactive by default while registering?

When user registers to my site I want to make them inactive by default so I can manually update their status and send them their login info. I am using wordpress 3.1.2. Is it possible? Are there any plugins for this? BTW, I am using Cimy User Extra Field plugin to add more fields to the registration page.


How do I add a menu item to a Pods admin menu?

I'm writing a plugin that will send a notification message to an external queue whenever a menu item is clicked. This function is related to some customized data structures I made using the Pods framework. I'd like to add the menu item under the sub-menu for a certain Pod. The Pod is named "spotlight." Currently the only items in there are "All Spotlights" and "Add New"... I'd like to add a third item below these two. In the code for my plugin, how do I add an additional menu item under this Pod's submenu?


jquery UI in wordpress admin

Does anyone have experience with using the jQuery UI plugins in the Wordpress admin area? I´ve been trying to use the datepicker functionality in jQuery UI, but its conflicting with the built- in jQuery in wordpress admin. http://docs.jquery.com/UI/Datepicker This is the error message I get in console:               Uncaught TypeError: Cannot read property 'apply' of undefined     a.widget.a.extend._trigger     b.Widget._createWidget     b.widget.b     b.widget.bridge.b.fn     c.extend.each     c.fn.c.each     b.widget.bridge.b.fn     postboxes.init     postboxes.add_postbox_toggles     (anonymous function)     c.extend.ready     L      What could I possibly do to avoid this conflict? Adding the code used to include the jquery:               wp_register_script( 'jquery-tooltip', 'http://cdn.jquerytools.org/1.2.5/jquery.tools.min.js');     wp_register_script( 'jquery-ui-datepicker', get_bloginfo('template_directory') . '/js/jquery-ui-1.8.8.custom.min.js' );     wp_register_script( 'jquery-admin-internal', get_bloginfo('template_directory') . '/js/jquery.admin.internal.js' );     wp_register_script( 'jquery-internal', get_bloginfo('template_directory') . '/js/jquery.internal.js' );          function enqueue_admin_jquery() {     wp_enqueue_script('jquery-ui-datepicker');     wp_enqueue_script('jquery-admin-internal');     }     add_action('admin_init', 'enqueue_admin_jquery');


How to use Head JS with all enqueued scripts?

I want to load head js first and then all enqueued scripts into it's function. Like so...               <script src=">/js/head.load.min.js" type="text/javascript" charset="UTF-8"></script>          <script type="text/javascript">     head.js("/path/to/jquery.js", "/google/analytics.js", "/js/site.js", function() {             // all done          });     </script>      How would I do this? For those that don't know HeadJS is the 2.30KB script that speeds up, simplifies and modernizes your site... http://headjs.com/


how to use custom post types collectively integrated with each other

i will star with some back ground and my goal before i gt to the point i am trying to make a anime viewing website using wordpress like www.watchanimeon.com and www.animedreaming.tv i tried a couple of techniques like tiring to use custom fields to store data but of no avail as they all got way too complected for a little guy like me . _i use categories for the anime series and post for the episodes them selves but for the part where i wanted my sits users or members to be able to add mirror videos i got stuck i came up with the half solution of my problem with wordpress oembbed feature or though to useautoembed in my template but the area where i wanted the ablity of mirror videos i tried to use tdo mini forms but did not succeeded because of knowing no means of saving this data in the post it self_ then i came assross these wordpress custom post types and after the release of bbpress 2 it accord to me that if i could separate post types for series, episodes and mirrors (or videos) like in bbpress forums, topics and posts and have a series act like category then i will also be able to tag anime generas and the series will list the episodes associated with and every episode list the videos associated with it most of my work will be done but i cant find any way to do this as i told earlier that i am a little guy in the field don't know much about programming and learns by google so please help me plz plz and in any case any one of you still dont understand what i am trying to accomplish check this (http://www.watchanimeon.com/sket-dance-episode-30/) link thats what i want to be able to do and also look at the bbpress2 to see what i am trying to accomplish.


What is the best workaround for supporting all existing DATEs?

I want to make a weblog that has with every date 1 or more weblog posts, e.g.: **Januari 24 Year 41 : Roman Emperor Caligula was murdered by Cassius Chaerea and the disgruntled Praetorian Guards. Caligula's uncle Claudius was proclaimed emperor in his place.** or **Januari 1 Year 153 BC : Roman consuls begin their year in office.** or **Februari 1 Year 2038 : Humans survived** What would be the best way to do this in WordPress if I want to support URL hacking? p.s. custom fields + custom posts + custom taxonomy was the first thing I thought of but maybe there are better alternatives relying on the current date system. related: http://en.wikipedia.org/wiki/Unix_time#Representing_the_number


How can I access 'key' and 'value' from an array in a for loop?

How can I change the for loop below so that I can assign the array's "key" value as the "value" for each input instead of the array's "option" value as I'm now doing (I still want to echo the array's "option" value as the label)?               $myradiooptions = array("grid1" => "Grid View (default)", "list1" => "List View (1 column)", "list2" => "List View (2 column)" );          $options = array (     array( "name" => "My Theme Options","type" => "title"), array( "type" => "open"),          array(  "name" => "Category Layout",          "desc" => "description goes here",          "id" => "my_category_layout",          "type" => "radio",         "options" => $myradiooptions ),              ...etc}          //switch, case "radio":     ?>
         <label class="left" for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>         <?php $count=1;foreach ($value['options'] as $option) { ?>         <input type="radio" name="<?php echo $value['id']; ?>" id="<?php echo $count; ?>" value="<?php echo $option; ?>" <?php checked($option, get_settings($value['id'])); ?>/><label style="color:#666; margin:0 20px 0 5px;" for="<?php echo $count; ?>"><?php echo $option; ?>       <?php $count++;} ?>         <?php echo $value['desc']; ?>
     <?php     break;


Replace wordpress login logo with custom text

I wanted to replace the wordpress logo which is displayed on login screen with some custom text. Here is the code what I tried so far:               function my_custom_logo() {     echo '<style type="text/css">     #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/wp-logo.png) !important; }';     }     add_action('admin_head', 'my_custom_logo');      It can replace the logo but what should I need to replace it with some text? Any suggestions to make it work?


"There doesn't seem to be a wp-config.php file." despite wp-config.php in root

I've encountered an odd problem and I'm not at all sure how to go about fixing it.. I have a site that was working fine until I changed a page title from "PRESS" to "BLOG." Now, when you visit the blog page, this error comes up: > There doesn't seem to be a wp-config.php file. I need this before we can get > started. Need more help? We got it. You can create a wp-config.php file > through a web interface, but this doesn't work for all server setups. The > safest way is to manually create the file. What's especially odd about this is, both wp-config.php and wp-config- sample.php are in the site root. Any ideas what's going on and how to remedy? Thank you.


Pagination not working Page2 Not Found

I'm newbie at php and wp. I'm using query_posts and custom post type. But doesn't work pagination link and says page 2 "Not Found". Searched from Google too many hours but not found any resolution. Hope you help me. Thanks. My Loop:               <?php             $args = array(                 'posts_per_page' => 3,                 'post_type' => 'movie'             );             query_posts($args);             if ( have_posts() ) : while ( have_posts() ) : the_post();         ?>
                 <a href="<?php the_permalink() ?>">                          <?php the_post_thumbnail( array() ); ?>                              <?php the_title(); ?>
                         <?php if( get_field('movie_translation') ): ?>                             <?php the_field('movie_translation'); ?>                         <?php endif; ?>

                         <?php $terms = wp_get_post_terms($post->ID,'movie_category');                             $count = count($terms);                             if ( $count > 0 ){                             echo "";                             foreach ( $terms as $term ) {                             echo $term->name . "<comma class='genres-term'>, </comma>";                             }                             echo "";}                          ?>

              <?php endwhile; else: ?>
<?php _e('Sorry, Not found.'); ?>
         <?php endif; ?>
         <?php wp_pagination(); ?>      Function:                   /* WP custom numeric pagination */     function wp_pagination() {         global $wp_query;         $big = 12345678;         $page_format = paginate_links( array(                 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),                 'format' => '?paged=%#%',                 'current' => max( 1, get_query_var('paged') ),                 'total' => $wp_query->max_num_pages,                 'type'  => 'array'         ) );         if( is_array($page_format) ) {             $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');             echo '

';             foreach ( $page_format as $page ) {                 echo "
$page
";             }                 echo '

';             }         }


GET user's metadata, list it in descending order and GET user's list number

I have a custom user metadata with meta_key _reputation_. The value is numeric. It is like a points system. The higher value the user has, the higher _reputation_ they have. How do I GET where each user ranks. I want to GET the number of which the user ranks to others. Browsing the database, all I need to do is to list the value in a descending order and I can see who is ranked at 1 (has most points) and so on... Is there any way I can show the rank number to the user?


Can't add custom Taxonomy to Custom Post Type

I am unable to add taxonomy to custom post types. But for same code if I add 'post' or 'page' it shows up fine. I can't pinpoint the problem. Here is the code. To register custom post type - working fine _register_taxonomy($key, 'SH_job_listings', $value);_ if i replace 'SH_job_listings' with post or page it works fine but not for custom post type i created.               class SH_job_post_class{              public function  __construct(){             $this->register_job_Listings();             $this->add_taxonomies();              }              public function register_job_Listings(){             $args = array(                 'labels' => array(                     'name' => 'Job Listings',                     'singular_name' => 'job Listing',                     'add_new' => 'Add New Job',                     'add_new_item' => 'Add New Job',                     'edit_item' => 'Edit Jobs',                     'new_item' => 'New Item',                     'view_item' => 'View Item',                     'search_item' => 'Search Jobs',                     'not_found' => 'No Job Found',                     'not_found_in_trash' => 'No Job Found In Trash'                 ),                 'query_var' => 'job',                 'rewrite' => array(                     'slug' => 'jobs/'                 ),                 'public' => true,                 'menu_position' => 5,                 //'menu_icon' => admin_url().                 'supports' => array(                     'title',                     'thumbnail',                     'editor',                     'custom_fields'                 )             );                  // This function is actually registering post type             register_post_type('SH_job_listings', $args);         }              public function add_taxonomies(){             $taxonomies = array();                  $taxonomies['job'] = array(                 'hierarchical' => true,                 'show_ui'  => true,                 'show_admin_column'=> true,                 'query_var' => 'job_type',                 'rewrite' => array(                     'slug' => 'job/job_type'                 ),                 'labels' => array(                     'name' => 'job type',                     'singular_name' => 'Job Type',                     'edit_item' => 'Edit Job Type',                     'update_item' => 'Update Job Type',                     'add_new_item' => 'Add  Job Type',                     'new_item_name' => 'New Job Type',                     'all_items' => 'All Job',                     'popular_items' => 'Popular Job Types',                     'search_items' => 'Search Job Types',                     'separate_items_with_commas' => 'Separate Job Types with commas ',                     'add_or_remove_items' => 'Add or Remove Job Type',                     'choose_from_most_used' => 'Choose from most used Job Type'                      )             );             $this->register_all_taxonomy($taxonomies);              }         public function register_all_taxonomy($all_taxonomy){                  foreach($all_taxonomy as $key => $value){                 register_taxonomy($key, 'SH_job_listings', $value);             }              }          }          add_action('init', function(){         new SH_job_post_class();     });


changing the default picture size link url

when i'm inserting a single picture thumbnail from the gallery with a link to the original picture, it gives me this:                     but i want it to check if there is a smaller version of the large picture (like a 1024x1024 witch is an image_size of mine) and if there is echo this (pat attention to the file name at the end of the href attribute:                     if there isn't a file in that size, echo the usual. anybody knows how do to this? the reason i'm looking for it, is because i don't want my clients to start resizing images from his digital camera. up until now if i'm not resizing the picture the file will be maximum size, witch in most cases is 4600x3400 or something like this (ths is whats coming out from the digital cameras by default). anyone? thanks.


Fix encoding â€™

I moved my hosting provider and now the encoding is messed up. See here for example. In the past commenting out the follwoing lines fixed the issue for me, but not this time: > //define('DB_CHARSET', 'utf8'); > > //define('DB_COLLATE','utf8_unicode_ci'); The hosting provider is saying I need to set it to the correct encoding rather than just comment it out, but I'm unsure what encoding that would be. Example Text: > Youâ€™ll be in good company. Join our network of leading RC sponsors that > have help support the growth of HeliReviews.


new to javascript - using in <head> instead of functions.php, not loading correctly

Live site. I've decided to incorporate javascript in my new theme; this is my first time doing so and have pieced together what I've down with help of blog posts and forums. I have the javascript within the tag instead of in functions.php. I've noticed the site ceases to load after the navigation which is controlled by javascript which leads me to believe that is where the problem is, I just don't know exactly how to pinpoint exactly what's causing the trouble. Any help sorting this out is greatly appreciate.               <!DOCTYPE html>     <html>     <head>             <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />             <meta name="generator" content="Wordpress <?php bloginfo('version'); ?>" />             <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />             <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>             <link rel="pingback" href="<?php bloginfo('pingback url'); ?>" />             <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />             <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" />             <link rel="shortcut icon" href="<?php bloginfo('stylesheet_directory'); ?>/favicon.ico" />             <?php wp_head(); ?>             <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>             <script>                 $(window).load(function(event) {                     $('#Nav a').click(function() {                         $('#Nav li').removeClass();                         $(this).parent().addClass("current");                                                           });             </script>             <script type="text/javascript">                     var _gaq = _gaq || [];                     _gaq.push(['_setAccount', 'UA-32783537-1']);                     _gaq.push(['_trackPageview']);                          (function() {                     var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;                     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';                     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);                     })();             </script>             <script>                     $(document).ready(function() {                       function filterPath(string) {                       return string                         .replace(/^\//,'')                         .replace(/(index|default).[a-zA-Z]{3,4}$/,'')                         .replace(/\/$/,'');                       }                       var locationPath = filterPath(location.pathname);                       var scrollElem = scrollableElement('html', 'body');                            $('a[href*=#]').each(function() {                         var thisPath = filterPath(this.pathname) || locationPath;                         if (  locationPath == thisPath                         && (location.hostname == this.hostname || !this.hostname)                         && this.hash.replace(/#/,'') ) {                           var $target = $(this.hash), target = this.hash;                           if (target) {                             var targetOffset = $target.offset().top;                             $(this).click(function(event) {                               event.preventDefault();                               $(scrollElem).animate({scrollTop: targetOffset}, 400, function() {                                 location.hash = target;                               });                             });                           }                         }                       });                            // use the first element that is "scrollable"                       function scrollableElement(els) {                         for (var i = 0, argLength = arguments.length; i <argLength; i++) {                           var el = arguments[i],                               $scrollElement = $(el);                           if ($scrollElement.scrollTop()> 0) {                             return el;                           } else {                             $scrollElement.scrollTop(1);                             var isScrollable = $scrollElement.scrollTop()> 0;                             $scrollElement.scrollTop(0);                             if (isScrollable) {                               return el;                             }                           }                         }                         return [];                       }                          });             </script>             <script>                     $(function() {                         $.fn.scrollBottom = function() {                             return $(document).height() - this.scrollTop() - this.height();                         };                              var $el = $('#nav>div');                         var $window = $(window);                         var top = $el.parent().position().top;                              $window.bind("scroll resize", function() {                             var gap = $window.height() - $el.height() - 10;                             var visibleFoot = 340 - $window.scrollBottom();                             var scrollTop = $window.scrollTop()                                  if (scrollTop < top + 10) {                                 $el.css({                                     top: (top - scrollTop) + "px",                                     bottom: "auto"                                 });                             } else if (visibleFoot > gap) {                                 $el.css({                                     top: "auto",                                     bottom: visibleFoot + "px"                                 });                             } else {                                 $el.css({                                     top: 0,                                     bottom: "auto"                                 });                             }                         }).scroll();                     });             </script>     </head>


Help me edit a variable with php

I'm using the plugin Multiple Content Blocks, which creates separate windows for content so that you can have, say, a 2-column template for a page; one column is editable in the standard TinyMCE window and below it is a second TinyMCE window where you can add/edit the content for the second column. What's nice is that you can work on the page in one place instead, for example, making the second column a "sidebar" and then going to the widgets page and using a Text Widget. I primarily design templates for business sites as opposed to blogs and most of the time content in additional columns aren't widgets. To create the second window you place this in the template:               <?php the_block('blockname'); ?>      You name the block something, of course. It's nice and simple and there's only 2-3 pages of code with the plugin so it's light. The only drawback is that you have to create a separate template for each page that uses a content block. But, the developer has in his readme.txt the following: "Use the function get_the_block instead of the_block, like this:                <?php $content_to_edit = get_the_block('blockname'); ?> and you can now edit this variable with PHP."      What I would like to be able to do is use one template; specify something to the effect of : if this page, use this block - but I don't know how to write it or even if it is possible. I don't know if I'd have to add something to the functions page as well. Can anyone advise? BTW I wrote the plugin developer who replied that he doesn't provide support for the plugin and good luck.


User registration problem in WordPress

I am trying to make a user registration form in my site's side bar. Users are able to register but instead of getting a success message, WordPress usually redirect them to 404 page. Below is my form:               <form id="joinmaillist"   method='post'>

                 Name	                 <input type="text" placeholder="Your name here.." name="name" title="Please enter your name" required/>

                 Email	                 <input type="email" name="email" placeholder="Your email here.." required/>

                 	                 <input class="submitmail" type="submit" value="Join!" name="joinm"/>

     </form>      and below is my PHP code:               <?php     if (isset($_POST['joinm'])){         $user_name=$_POST['name'];         $email =$_POST['email'];               $user_id=  username_exists($user_name);              if (!$user_id){             $random_pass = wp_generate_password(12, false);             $user_id=wp_create_user($user_name, $password, $email);             header('Location:' . $_SERVER['REQUEST_URI']);         }else{              }     }


Problem Saving Custom Post Type Meta Values

I need a second set of eyes. I am unsure why this code is not saving properly. Basically I hit save and my field values disappear. I have two other post-types saving fine using this structure. I feel I've just been looking at a screen too long and am missing something. :) Any suggestions? Thanks! Nadine               <?php      // adding a custom post type for books      add_action('init', 'books_register');          function books_register() {              $labels = array(             'name' => _x('Books', 'post type general name'),             'singular_name' => _x('Book', 'post type singular name'),             'add_new' => _x('Add New', 'Book'),             'add_new_item' => __('Add New Book'),             'edit_item' => __('Edit Book'),             'new_item' => __('New Book'),             'view_item' => __('View Book'),             'search_items' => __('Search Books'),             'not_found' =>  __('No Books found'),             'not_found_in_trash' => __('No Books found in Trash'),             //'has_archive' => true,             'parent_item_colon' => ''                   );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','author','excerpt','thumbnail'),             'taxonomies' => array('book_publisher','post_tag'),                );               register_post_type( 'tf_books' , $args );              // make some taxonomies              register_taxonomy('book_publishers','tf_books',             array(                 'hierarchical' => true,                 'label' => 'Book Publisher',                 'query_var' => true,                 'rewrite' => true             )         );                add_action("admin_init", "tf_book_deets_create");                  function tf_book_deets_create(){                 // this is for sorting the post                 add_meta_box('tf_book_details', 'Book Details', 'tf_book_details', 'tf_books');             }                  // values and output (or where it ALWAYS FUCKS UP)                  function tf_book_details () {                 global $post;                      $custom = get_post_custom($post->ID);                      $article_date = $custom["tf_book_author"][0];                 $article_date = $custom["tf_book_afirst"][0];                 $article_date = $custom["tf_book_isbn"][0];                 $article_date = $custom["tf_book_dts"][0];                 $article_date = $custom["tf_book_price"][0];                                ?>

Author Last Name:<input name="tf_book_author" value="<?php echo $tf_book_author; ?>" />

Author First Name:<input name="tf_book_afirst" value="<?php echo $tf_book_afirst; ?>" />

Book ISBN:<input name="tf_book_isbn" value="<?php echo $tf_book_isbn; ?>" />

Book Details:<input name="tf_book_dts" value="<?php echo $tf_book_dts; ?>" />

Book Price:<input name="tf_book_price" value="<?php echo $tf_book_price; ?>" />

                   <?php             } // end of book details                       // save this shit                  add_action ('save_post', 'save_book_details');                    function save_tf_book_details(){              global $post;                  update_post_meta($post->ID, "tf_book_author", $_POST["tf_book_author"]);                 update_post_meta($post->ID, "tf_book_afirst", $_POST["tf_book_afirst"]);             update_post_meta($post->ID, "tf_book_isbn", $_POST["tf_book_isbn"]);             update_post_meta($post->ID, "tf_book_dts", $_POST["tf_book_dts"]);               update_post_meta($post->ID, "tf_book_price", $_POST["tf_book_price"]);                  }               } // end of book_deets_create() ?>


why don't I get error messages in admin when developing?

I am curious as to why my screen goes completely blank when an error is present in my code. This only happens to me when it is an admin function. No warnings, no syntax error messages, nothing. Just a blank screen. Which makes it really difficult to find the problem. How do I get the errors to show up and how do I stop the blank screen? Thanx in advance!


How to disable image thumbnails from media manager but not post media uploader?

I'm trying to use the script below in order to disable automatic thumbnail generation when images are uploaded via the media manager. I'd like to leave the thumbnail option intact when an image is uploaded directly to a post, because that uploader gives the user the ability to specify the image size. The problem is that it disables thumbnail options in both places. I want to allow thumbs everywhere except the media manager upload.               if ($pagenow == 'media-new.php' || $pagenow == 'async-upload.php'){         add_filter('intermediate_image_sizes_advanced','disable_thumbnails');         }          function disable_thumbnails($arr_sizes){         if(!stristr($_POST['type'], 'image')){             return array();         }         return $arr_sizes;     }


add_filter to youtube embeds?

hey guys, when posting a youtube video link in the backend (in a post or a page) wordpress is automatically creating the embed code for me. Is it possible to add a filter to that? I'd love to change the width and height of all embedded videos to 100%? e.g.               <object width="100%" height="100%">     <param name="movie" value="http://www.youtube.com/v/rBa5qp9sUOY?version=3">     <param name="allowFullScreen" value="true">     <param name="allowscriptaccess" value="always">     <embed src="http://www.youtube.com/v/rBa5qp9sUOY?version=3" type="application/x-shockwave-flash" width="100%" height="100%" allowscriptaccess="always" allowfullscreen="true">     </object>`      Any idea how to solve this? edit: Or is it at least possible to add a classname to the object tag so I can use javascript to influence with and height of the embedded video? update: Thank you I tried the following piece of code but it doesn't work?               add_filter('oembed_result','oembed_result', 10, 3);          function oembed_result($html, $url, $args) {              // $args includes custom argument         // modify $html as you need              //return $html;      }      if return $html is a comment no youtube video should appear right, however it does!


How to add a textarea to only one of the fields of this custom metabox?

This is the code I used to create the meta boxes:               <?php          $key = "project";     $meta_boxes = array(         "project_services" => array(             "name" => "project_services",             "title" => "Services",             "description" => "List the services provided for the project."),         "project_name" => array(             "name" => "project_name",             "title" => "Name",             "description" => "Write the name of the project."),         "project_overview" => array(             "name" => "project_overview",             "title" => "Overview",             "description" => "Write an overview of the project.")         );          function create_meta_box() {         global $key;              if( function_exists( 'add_meta_box' ) ) {             add_meta_box( 'new-meta-boxes', ucfirst( $key ) . ' Description', 'display_meta_box', 'post', 'normal', 'high' );         }     }          function display_meta_box() {         global $post, $meta_boxes, $key;     ?>
          <?php         wp_nonce_field( plugin_basename( __FILE__ ), $key . '_wpnonce', false, true );              foreach($meta_boxes as $meta_box) {             $data = get_post_meta($post->ID, $key, true);     ?>
     <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?>     <input type="text" name="<?php echo $meta_box[ 'name' ]; ?>" value="<?php echo htmlspecialchars( $data[ $meta_box[ 'name' ] ] ); ?>" />
<?php echo $meta_box[ 'description' ]; ?>

          <?php } ?>
     <?php     }          function save_meta_box( $post_id ) {         global $post, $meta_boxes, $key;              foreach( $meta_boxes as $meta_box ) {             $data[ $meta_box[ 'name' ] ] = $_POST[ $meta_box[ 'name' ] ];         }              if ( !wp_verify_nonce( $_POST[ $key . '_wpnonce' ], plugin_basename(__FILE__) ) )             return $post_id;              if ( !current_user_can( 'edit_post', $post_id ))             return $post_id;              update_post_meta( $post_id, $key, $data );     }          add_action( 'admin_menu', 'create_meta_box' );     add_action( 'save_post', 'save_meta_box' );          ?>      Then, I changed the input to a textarea:               <textarea name="<?php echo $meta_box[ 'name' ]; ?>">     <?php echo htmlspecialchars( $data[ $meta_box[ 'name' ] ] ); ?>     </textarea>      This turns all the three fields into text areas. I would like to only make the third field, `project_overview` a textarea. Any suggestions?


WooCommerce - Display product child categories from specific parent

I want to edit the following piece of code:               <?php if ( (!$theretailer_theme_options['category_listing']) || ($theretailer_theme_options['category_listing'] == 0) ) { ?>                          <?php $gbtr_product_cats = strip_tags($product->get_categories('|||', '', '')); //Categories without links separeted by ||| ?>
<a href="<?php the_permalink(); ?>"><?php list($firstpart) = explode('|||', $gbtr_product_cats); echo $firstpart; ?>
             <?php } ?>      Example: http://tjwillems.nl/priveekollektie/product-category/artists/reinier- bosch/ The red-title under the product image only needs to show the child categories of 'artist'. So for example only 'Reinier Bosch' and not 'Lighting' Can somebody help me? Greetz, Tom


Minor css-change based on topmenu - how?

I want to make minor css-changes based on the choice of the top (root) menu. What's the proper way to handle this in WP? //edit// It's a website (pages), no blog, and basically, the colors of some links and some images should depend of the choosen top-menu-item. Example, page-structure:               * Start     * Products       * Prod.categ.         * A product     * Services       * List of services         * Nested     * Contact       * Main office         * List of staff       * Abroad         * Another list      Top level is in a topmenu, one-level, and level2&3 in nested left-menu. Now minor coloured items in sidemenu changes depending on selected top-menu item. //end edit// regards, /t


I have a desktop and a laptop: What's the best way to move between local installations?

I'm running several Wordpress installs on my desktop machine using XAMPP. I would like to move them to my laptop as well. Can I simply copy the htdocs, mysql and phpMyAdmin directories to the laptop, replacing the ones from the new install? What if I copied everything in the directory structure under XAMPP? Will this work, or will everything go gruesomely wrong? If so, what is the right way? **UPDATE** - Tried copying the desktop files to the laptop. A combination of lack of sleep, XP to Windows 7 and bad juju made this a case of epic fail. To get things done quickly, I resorted to doing an XML export and reinstalling my theme on the laptop in order to do the demo.


Time & Date on Post - Time Ago Custom Function

I'm using the following custom function to display the timestamp for a post as posted " **X minutes ago** " or " **X days ago** " for 14 days and then this changes to the actual date (e.g. **17th December 2010** ):               add_filter('the_time', 'dynamictime');     function dynamictime() {       global $post;       $date = $post->post_date;       $time = get_post_time('G', true, $post);       $mytime = time() - $time;       if($mytime > 0 && $mytime < 14*24*60*60)         $mytimestamp = sprintf(__('%s ago'), human_time_diff($time));       else         $mytimestamp = date(get_option('date_format'), strtotime($date));       return $mytimestamp;     }      This is called with the standard code:               <?php the_time(); ?>      Is there a way to modify this to also include the time after 14 days so it would display as follows? (only after the 14 days) **17th December 2010 at 9:03pm** I have the extra code needed to do this but can't figure out how to create an array to display both the get_option with the word ' **at** ' in between too:               $date_format = get_option( 'date_format' );     $time_format = get_option( 'time_format' );


WP E-Commerce VS Shopp VS WooCommerce VS JigoShop

Hi I am in the process of creating a website for an importer who wants to showcase his products. There are over 1,500 products and they also need to be categorised by brand. At this point for this client I only need to display a catalogue with no options for actual purchasing, but he wants to be able to switch on the purchasing part in the near future if required. So that is my main reason for wanting to build this right now with an ecommerce plugin, rather than going for custom post types. I've indentified the following plugins that seem to be the leading ones at the moment:   * WP ECommerce   * Shopp   * WooCommerce   * JigoShop Given my requirements any tips for which one of these four would be ideal for me? I don't mind paying for a plugin. _Edit: I am considering things like user-friendliness, ability to use the plugin as a plain catalogue rather than an e-commerce system (switching off price display and carts), support for the plugin, documentation etc. I understand that maybe the 4 of them can be used successfully in my case, I was just looking for the opinion of people who have used more than one of the above, and can thus take a general view and say whether they liked one more than the other._


Adding dashboard widgets to show - custom post type stats, information from other plugins

I have a website and i need to be able to edit the dashboard widgets so it shows relevant information to the website. At the moment all that is showing is the right now widget. Inside this widget, i don't need the discussion section nor do i need posts and tags. What i do need is custom post types, for example products and news. So it would say products then how many products there are, like it does with pages. It would also be great if you could show information from other plugins. For example i'm using a plugin called Support Ticket Center, it would be great if you could show how many open support tickets there are and how many have been closed and things. Are there any plugins that can do this kind of customization? Or is it more complicated? Thanks **EDIT** : I've tried adding the following code to my functions.php file. It sort of works but the output is adding a lot of other divs and things. I don't understand where they are coming from.                   // wp_dashboard_setup is the action hook     add_action('wp_dashboard_setup', 'mycustom_dashboard_stats');          // add dashboard widget     function mycustom_dashboard_stats() {         wp_add_dashboard_widget('site_stat_widget', 'Site Stats','wp_dashboard_custom_post_types');     }          function wp_dashboard_custom_post_types() {         global $wp_registered_sidebars;              $num_posts = wp_count_posts( 'Product' );                   echo "\n\t".'
';         echo "\n\t".'
' . __('Content') . '
'."\n\t".'
';         echo "\n\t".'
';              // Posts         $num = number_format_i18n( $num_posts->publish );         $text = _n( 'Product', 'Products', intval($num_posts->publish) );         if ( current_user_can( 'edit_posts' ) ) {             $num = "$num";             $text = "$text";         }         echo '' . $num . '	';         echo '' . $text . '	';              echo '
';     }      This is the html code it is outputting.

Content

      This will output 'Content' then a huge gap then the number of products. I don't know why it's inserting all of the clear divs and things. How do i get it to output the html the same as the 'Right Now' widget, so it display properly and would also use the same css.


Cannot upload to new wordpress installation in subdirectory on same server as existing installation

To make a smooth transition to a new site, we created a fresh new wordpress installation (3.9.2) in a subfolder of the root, called wp2. (The intention is to eventually redirect entirely to this site) The original installation is still in the root and running fine. **I want to upload images but I can't do it.** Same applies for importing old posts from the first installation.               “Small-1.jpg” has failed to upload due to an error     The uploaded file could not be moved to wp-content/uploads.      Here's what I've tried:   * File permissions is 770 for wp-content and I can't seem to change this via FTP which is the only thing I have credentials for. However, it is the same in the original installation ( _where media upload does work_ ) is also set to 770.   * I've tried to set up a an .htaccess exclusion, but it doesn't seem to be working at this instance. I don't know if this could be a contributing factor or not. Any ideas what could be causing this error? Something which works perfectly fine in the root no longer works in the subdirectory...


Stop image resizing in particular case - is that possible?

As for an ad management plugin, I'm using WordPress' default media uploader. And WP Media Uploader automatically resizes images. But as the ad image is already resized (i.e.: 225 x 100px) it need not to resize into a new file for thumbnail (100 x 100px); because, that thumbnail is unnecessary for the site. The cause I presented here, may be a very minute for such a solution, but in case, there is any other massive issue that, in such plugin we can stop the auto resizing with WP Media Uploader only on that plugin-uploads - I think that can be a good solution for any site. **Is there a way to use WP Media Uploader, but can stop auto resizing images only onto that particular case uploads?** But I also know that, plugin like _Regenerate Thumbnails_ can override the rules and can do what I prohibited in my plugins for the site's space-savvy consumption.


How can I add a featured image to a page?

I need the ability to add an image to a page, like a featured image. How can I do that, and how do I get the featured image to display in page.php? It can be a plugin if what I am asking can't be done within Wordpress itself out of the box.


How to add events to a Google Calendar using an html form on Wordpress page

I have implemented a Calendar onto a Wordpress page which uses Google Calendar to display events via XML. I am looking to add, edit and delete events from my Wordpress page, I am aware of the API and am looking to make use of it, but the documentation doesn't really explain how to implement the code in a way that is I can understand. If someone could help me so I can interact with the Google Calendar via Wordpress that would be great!


Retrieve first image url from custom post with pagination

On my custom page with pagination I have 6 pictures from the last posts, so far so good. Have a look here: http:sayami.de My code:               <?php              global $wp_query;             $paged = (get_query_var('page')) ? get_query_var('page') : 1;            query_posts(array(            'posts_per_page' => '6',            'paged'=>$paged,           ));              $count = 0;             $wp_query->max_num_pages = 10;                   if (have_posts()) : while (have_posts()) : the_post();       ?>     <?php $count++; //update count ?>          <div class="xxx_<?php echo $count;?>"><img src=" <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium'); echo $image[0]; ?>" />
          <?php endwhile; ?>     <? endif; ?>      Now I try to get the the first image url from each page. I need the url for a small javascript outside this loop. I tried this, but the result is not the first image, but the 6th image.               <?php          $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium');          echo $image[0]     ?>      How can I get the first image url?


Change Author Name to Sitename on Frontend

How can I change the author name on the frontend to be the sitename instead without modifying theme? I am basically looking for something that I can package as plugin on my site that will no longer show the authors name whatsoever on the posts or pages on the frontend.


Check which registered sidebar a widget is added to

I have 2 registered sidebars in my theme one for **Products** and one for **Blog.** What I am trying to do is if my "Category" widget is added to the Product Sidebar the taxonomy is automatically set to "product_cats" and if added to the Blog Sidebar set the taxonomy to "category". This will allow my widget on the backend to update which categories it displays in the dropdown menu. I have been searching the **wp-includes/widgets.php** file for a method or property that contains the id or name of the Parent Sidebar of the widget but can't seem to find a way to do this. If I can get the name or id of the Parent Sidebar I would do something like this in the form method of my widget:               public function form( $instance ) {              $parent = getParentSidebarID($this); // How do you do this!              switch ($parent) {             case 'product-sidebar':                 $tax = 'product_cat';                 break;             case 'blog-sidebar':                 $tax = 'category';                 break;             default:                 $tax = '';                 break;         }     }      Is this possible?


how i can increase Featured thumbnails size?

when i open any post then 1st image show my featured image. i want to increase this size . see it or . i already try to increase from single.php to change this code
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnails/thumbnail-leadimg.jpg" width="610" height="320" alt="<?php the_title_attribute(); ?>" />
       but it's not working . my orginal code
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnails/thumbnail-leadimg.jpg" width="610" height="225" alt="<?php the_title_attribute(); ?>" />
      i don't understand how i can change it. my site http://www.dewdropzone.com .


Custom time range for the posts_where filter

I'm creating a function that displays the most viewed posts and would like to be able to show posts based on how old they are. Modifying the query is not really a problem. But since I can't pass any arguments to the function I can't modify the "-30 days" part.               function print_stuff($args) {         add_filter( 'posts_where', 'filter_where');         $posts = new WP_query($args);         remove_filter( 'posts_where', 'filter_where' );         // The loop     }          function filter_where($where = '') {         $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";         return $where;     }      I guess I could store the value in the DB and then retrieve it, but that would feel ugly. Any ideas?


jQuery to Create Button to Show/Hide WordPress Comments and to Hide Comments by Default

I am attempting to create a button to show/hide comments in WordPress. I am currently using the following script:                     Now, this code functions as expected insofar as creation of the button is concerned (i.e., it creates a button labelled "Show Comments"); however, the button, which is created by the script, does not function as expected (i.e., it does not show/hide the #comment-section div). The script works perfectly in my test environment, but when I attempt to deploy it on a live WordPress install, the aforementioned behaviour occurs. Here is a test install with the script currently implemented: http://zyniker13.com/2013/11/20/test-post/. As you can see, the button is present, but it does nothing. Thus far, I have tried placing the code in footer.php, comments.php, and separating the jQuery from the script (by placing the call to Google's CDN in the header and the script itself variously in the footer and comments.php). No matter where I put the code, I am unable to get it to work properly.


PHP nested If statement syntax

Hiya Guys! so I need some help with this:                           <?php                  $newsposts = new WP_Query('cat=restaurant');                  if ( is_front_page()) { echo '
Latest Restaurants

if ($newsposts->have_posts()) : while ($newsposts->have_posts()) : $newsposts->the_post();

                  endwhile, endif;
';                      } ?>      What I'm trying to do here is have an image slider of first post images (from restaurant category) display at the bottom of the page. I use DIVs to control placement/ style but I really need help with my PHP syntax ... I just cant figure it out... Any help would be greatly appreciated! Cheers


Give child-categories same class (the parent category-slug) as parent in menu list?

I am trying to do two things, which I have no idea how to do:   1. give child categories the same class as the parent category (which is the parent category-slug)   2. create a menu which displays my categories, where the child categories will be displayed as dropdown-items when hovering the parent categor Currently I am using this code to generate the classnames for my categories, and create my menu:               <?php         $args = array(             'hide_empty'               => 0          );            $categories = get_categories($args);          $menu = '
';         // iterate through your categories         foreach($categories as $category) {              $menu .= '
slug . '">' . 'term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">' . $category->cat_name . '' . '
'            }           $menu .= '
' . '
' . '
';         echo $menu;             ?>


How to use the 'comments_number' filter?

I'm not sure how to use this filter. Could someone show me an example? I'm trying to change `('0', '1', '%')` to `('0 Comments', '1 Comment', '% Comments')`. I'm using this function to get the comments number.                   function lpe_get_comments_number( $anchor='#comments' ) {             $return = '';             $return .= get_comments_number(); // '0', '1', '%'             $return .= '';             return $return;         }      I know I could just set the arguments here and call it a day, but I was hoping to store my custom functions away in a different file and handle their settings from the themes functions.php.


Add "alt" Attribute to GD Star Rating <img> Tags

I have try over a week to validate 4 images that are retrieved by a code with GD Star Rating plugin This is the code i have:               wp_gdsr_render_rating_results(array('template_id' => 49, 'rows' => 4, 'select' => 'post', 'hide_empty' => false, 'min_votes' => 0, 'min_count' => 0, 'excerpt_words' => 0, 'image_from' => 'custom', 'image_custom' => 'img', 'image_resize_x' => 72, 'image_resize_y' => 80,  ));      So the output look's like this: ![enter image description here](http://i.stack.imgur.com/aNkSh.jpg) I dig on google and I modify the code to get me the poster by a custom field. This I add to retrieve the picture from a custom field.               foreach ($all_rows as $row) {         if ($widget["image_from"] == "content") {             $row->image = gdFunctionsGDSR::get_image_from_text($row->post_content);         } else if ($widget["image_from"] == "custom") {                   $post_custom_id = get_post_meta($row->post_id, $widget["image_custom"], true);                  $row->image = get_bloginfo('url')."/scripts/timthumb.php?src=".get_bloginfo('url')."/wp-content/uploads/".get_post_meta($post_custom_id,"_wp_attached_file",true)."&h=70&w=55&zc=1";         }          else if ($widget["image_from"] == "trailer") {             $post_custom_id = get_post_meta($row->post_id, $widget["image_trailer"], true);// getVideoId is a custom function             $row->image ="http://img.youtube.com/vi/".$post_custom_id ."/0.jpg" ;              } else $row->image = "";              $row->image = apply_filters('gdsr_widget_image_url_prepare', $row->image, $widget, $row);              if ($row->image != "" && intval($widget["image_resize_x"]) > 0 && intval($widget["image_resize_y"]) > 0) {             $row->image = GDSRRenderT2::prepare_image($row->image, $widget["image_resize_x"], $widget["image_resize_y"]);         }      > Note: > > This is the original code line 139 http://code.google.com/p/gd-star- rating/source/browse/trunk/code/t2/render.php?r=1041 The code I added is :               $row->image = get_bloginfo('url')."/scripts/timthumb.php?src=".get_bloginfo('url')."/wp-content/uploads/".get_post_meta($post_custom_id,"_wp_attached_file",true)."&h=70&w=55&zc=1";                         }      So the question how can I add to the images the alt attribute to display in the html page. The error i get in http://validator.w3.org is               Line 580, Column 195: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.          …tent/uploads/Battleship_1333017069_2012.jpg&h=70&w=55&zc=1"/></div>


Import Wordpress XML File from Within Functions.php

I am developing a theme which has a different method of adding in content and so, the default install of Wordpress won't show any content because of this. I was wondering if it is possible to automatically import an XML file via means of an internal function and or hooks after the theme has been activated? > **User installs theme** > **User activates theme** > **Code behind the > scenes loads up an XML file and performs a silent import of its contents** Currently to import an XML file you have to install the Wordpress importer plugin for Wordpress and then manually import the file, select a user for associating the imported content with and deciding if you want to import media attachments. I find this step for the types of clients I am targeting too confusing and would like to effectively eliminate the need for this step. I did some digging into the Wordpress importer script and there are a lot of function calls, what would I have to do to strip out the parts where user input is required and import a file using the class and its methods directory? I'm not sure where to begin really. My clients are tradesmen, so even something as simple as importing an XML file stumps them and they don't have the time to do it so there is room for error especially if they try and import more than once causing duplicate pages. Thank you in advance. **Edit/Clarification** There seems to be a lot of confusion here. I am not asking how to check if a theme has been activated, I've got that part sorted. I am asking how I would go about parsing an XML import file and automatically importing it without user effort. I essentially want to automate the Wordpress import plugin which you can already use to manually import the XML file, choose author, choose to download and import attachments within my functions.php. Instead of needing a plugin or requiring my clients with lack of computer knowledge nor the want to learn how to do it using the plugin.


unsuccessful attempt to change domains- wordpress re-routing to old domain

I've tried to switch a website from zoparealty.com to zoparealtygroup.com. When I go to zoparealtygroup.com, I can see what appears to be a strictly HTML version of the site(no CSS, no php). zoparealtygroup.com/wp-admin takes me to Page Not Found with a URL **using the old domain**. What could be causing the problem? What steps can I take to remedy the problem?


Can't create more than 5 custom post types

I've registered 6 but only seems to output 5 on the wp-admin menu. If i delete one or the other it updates accordingly, so configuration of each one is correct as far as i know. I've also deactivated all plugins and changed menu position.               add_action('init', 'register_my_cpt_organisation');     function register_my_cpt_organisation() {         register_post_type('organisation_profiles', array(             'label' => 'Organisation Profiles',             'description' => '',             'public' => true,             'show_ui' => true,             'menu_position' => 15,             'show_in_menu' => true,             'capability_type' => 'post',             'map_meta_cap' => true,             'hierarchical' => false,              'rewrite' => array( 'slug' => 'organisation-profiles', 'with_front' => true),             'query_var' => true,             'supports' => array( 'title', 'editor', 'excerpt', 'trackbacks', 'custom-   fields', 'comments', 'revisions', 'thumbnail', 'author', 'page-attributes' ),             'labels' => array (                 'name' => 'Organisation Profiles',                 'singular_name' => 'Team Memeber',                 'menu_name' => 'Team',                 'add_new' => 'Add a Team Memeber',                 'add_new_item' => 'Add New Team Memeber',                 'edit' => 'Edit',                 'edit_item' => 'Edit Team Memeber',                 'new_item' => 'New Team Memeber',                 'view' => 'View Team Memeber',                 'view_item' => 'View Team Memeber',                 'search_items' => 'Search Team Memebers',                 'not_found' => 'No Team Memeber Found',                 'not_found_in_trash' => 'No Team Memeber Found in Trash',                 'parent' => 'Team',             )         )         );     }


Better way to detach media, via post edit

We need to be able to manage attached images more efficiently in WP4.0, I haven't been able to find a plugin that works optimally, in the way I am about to describe. We want to access the media library via the post and detach images without permanently deleting them. Most likely, we need to write a plugin, I envision it working as follows: Once you have accessed the media library and you view the attached images, you select the image you want to detach. ![Select Image](http://i.stack.imgur.com/WiD4Z.jpg) Now the image details display on the right of the media library dialog window, there should be a "detach" link below the delete option. ![enter image description here](http://i.stack.imgur.com/FDoG4.jpg) Click the link and a script detaches the images from this post. Does anyone have experience changing the media library in this way, could offer sound advice and a solid direction for me to send my developer down? I really can't afford us going down the wrong path, in the interest of time, so any assistance would just make me so happy! Much appreciated, Iggi


Disable /wp-admin/plugin-install.php

How can I disable plugin upload and installation via Wordpress Admin? Should still be able to activate/deactivate plugins in admin.


How to add a comments reply link?

I've used a custom comments.php file and it doesn't have a reply link, and when i use comment_reply_link i get nothing. It's some sort of emergency and i can't change my code. What should i do? This is my code by the way:               <?php if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) : ?>         <?php die('شما مجاز به دسترسی به این قسمت نیستید.'); ?>     <?php endif; ?>          <?php if(!empty($post->post_password)) : ?>         <?php if($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>         <?php endif; ?>     <?php endif; ?>
         <?php if($comments) : ?>
                 <?php foreach($comments as $comment) : ?>

<?php comment_author(); ?>

<?php comment_time(); ?> در <?php comment_date(); ?>

                             <?php comment_text(); ?>
                         <?php if ($comment->comment_approved == '0') : ?>                                                              نظر شما هنوز تایید نشده است.                                                      <?php endif; ?>
                 <?php endforeach; ?>
         <?php else : ?>         <?php endif; ?>              <?php if(comments_open()) : ?>             <?php if(get_option('comment_registration') && !$user_ID) : ?>
برای ارسال نظر باید <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">وارد حساب کاربری خود شوید.
             <?php else : ?>

ثبت نظر جدید
                     <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">                         <?php if($user_ID) : ?>
شما با نام <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?> وارد شده اید. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="خروج از این پروفایل">خروج
                         <?php else : ?>
                                 <input type="text" name="author" class="bit-3" id="author" placeholder="نام" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />                                 <input type="text" name="email" class="bit-3" id="email" placeholder="ایمیل" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />                                 <input name="submit" class="bit-4" type="submit" id="submit" tabindex="5" value="ارسال نظر" />
                         <?php endif; ?>                         <textarea name="comment" class="frame" placeholder="نظر خودتان را وارد کنید" id="comment" cols="100%" rows="10" tabindex="4"></textarea>                         <?php if($user_ID) : ?><input name="submit" type="submit" id="submit" tabindex="5" value="ارسال نظر" /><?php endif;?>                         <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />                         <?php do_action('comment_form', $post->ID); ?>                     </form>
             <?php endif; ?>         <?php else : ?>         <?php endif; ?>


Booking com wp-plugin and different browsers

My official wp plugin for booking.com generate form, and after i click on submit button i get such url: http://www.booking.com/searchresults.html?si=ai%2Cco%2Cci%2Cre%2Cdi&label=wp- searchbox- widget-398741&aid=398741&utm_campaign=search_box&utm_medium=sp&utm_term=wp- searchbox- widget-398741&ss=Amsterdam%2C+Netherlands&checkin_monthday=10&checkin_year_month=2014-9&checkout_monthday=11&checkout_year_month=2014-9&do_availability_check=on but in chrome i get directly to search result, and in firefox with the same url - to city selecting, where i have: Amsterdam NL and Nieuw-Amsterdam NL. But why same link result is different for every browser? How could i get directly to booking com Amsterdam, without selecting it once more? Is it real?


Loading jQuery UI in the head

I am trying to load jquery-ui-core and jquery-ui-slider in the head of my theme. Here is my code:               function load_jquery_ui() {         wp_enqueue_script( 'jquery-ui-slider' );     }          add_action( 'wp_enqueue_scripts', 'load_jquery_ui' );      The jQuery UI loads in the footer. But because I have some inline scripting (due to php implementation in the JS) I need it to load in the head. Anyone that has any idea how?


Subversion, github, etc.. version control systems/repositories

I'm developing WP as a heavily bespoke CMS. One of the five plugins required is already 2500 lines of code and isn't quite finished. I work between two machines - my laptop and my home PC. Generally, my working method involves FileZilla and Notepad++. I log on to whichever machine I need to use; download all of /wp-content/ from server to machine and then carry on work. This is quite a quick method of doing things, but it's poorly documented and fraught with risks of overwriting the wrong changes, etc. I've heard subversion/github etc. mentioned a lot, and I notice that most serious developers use them, but I have no idea what they are or where to get started. What are the benefits of using such systems? How do I go about getting involved? Realistically, will they save me time in the long run? I've looked at a few links but tend to disengage when the terminology starts flying over my head, so I'd appreciate some human-speak where possible. I'm quite a techy guy, PHP/SQL/JS etc, but little experience with best practice in terms of coding as I'm roughly 114% self-taught. Many thanks,


Admin Plugin POST to another file within the plugin

This is a simplified version of what I need to do (i.e. I know there are other ways of doing things but I need a solution to this specific problem). I am using wordpress 3.3 from a fresh install. I have a plugin and I have added it to the admin menu:               add_menu_page('Plugin','Plugin', 'edit_pages', 'plugin/page1.php');      which works fine, I can click on it it takes me to:               admin.php?page=plugin/page1.php      plugin/page1.php has a form on it:               <form action="admin.php?page=plugin/page2.php">      When I submit the form however I get a "You do not have sufficient permissions to access this page." page If I add plugin/page2.php as an menu or submenu item then i can submit to it with no problems. If i set the action of the form to be admin.php?page=plugin/page1.php the form submits fine also. My question is how do I get this to work? I suspect I have to register some thing somewhere I just have no idea what and searching has yielded nothing.


Delete pages and Create default pages for all new network sites

I am using the following code to delete some default pages and to also create some default pages for all new sites that are created. It work as is now but that is only because I purposely have a mistake there that whenever I correct, the functions stop working. This is the part of the code with the purposeful error ( I was also trying to use some code to choose a default page template but that didnt work )               function create_my_pages3($blog_id, $user_id){       switch_to_blog($blog_id);            // not really need, new blogs shouldn't have any content       if(get_page_by_title('contact')) return;            // create each page       $page_id = wp_insert_post(array(         'post_title'     => 'Attorneys',         'post_name'      => 'attorneys',         'post_content'   => 'This is your Attorney page.',         'post_status'    => 'publish',         'post_author'    => $user_id, // or "1" (super-admin?)         'post_type'      => 'page',         'menu_order'     => 3,         'comment_status' => 'closed',         'ping_status'    => 'closed',          // + see: http://codex.wordpress.org/Function_Reference/wp_insert_post       ));       update_post_meta( $id, '_wp_page_template', 'new_template.php' );            restore_current_blog();     }      Heres the full code               // Create Pages          add_action('wpmu_new_blog', 'create_my_pages', 10, 2);          function create_my_pages($blog_id, $user_id){       switch_to_blog($blog_id);            // not really need, new blogs shouldn't have any content       if(get_page_by_title('About')) return;            // create each page       $page_id = wp_insert_post(array(         'post_title'     => 'About',         'post_name'      => 'about',         'post_content'   => 'This is your about page',         'post_status'    => 'publish',         'post_author'    => $user_id, // or "1" (super-admin?)         'post_type'      => 'page',         'menu_order'     => 1,         'comment_status' => 'closed',         'ping_status'    => 'closed',          // + see: http://codex.wordpress.org/Function_Reference/wp_insert_post       ));              restore_current_blog();     }          add_action('wpmu_new_blog', 'create_my_pages2', 10, 2);          function create_my_pages2($blog_id, $user_id){       switch_to_blog($blog_id);            // not really need, new blogs shouldn't have any content       if(get_page_by_title('Contact')) return;            // create each page       $page_id = wp_insert_post(array(         'post_title'     => 'Contact',         'post_name'      => 'contact',         'post_content'   => 'This is your contact page.',         'post_status'    => 'publish',         'post_author'    => $user_id, // or "1" (super-admin?)         'post_type'      => 'page',         'menu_order'     => 2,         'comment_status' => 'closed',         'ping_status'    => 'closed',          // + see: http://codex.wordpress.org/Function_Reference/wp_insert_post       ));              restore_current_blog();     }          add_action('wpmu_new_blog', 'create_my_pages5', 10, 2);          function create_my_pages5($blog_id, $user_id){       switch_to_blog($blog_id);            // not really need, new blogs shouldn't have any content       if(get_page_by_title('Attorneys')) return;            // create each page       $page_id = wp_insert_post(array(         'post_title'     => 'Attorneys',         'post_name'      => 'attorneys',         'post_content'   => 'This is your Attorney page.',         'post_status'    => 'publish',         'post_author'    => $user_id, // or "1" (super-admin?)         'post_type'      => 'page',         'menu_order'     => 5,         'comment_status' => 'closed',         'ping_status'    => 'closed',          // + see: http://codex.wordpress.org/Function_Reference/wp_insert_post       ));              restore_current_blog();     }          add_action('wpmu_new_blog', 'create_my_pages3', 10, 2);          function create_my_pages3($blog_id, $user_id){       switch_to_blog($blog_id);            // not really need, new blogs shouldn't have any content       if(get_page_by_title('contact')) return;            // create each page       $page_id = wp_insert_post(array(         'post_title'     => 'Attorneys',         'post_name'      => 'attorneys',         'post_content'   => 'This is your Attorney page.',         'post_status'    => 'publish',         'post_author'    => $user_id, // or "1" (super-admin?)         'post_type'      => 'page',         'menu_order'     => 3,         'comment_status' => 'closed',         'ping_status'    => 'closed',          // + see: http://codex.wordpress.org/Function_Reference/wp_insert_post       ));       update_post_meta( $id, '_wp_page_template', 'new_template.php' );            restore_current_blog();     }          add_action('wpmu_new_blog', 'create_my_pages4', 10, 2);          function create_my_pages4($blog_id, $user_id){       switch_to_blog($blog_id);            // not really need, new blogs shouldn't have any content       if(get_page_by_title('Practice Areas')) return;            // create each page       $page_id = wp_insert_post(array(         'post_title'     => 'Practice Areas',         'post_name'      => 'practice-areas',         'post_content'   => 'This is your practice areas page.',         'post_status'    => 'publish',         'post_author'    => $user_id, // or "1" (super-admin?)         'post_type'      => 'page',         'menu_order'     => 4,         'comment_status' => 'closed',         'ping_status'    => 'closed',          // + see: http://codex.wordpress.org/Function_Reference/wp_insert_post       ));              restore_current_blog();     }          // Delete Pages     add_action('wpmu_new_blog', 'delete_my_pages', 10, 2);     function delete_my_pages(){     $post = get_page_by_path('hello-world',OBJECT,'post');     if ($post)       wp_delete_post($post->ID,true);     }          add_action('wpmu_new_blog', 'delete_my_pages2', 10, 2);     function delete_my_pages2(){     $page = get_page_by_path('login',OBJECT,'page');     if ($page)       wp_delete_post($page->ID,true);     }          add_action('wpmu_new_blog', 'delete_my_pages3', 10, 2);     function delete_my_pages3(){     $page = get_page_by_path('logout',OBJECT,'page');     if ($page)       wp_delete_post($page->ID,true);     }          add_action('wpmu_new_blog', 'delete_my_pages4', 10, 2);     function delete_my_pages4(){     $page = get_page_by_path('lostpassword',OBJECT,'page');     if ($page)       wp_delete_post($page->ID,true);     }          add_action('wpmu_new_blog', 'delete_my_pages5', 10, 2);     function delete_my_pages5(){     $page = get_page_by_path('register',OBJECT,'page');     if ($page)       wp_delete_post($page->ID,true);     }          add_action('wpmu_new_blog', 'delete_my_pages6', 10, 2);     function delete_my_pages6(){     $page = get_page_by_path('resetpass',OBJECT,'page');     if ($page)       wp_delete_post($page->ID,true);     }          add_action('wpmu_new_blog', 'delete_my_pages7', 10, 2);     function delete_my_pages7(){     $page = get_page_by_path('sample-page',OBJECT,'page');     if ($page)       wp_delete_post($page->ID,true);     }          add_action('wpmu_new_blog', 'delete_my_pages8', 10, 2);     function delete_my_pages8(){     $page = get_page_by_path('store',OBJECT,'page');     if ($page)       wp_delete_post($page->ID,true);     }      How can I clean this up and make it work without the purposeful error? **EDIT** The error is seen here -               // not really need, new blogs shouldn't have any content       if(get_page_by_title('contact')) return;      where it says 'contact' it's suppose to match this (attorneys)               // create each page           $page_id = wp_insert_post(array(             'post_title'     => 'Attorneys',             'post_name'      => 'attorneys',      If I change contact to attorneys though, then all the deleted pages show up again.


Including Database Generated Pages in Site Search

Our library uses a separate little php/mysql app and wordpress template pages to display lists of resources for users. The resources are not included in site search, of course, since the pages are generated on the fly. Lookup begins at a top level page with a search, alphabetical and subject browses. Users can enter the resource name or drill down through the browse screens. See libtest.drake.edu/find/article-databases We would like to let users locate the resources via the site search. The resources are in a database that exists outside the wordpress installation and tables. At a minimum, we would like to take people to the top level (resource lookup page). In the best scenario, we would like to take people to the actual resource listing itself. What would be the best method to do accomplish this, preferably without extensive php coding (since we no longer have a developer)? Are there plugins that could give us this functionality?


Template setting is not saving in wordpress

I'm using a child theme. I want to override a template of base theme. I created, `articles-page.php` which starts with:               <?php     /*     Template Name: Articles     */      While creating a page in Wordpress I can see my template listed in the _Page Attributes_ widget to my right. The problem is, when I change my template setting to "Articles" and hit update. It still shows `default`. My change is not being saved, hence my template is not being loaded for that page.


Wordpress doesn't show all posts in database

I have around 140 post in database but wordpress admin page shows just 50 post. How could I let wordpress shows all the posts in database? Thanks


wp_enqueue_script Doesn't Work?

It's pretty standard, I enqueue script and style for admin page.               function admin_custom(){         wp_enqueue_script('js', plugins_url('adm.js', __FILE__));         wp_enqueue_style('css', plugins_url('adm.css', __FILE__));     }          add_action('admin_enqueue_scripts', 'admin_custom');      The result:               <link rel='stylesheet' id='css-css'  href='http://localhost/wp/wp-content/plugins/manager/adm.css?ver=3.5.1' type='text/css' media='all' />     <script type='text/javascript' src='http://localhost/wp/wp-content/plugins/manager/adm.js?ver=3.5.1'></script>      But it doesn't work. Style is working, but the script is not loaded. I put the css and js in the same folder. It doesn't make sense for me. Any help will be appreciated, I spent last day for this problem. Thanks!


get specific post_type from blog1 in multiste

okay this is the situation I have a coupon site with more than 2000 coupons already, now i want to display them on a second domain within my multisite setup. Therefore i need the second domain to display these coupons. I got alll other information i need from the first domain via a modified plugin. With this content:               add_action('init', 'central_taxonomies');     add_action('switch_blog', 'central_taxonomies');          function central_taxonomies () {         global $wpdb;         $wpdb->terms = $wpdb->base_prefix."terms";         $wpdb->term_relationships = $wpdb->base_prefix."term_relationships";         $wpdb->postmeta = $wpdb->base_prefix."postmeta";         $wpdb->term_taxonomy = $wpdb->base_prefix."term_taxonomy";         $wpdb->storesmeta = $wpdb->base_prefix."clpr_storesmeta";     }      However if I add `add $wpdb->posts = $wpdb->base_prefix."posts";` to it I am not just getting all coupons from domain1, i am also getting all pages, the menue and all posts. within posts you have the post_type and all coupons are having the ID "coupons" and this what I need to get. Is there a way to add something to               add $wpdb->posts = $wpdb->base_prefix."posts";      to seperate this ID "coupons" from the others? UPDATE: I seperatet the coupons with this code:               add_action('init', 'central_taxonomies');      add_action('switch_blog', 'central_taxonomies'); function filter_coupons( $query ) { $query->set('post_type', 'coupon'); }      add_action( 'pre_get_posts', 'filter_coupons' ); function central_taxonomies () { global $wpdb; $wpdb->terms = $wpdb->base_prefix."terms";      $wpdb->posts = $wpdb->base_prefix."posts";      $wpdb->term_relationships = $wpdb->base_prefix."term_relationships";      $wpdb->postmeta = $wpdb->base_prefix."postmeta";      $wpdb->term_taxonomy = $wpdb->base_prefix."term_taxonomy";      $wpdb->storesmeta = $wpdb->base_prefix."clpr_storesmeta"; }       However now I am not getting any posts and pages and navigation how to I get these from the aktiv blog!


Using previous_post_link and next_post_link to wrap around post sequence

For a single custom post type, I'm using previous_post_link and next_post_link with simple arrows. (Although text arrows are shown here, in the actual I'm using graphics with the text hidden via CSS.) Code:
            <?php previous_post_link('%link', '«'); ?>

            <?php next_post_link('%link', '»'); ?>
           This works fine except for the edge cases. I'd like the posts to wrap around: that is, for the first post, I'd like previous_post_link to link to the _last_ post, and for the last post next_post_link would link to the _first_ post. It appears the default for both those cases is null. How do I test for first and last post status and produce links for each?


Store members in custom taxonomy or native user?

I've just started Wordpress-programming a few days ago, but I've been programming php 5-6 years. I've been writing some code -added custom taxonomies, custom post-types/fields etc. Now I want to be able to store members for a club. There are a lot of plugins out there, but not exactly what I'm looking for. Secondly I don't want to rely on other plugins because you never know when they stop getting supported. Thirdly - I want to learn the basics of WP-programming. Therefore my question: I want to store members (they should only be able to register at front - and admin should be able to add/edit users backend) What is the **right approach** to do this? Is it to use Wordpress **native users**? Or should I create a new **taxonomy** called club_users? (or something more explaining for the club)


Site does not work right, pages not showing up, even for root admin

I have a problem. My database server isn't working right. On a wiki, it gives an error, and on my wordpress site, the pages don't show up. I am wondering if WordPress caches the DB data in any way, and if so, how do I clear it. I am hoping that will either totally break it or clear it. I am able to disable plugins and change settings, just the pages don't show up. **Edit:** The only thing I can't access is the pages. Everything else is working OK, I think. Also, this just cropped up in the last couple of days. Before that, it was fine. I just noticed it today. **Edit 2:** I mean pages as in posts and pages, not webpages.


Using if/else statements with output from theme options

In another question I was talking about using theme options to modify CSS. This is a separate but related question. When a user sets a link colour in my theme, here's how I'm including their choice:               <?php $options = get_option('mytheme_theme_options'); _e( 'a, a:link {color: #' ); echo $options['linkcolour']; _e( ';}' ); ?>      So, if a user specifies a link colour of #333333 in the theme options page, then my code above outputs a nice clean bit of CSS:               a, a:link {color: #333333;}      Great. However, if they **don't** specify any link colour value, then I get this:               a, a:link {color: #;}      ...which is both ugly and redundant -- it doesn't do anything. I'm not a PHP person, so I don't really know the best way to fix this, but I imagine that it could be fixed with an if-else statement of some kind, where the code only gets output when the user sets a value. Is that right? If so, what code should I use? Thanks.


Category index featured image

I wish to set a featured/header image for each of my category archive pages, how would I go about doing this without hard coding each category into the theme? An example of the page is at http://keswickscouts.org/section/cubs The code form header.php is
             <?php                 // Check to see if the header image has been removed                 $header_image = get_header_image();                 if ( ! empty( $header_image ) ) :             ?>                 <a href="<?php echo esc_url( home_url( '/' ) ); ?>">                     <?php                         if ( !is_404() && !is_attachment() ) { // Check if this is not 404 or attachment page                             // Check if this is a post or page, if it has a post-thumbnail                             if ( is_singular() && has_post_thumbnail( $post->ID ) && ( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && $image[1] >= HEADER_IMAGE_WIDTH ) :                             echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );                         else : ?>                             <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />                     <?php endif; } // end check for featured image or standard header ?>                              <?php endif; // end check for removed header image ?>


How to use get_page_by_title() with qTranslate?

Any idea how I can use the WP function `get_page_by_title()` with qTranslate installed? for example:               $page_contact = get_page_by_title( '_e("[:en]contact");' ,'page' );     $page_contact_ID = $page_contact->ID; echo '~~~~'.$page_contact_ID;      The only way I can get a match is by including the whole string with all the languages - and there is no way that's going to work once people start editing the pages...


Custom post type / custom fields

I'm working on a client site and need the following:   * A custom post type called 'Agreements'   * On the Agreements edit panel, show a list of "Offices" checkboxes. Users can select multiple Offices per Agreement. Here's the rub. I want the admins to be able to add/edit Offices, which would each have a title, abbreviation and URL. The admins can add/edit Offices in a totally separate place, but I want these new Offices to show up in the Agreements edit panel automatically. I've tried a number of approaches, but I'm having trouble pulling the Offices list into the Agreements custom edit panel. Magic Fields comes close with its "Related Types" option, and I almost got WPAlchemy working but ultimately failed. Any suggestions on better / easier ways to do this? Thanks so much for any and all tips and advice!