title: Comments and Bootstrap 3's media-list

text: I'm developing my first custom theme for WordPress based on Bootstrap 3 framework. I'm newbie and I can't understand few things, so I'd like to ask you for some help, especially with comments.php, comments display etc. First of all, I developed HTML website and now I'm going to change it to WordPress theme. I done some work but I can't handle with comments and form for sending a comment message. I don't know how to make wp_list_comments works with media-list from Bootstrap. Here you can see how I want to have comments looks (HTML demo): http://fonlinepl.96.lt/single.html And here is a WordPress website, how it looks like: http://testerio.96.lt/?p=1 I can also say that I didn't add comments form because I don't know how I could do it and make it works with Bootstrap's styles. I can also send you my theme if it is necessary, so you could check how it is made. Hope you help me solve this problem. :) Edit: comments.php               <?php wp_list_comments(              $args = array(             'style'             => 'ul',             'avatar_size'       => 64,         )          ); ?>       I'd like to make WordPress comment's look like media-list from Bootstrap - getbootstrap.com/components/#media-list


title: Temp URL Redirect Loop

text: I am attempting to set up my site using a temp URL (IP/~username/domain) through hostgator, but I am running into some issues. I have gone into the database and replaced all instances of my old domain with the new temp URL. Problem is I am running into a redirect loop. I read somewhere to try resetting permalinks, but I don't have access to the admin panel. I'm not sure what else to try to fix the redirect loop. I even replaced my .htaccess with a fresh one, and still get the redirect loop. Here is my current wp-config file:               define("WP_SITEURL","http://IP/~username/example.com");     define("WP_HOME","http://IP/~username/example.com);          define('DOMAIN_CURRENT_SITE', 'IP/~username/example.com');     define('PATH_CURRENT_SITE', '/');      And my current .htaccess:               ###############################################################          # BEGIN WordPress     <IfModule mod_rewrite.c>          RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]     </IfModule>     # END WordPress          ##############################################################          <IfModule mod_rewrite.c>     Options -MultiViews     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !.*\.(jpeg|jpg|gif|png|ico)$     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /home.php [L]     </IfModule>


title: How to access media library?

text: I'm working on a plugin which uses custom post types. When creating or editing one of these custom post types in the WP admin backend, one must be able to select or upload a custom background image from the WordPress media gallery/library (for that post particular). So I want to be able to bring up the default WordPress media library in the backend. Is there a function / hook / api available to call the WordPress media gallery admin window? I Googled the entire afternoon, but I don't seem to get the results I need. P.s. I know that I can use the featured image for that purpose, but I want to preserve the featured image for the user.


title: Category page with gallery for each post

text: I'm looking for a bit of direction on how to set up a category page (for a real estate company). What would be the best way to have a gallery of images (1 large photo and several thumbnails) listed for each post on a category page.


title: W3Total Cache problem with Nginx

text: Hi I installed w3 total cache on my nginx powered site, I'm having errors however. For example when I enable page caching disk:enhanced I get: It appears Page Cache URL rewriting is not working. If using apache, verify that the server configuration allows .htaccess or if using nginx verify all configuration files are included in the configuration. When I choose page caching disk:basic no error is displayed. Here is the config for the server in /etc/nginx/nginx.conf: http://pastebin.com/SEdnyHbf If it makes any difference, I have multiple sites installed, all in /srv/www I can see that W3 Total Cache is creating a separate nginx.conf for each website, e.g. /srv/www/mysite.com/public_html/nginx.conf and within it there are the rules of W3 Total Cache, pasted here: http://pastebin.com/dANPVMJk I would like to have a setup that works for any number of websites I will add. Clients on my server need to be free to update their W3 Total Cache configuration as they wish without the server needing to be restarted. Also they might opt not to use the plugin at all.


title: Codex Function Problems When There is an Apostrophe in the Category Name

text: I'm working on a site, largely managed by categories. Two of the categories have apostrophes in them... ex. "Joe's Place" and "Tina's Lounge". (Actual titles changed, these are examples...) The category slugs are "joes-place" and "tinas-lounge". The customer asked for a breadcrumb on the site... Unfortunately the breadcrumb call fails whenever the category has an apostrophe in its name. The failure occurs at the call to get_cat_ID. Oh, and when the breadcrumb fails, the whole page fails. Here is a fragment of my breadcrumb code...               if ( is_category() )             {                 // single_cat_title() Displays or returns the page title if a category                 // or tag archive is queried.                  $catTitle = single_cat_title( "", false );                    echo '<!-- $catTitle:'.$catTitle." -->";  // troubleshooting line...                  $cat = get_cat_ID( $catTitle );                 echo '<!-- $cat: '.$cat."-->";   // troubleshooting line                 echo "<li>  ". get_category_parents_custom( $cat, TRUE, ' » ' ) ."</li>";             }      get_cat_ID simply returns a `0`. Uh-oh... when I look close at my troubleshooting code, I can see that $catTitle returns `Joe’s Place` Ouch.. Its really not clear on exactly what format is required where the apostrophe is concerned. When I dig further and further in codex core, I can see get_cat_ID calls a function `get_term_by()` that warns "$value is not HTML-escaped for the 'name' $field. You must do it yourself, if required." I'm assuming that's my issue. but, what does it mean to "HTML-Escape" a string? I tried `$catTitle2 = htmlspecialchars_decode($catTitle);` no go there.   I tried `$catTitle2 = esc_html($catTitle);` no go there. In both of those previous functions, the string never changes a bit. I tried manually introducing the string "Joe's Place" to the call, and WOW, that totally worked. In the meantime I will do a simple string replace function, but that seems like such a hack. Is there a php or wordpress function that will convert the string `’` back to a simple apostrophe? What is the right way to fix this problem? Update: I stumbled upon this posting: My quick fix consists of a bit of code suggested there with a small modification:                    $catTitleCorrected = html_entity_decode(str_replace("’","'",$catTitle));


title: Trying to display terms from custom taxonomy within function

text:
I have a function that is giving me this error - `Catchable fatal error: Object of class stdClass could not be converted to string in.... blah blah` Below is some of the code from the function. It is the last line that is giving the error but I can't work out why. I'm trying to display the term with ID 7 in the project_cats taxonomy.               $html_content .= "
" . rgpost('input_1') . "
"; //Title     $html_content .= "
Category: " . rgpost('input_5') . " | Budget: " . rgpost('input_3') . "
"; //Category & Budget     $html_content .= "
" . rgpost('input_4') . "
"; //Description     $html_content .= "" . get_term_by('id', 17, 'project_cats') . "";


title: Disable default Wordpress widgets in sidebar

text: Im creating my own theme. When I have a clean wordpress installation, there are some default widgets in the sidebar (search, category, recent posts etc). I know that I can remove them from the sidebar by adding a widget to that sidebar, but I want them removed in the sidebar by default. Is there a way to do that without disabling the widget (unregister_widget())?


title: Custom folder for wordpress page templates

text: How I can change a folder for wordpress page templates? By default all page templates located in theme's root folder. I want to make a folder with name "templates" in theme's root directory and keep all page templates there. How can I achieve that?


title: How to define a remote uploads directory?

text: Using the constant overrides in wp-config I'm able to define a remote FTP server that plugins will be added to when installed using the WP interface.               define('FS_METHOD', 'ftpext');     define('FTP_BASE', '/');     define('FTP_CONTENT_DIR', '/public_html/example.com/wp-content/');     define('FTP_PLUGIN_DIR', '/public_html/example.com/wp-content/plugins/');     define('FTP_USER', 'username');     define('FTP_PASS', 'password');     define('FTP_HOST', '123.123.123.123');      What's weird to me is that there isn't a constant setup for themes or uploads. Themes I don't care about (but its still weird) ... I want uploads to be put on the remote server though. Ideally there would be an `FTP_UPLOADS_DIR` that could be overwritten the same way. Any ideas on how to get around this?


title: List custom taxonomy specific to one custom post type

text:
I am slowly going mad trying to figure this out.. I want to list custom post type 'mobile_review' by custom taxonomy 'mobile_phone', as multipe custom post types share this taxonomy I need some way to segment. So far I have this:               function get_terms_by_post_type($taxonomies,$args){           $args = array(         'post_type' => 'mobile_review'     );          // The query for posts of type 'mobile_review'     $the_query = new WP_Query( $args );          // The Loop     while ( $the_query->have_posts() ) : $the_query->the_post();          //get terms             //$mobs = wp_get_object_terms($post->ID,"mobile_phone");           $mobs = get_terms('mobile_phone');      $count = count($terms);      if ( $count > 0 ){      echo "
";      foreach ( $terms as $term ) {        echo "
" . $term->name . "
";           }      echo "
";      }          endwhile;          // Reset Post Data     wp_reset_postdata();                  }      Am I close? I have been hacking back and forth for ages and getting nowhere. Any help would be great! Thanks in advance.


title: Prevent users from accessing mp3s in my uploads folder?

text: I have mp3 players set up to play mp3s on my site. The mp3s are all being uploaded to the uploads folder. I don't want people accessing these directly, meaning I don't want people to be able to download the mp3s. Is there a way to somehow restrict access to all files ending in .mp3 in the uploads folder while still having them playable in the mp3 players on the site?


title: how do you point 'screen_function' to a function in the same class?

text: In a plugin class, I'm successfully creating a new tab on a Member page using:                   bp_core_new_nav_item( array(         'name' => __( 'MyTab', 'bp' ),         'slug' => 'mytab',         'position' => 200,         'screen_function' => array( $this, 'mytab_screen' ),         'default_subnav_slug' => 'mytab'     ) );      The problem appears when you click the tab. The function is found - this Warning _DOES NOT_ appear:               Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback etc      But the function is not called and you end up on the 'It seems we can’t find what you’re looking for.' page. Am I using the correct approach to point 'screen_function' to a public function in the same class ?


title: User registration on sub site

text: I have configured multi-site wordpress. I have some sub-sites as like **site1.mydomain.com** and **site2.mydomain.com**. Now i just want to enable the user registration on my sub-sites. When a user clicks on register link in any sub-site (site1.mydomain.com or site2.mydomain.com) **it takes them to the main site** (mydomain.com) and register them as an administrater of another site. so he will be having another site as (site2.mydomain.com). But i want is that, if the user clicks the register link on the sub-site (ex:site1.mydomain.com) they **should be register only on that sub-site itself and become the member only for that site with some roles**. I am very new to wordpress. I dont even know the coding standard of the wordpress. But i hope i can manage these things. Now i am just roaming around with the plugins. Please some one help me for this.


title: Add Page With Parent ID

text: I am writing a plugin that upon activation creates a set of pages. The first page that I create I want to be the parent of the rest of the pages that are added. For some reason, this is not working. Can someone please take a look at my code and tell me what I have wrong? The code I use to add the first page and return the page ID:               $ssm_page = array(             'post_title'    => 'Parent Page',                     'post_content'  => 'This is the parent page.',                     'post_status'   => 'publish',                     'post_type'     => 'page',                     'post_author'   => 1,                     'post_category' => array(8,39),                     'page_template' => 'template-fullwidth.php'         );              $ssm_page_id = wp_insert_post( $ssm_page, $wp_error );      The code I use to add the subsequent pages and adding the 'post_parent' attribute:               $login_page = array(                     'post_title'    => 'First Child Page',                     'post_content'  => 'This is the first child page.',                     'post_parent'   => $ssm_page_id,                     'post_status'   => 'publish',                     'post_type'     => 'page',                     'post_author'   => 1,                     'post_category' => array(8,39),                     'page_template' => 'template-fullwidth.php'     );          wp_insert_post( $login_page );      What am I doing wrong? All of the pages are created but none of the child pages have the parent page set.


title: adding page types in menu

text: I believe what I am trying to achieve is quite easy but I am failing to grasp what is needed here. I want a section in the admin panel... lets say "page sections" under that, I want to be able to add multiple post types. i.e. lets say "add member", "add foo", "add bar" ... I currently have               add_action( 'init', 'add_item' );     add_action( 'init', 'add_item2' );     function add_item(){         register_post_type('item1', array(             'label' => 'Item label',             'public' => true,             'show_ui' => true,             'capability_type' => 'page',             'capabilities' => array(                  ),             'hierarchical' => true,             'rewrite' => array('slug' => 'puds'),             'query_var' => true,             'supports' => array(                 'title',                 'editor',                 'excerpt',                 'custom-fields',                 'revisions',                 'thumbnail',                 'author',                 'page-attributes',                 'post-formats'             )         ) );     }     function add_item2(){     register_post_type('item2', array(         'label' => 'Item label 2',         'public' => true,         'show_ui' => true,         'capability_type' => 'page',         'capabilities' => array(              ),         'hierarchical' => true,         'rewrite' => array('slug' => 'puds'),         'query_var' => true,         'supports' => array(             'title',             'editor',             'excerpt',             'custom-fields',             'revisions',             'thumbnail',             'author',             'page-attributes',             'post-formats'         )     ) );      } which would generate ![enter image description here](http://i.stack.imgur.com/Y3Mfs.jpg) but i want one menu heading with more than one menu selection... Any ideas?


title: How to create a category menu in WordPress?

text: I am new in WordPress world (before now I always used Joomla and some other old CMS) Now I am testing WordPress and I have some doubts about how create a navigation menu in my WP Site. This is my test site (that at this time have not content but only a template): http://www.scorejava.com/WPTest/ I plan to create articles organized by category and I would have an horizontal top menu like this WP blog: http://viralpatel.net/blogs/ As you can see in this second WP site there is an horizzontal top menu that contains some voices, like **"Java"** , clicking on this voice appear a page showing all the Java posts preview. As you can see this menu work also with submenu, for example, moving the mouse cursor on Java appear the "Java EE" subvoice. What can I do to have something like this in my WordPress? And if I want a similar vertical menu in my right sidebar?


title: Saving array keep adding length of array

text: I'm using wp all import to load in datafeeds but when i set a custom field (thats needed for the theme) it keeps modding it before it stores it when I put this in the field : a:7:{test} it saves it as s:10"a:7:{test}" Even when I update thru update_post_meta and set it there manually it adds the s:10... How can I fix this, do I have to encase the string somehow? The custom field is same for each post is there some other way I can set it for each post in the php of the feeder? EDIT:               update_post_meta($pid,'_attributes','a:7:{test}');        in php will fill the field with s:10:"a:7:{test}" insteed of just a:7:{test}


title: Post thumbnails Retrieve Url

text: Hi I am trying to instegrate a slider into my wordpress theme.This is what I have so far:               <?php                                  $slider_query = new WP_Query(array(                                             'posts_per_page'=>'5'                                 ));                                      if($slider_query->have_posts()):                                     while($slider_query->have_posts()):                                         $slider_query->the_post();                                             if(function_exists('has_post_thumbnail') && has_post_thumbnail()){                                                 the_post_thumbnail();                                             }                                      endwhile;                                 endif;     ?>      While this does work and retrieves the image I need to be able to retribe the url because I have to set different title attributes that are stored for the caption. I have also tryed to get the URL using               $url = wp_get_attachment_image_src(the_post_thumbnail());      But for som reason the query returns 10 links img's and I set it to 5 only.Wierd thing is that the even images have no source. Anyone know of a way to retrieve the thumbnail url other then this? If not then why do I get 10 images in the query?


title: Hierarchical Custom Post Types or Similar

text: Doing a site for an architecture firm. Want to organize this very intelligently. I know of a lot of different ways to do what I'm about to explain, but I want to know the most efficient way/most easily understandable way for the client. Let's assume there are industries. We'll use Sports. Underneath Sports, there are Projects. Within Projects, there are Team Members. Initially, it makes sense to make a custom post type with type page (hierarchical) named "Industries". Within CPT:Industries, I have a page "Sports". When I create a project, I select "Sports" as it's parent. I could perhaps use taxonomies to select Team Members. The page URL structure would then be something like http://www.example.com/industries/sports/new-football-stadium Here lies my problem, though. Team Members are more than just names, so it seems silly to make them a taxonomy. Each team member can be a member of multiple projects, and thus should have their own page to display their own information. So essentially, if I click the team members name on the fake URL above, it should be something like http://www.example.com/team/John-Smith. On John Smith's page, it states his industry and a list of projects he's worked on. This seems impossible just using a custom Taxonomy for selecting people on a project. Obviously I could make a custom post type of "Team" and a team taxonomy, but I'd like to avoid double the work for the client when creating new items. Furthermore, I've always found it a little sloppy selecting a parent in hierarchical custom post types. I'd like to have a link on the side bar that says "Add New Project" and select the Industry, instead of going to Industries -> Create New Page and select a parent within the Attributes metabox. Essentially, I'd like at least two custom post types: "industries", and "projects" where projects is always a child of industries, but they're post types. Can post types have a parent/child relationship? Alternatively, I could just create a "projects" custom post type, and make "industry" a taxonomy, however the industry is always going to have a landing page too, with a listing of projects within it, so I run into the same problem as the team members. How would you architect this? Thanks.


title: Cannot update custom database table row

text: I am trying to update a row in a custom database table by `$wpdb->update();`. In my opinion my code is right but for some reason my database row doesn't update. Can anyone help me with this? I want to update a the status of a transaction in the table wp_mollie_transactions where the `transaction_id` is equal to the `$order_id`, which I received from from my payment provider. (Off course I made `$wpdb` global in this file)               // Update database         $wpdb->update( $wpdb->prefix . 'mollie_transactions',             array(                 'status'    => $payment->status             ),             array(                  'transaction_id'    => $order_id             )         );


title: Multiple instances of Featured Image Query

text:
I have some custom code built into the header of my theme that gets the featured image from a post, displays the image and links to the posts permalink when clicked on by a user. The problem I am having is that I have this happening on 2 different divs pulling in info from 2 different categories, but when you hover over the link as a user, it uses the permalink from only one of the two images. I am using the "page links to" plugin to redirect the post to a page in the site, so I wonder if this is causing an issue. Below is my snippet getting the featured image in 2 separate divs:
     <a href="<?php the_permalink(); ?>">     <?php $the_query = new WP_Query( 'cat=100' );          // The Loop     while ( $the_query->have_posts() ) : $the_query->the_post();         if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.             the_post_thumbnail();         }     endwhile; ?>

     <a href="<?php the_permalink(); ?>">     <?php $the_query = new WP_Query( 'cat=101' );          // The Loop     while ( $the_query->have_posts() ) : $the_query->the_post();         if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.             the_post_thumbnail();         }     endwhile;          // Reset Post Data     wp_reset_postdata(); ?>
      Do I need to have two references of `wp_reset_postdata();` or am I just doing this wrong? The example is here in the header. You'll see two rectangular images that should link to two different pages. Right now they both link to the same location. Thank you all in advance.


title: Why are navigation items saved in the database?

text: Maybe I am just not grasping the concept of WP right here but why is everything in Wordpress stored as a post of some type? I have a custom set of tables that house hundreds and thousands of items. I would like to programatically create a navigation menu that dynamically updates items to reflect my custom tables. I haven't been able to find a way to do this without using the following function: wp_update_nav_menu_item() To my understanding this function stores the item in the array in the wordpress tables as posts/taxonomies? This is needless overhead in my case and looks pretty permanent. My menu items will change pretty much on a daily basis, I don't want to grab items from one table only to have them stored in another table. Does anyone know how I could directly update the navigation menu each time the homepage loads without requiring any interference from the administration panel? Thanks.


title: What is wrong with using add_option with Multisite instead of add_blog_option in a plugin

text: I'm working on a new plugin but it's my first to save which will save an option to the database. Currently I'm using `add_option` and I assumed that   - activation would fail or - the wrong value would be saved to the wp_blogID_options table  because I wasn't using `add_blog_option`. All the posts / literature (Wrox, Apress, etc) I've read say I need to use to `add_blog_option`. But all my testing (and inspecting the SQL table) are proved me wrong. So ... What is wrong with using add_option instead of add_blog_option when making a plugin (that can be single install or multisite)? To me ... it seems that `add_option` (or even `get_option`) all work fine. I'm guessing the Settings API has some protection wrapper. However ... that would mean using `add_blog_option` (or get_blog_option) are only for 'purists'.


title: why â€™ quote double quote in database wordpress

text: i'm trying backup and restore database using php code. but i don't know why quote double quote show in database wordpress, something like â€™, and destroy my wiget_text. So how can i fix that.? help me. thanks you


title: How to get transient cache to work with wp_enqueue_script

text: So I have this page that has various shortcodes on it. Each shortcode may have wp_enqueue_script to load say jQuery accordion or tabs. Now I am wanted to cache the page for better performance so I use transients. So far so good. However because the page is now cached, the wp_enqueue_script() does not fire and therefore the jQuery accordion or tabs is not being loaded anymore. So there a better way or the proper way to do this?


title: how would I create a custom query to get all users, and a related post based on a postmeta field?

text: I have about 50 users. Its pretty easy to list them all. However they are related to a special custom post type through a postmeta field called wpp_agents. So I need to list Users, but also the post title(linked to the post).   1. User 1 | User 1's Post(linked)    2. User 2 | User 2's Post(linked)    3. etc... I am a mysql noob but getting pretty ok with php. Here is what I am playing with:               $data = $wpdb->get_results(         "SELECT $wpdb->users*,             "SELECT display_name, user_email           FROM $wpdb->users           LEFT JOIN $wpdb->usermeta ON           user.ID=wpp_agents;",         ARRAY_A     );      but its not right. I believe I need to SELECT * FROM $wpdb->users LEFT JOIN $wpdb->postmeta but then not sure. any help is greatly appreciated.


title: Responsive framework - edit child js

text: Is the responsive framework used by WordPress custom to WordPress, or is it a standard design? Where is the js file located that controls behaviour of the grid system used by theme twentytwelve? Is it the same file for all themes?


title: Show 10 Sub Categories Per Parent Category Page?

text:
I have using following code for displaying sub categories in parent category page. Its displaying all subcategories in a single page. I want to display 10 sub categories per page. Please help me to limit the sub categories in category page. My Code :               <?php           $cat = get_query_var('cat');     $categories= get_categories('hide_empty=0&parent='.$cat);          if(!empty($categories)){          echo '

';          foreach ($categories as $categories_item) {          $mycat .= $category->cat_name;     echo $mycat;                       echo '
';             echo '
term_id ) . '" title="' . sprintf( __( "%s" ), $categories_item->name ) . '" ' . '>' . $categories_item->name.'
 ';             $terms = apply_filters( 'taxonomy-images-get-terms', '' );             if ( ! empty( $terms ) ) {               foreach( (array) $terms as $term ) {                     if($term->term_id == $categories_item->term_id) {                        print '
taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'medium' );                        echo '
';                      }                 }                 echo '
'. $categories_item->description; echo '

';             }         }              echo '

';     }else {     ?>


title: Is it possible to match site root with a WP rewrite rule?

text: I need to add a custom query var to the site root. For example say I have a query var, lets say 'colour'. I have a CPT called banana and I use the filter 'banana_rewrite_rules' to add '?colour=yellow'. That works fine. If I visit `www.example.com/bananas/` or `www.example.com/banana/cavindish/` or `/banana/wild/` I get the colour=yellow as a query var. Now, I also have vars being returned for posts and pages. That works fine as well. Thing is, I need to return a colour on the site root as well. If someone visits www.example.com I need, for example, ?colour=white returned and accessible as a query var. So going on what I've done before, if I could match the site root itself to add the query var my filter remains unchanged. (root_rewrite_rules filter doesn't work as it matches things like robots.txt, not the actual root). Something like '^$' which works in Django? Or '/?$'


title: Interactive tagline or similar

text: I would like to either (a) edit the tagline to include an html snippet, or (b) add my (interactive) contact details to the header, in the same area as tagline, but aligned to other side. I have managed to alter child header to include contact details, but its behaviour is currently controlled by css rather than js. I would ultimately like to control its behaviour with something like `jQuery( document ).ready( function() { var dwidth = jQuery( window ).width(); if ( dwidth > 1000 ) { jQuery( '.hcontact a:first-child' ).attr( 'href', '#' ); } });` based on advice from this page. I am not running that theme though - I am running twentytwelve-child, and there is no edit js in theme panel.


title: Stop parsing shortcodes

text: I'd like to stop parsing shortcodes in `the_content` but I'm struggling to find what the correct filter would be. This didn't work:               remove_filter( 'the_content', 'do_shortcode', 40 );     remove_filter( 'the_content', 'run_shortcode', 40 );     remove_filter( 'the_content', 'wpautop', 40 );     remove_filter( 'the_content', 'autoembed', 40 );     remove_filter( 'the_content', 'prepend_attachment', 40 );      This worked (but also disabled all other useful filters):               remove_all_filters( 'the_content', 40 );      So, I'd like to disable `autoembed` and `do_shortcode` and let WordPress display them as plain text. Would it be possible? I'm using `wp` hook in main plugin's PHP file.


title: How to encode post content as JSON?

text: I`m trying to construct a json object but are having difficulties with the_content since it returns newlines, which causes the script to fail. The error messages received is: **Uncaught SyntaxError: Unexpected token ILLEGAL** **Example of the json:**               [ {image : 'http://localhost/wp-content/uploads/2012/04/example.png', title: 'Example string          with newlines     that outputs illegally!'}]      Ideally I'd want it to output the HTML content (as seen when pressing the HTML tab in the editor).


title: Chaining Taxonomy Queries

text: I have a quick question. Could someone show me how to make a loop that does the following. Query all posts for one tax (Meal Time: eg. Lunch, dinner, dessert...) then Loop each taxonomy (Courses: eg. apps, entrees, desserts...) and display all posts related to that tax. then continue to loop through until there are no more related taxonomies the the parent "meal time" tax.


title: Get post ids sorted by meta_key

text: I have defined a `post_view_count` meta_key to store the number of post views. I would like to get an array of post ids sorted by `post_view_count` value to use in the `functions.php` file. Thanks.


title: How do i specify a url to which to redirect the user after he logs out from facebook?

text: I need to specify a url that i will use after the user has logged out from facebook because i need to do some extra-cleaning and he is correctly logged out from our app. For this i need a url that when invoked will call a function i define, but i don't know how i should do this, what action i should use. In Drupal i could define a "callback menu" which is exactly what i'm looking for, i don't know how to do this in wordpress. EDIT - to clarify more, the user is connected to my plugin with facebook connect. The standard               $logout_url = $facebook->getLogoutUrl();      isn't enough because when the user comes back from facebook i have to clear the session and invalidate the token and so i nee do specify a url               $logout_url = $facebook->getLogoutUrl('edit.php?post_type=my_custom&page=logout-from-fb');      i just need that when the user comes back from facebook automatically and the page `edit.php?post_type=my_custom&page=logout-from-fb` a function i want is called and it will handle everything.


title: Plugin prevents code from working

text:
This is my blog http://animeii.tk/ (it might be down from time to time since the domain is still new) The theme is Magazeen and I have this code there:

<h90>                 Check out the Latest Articles:             </h90>

                 <?php                     $dock = new WP_Query();                     $dock->query( 'showposts=9' );                     while( $dock->have_posts() ) : $dock->the_post();                 ?>
                     <a href="<?php the_permalink() ?>" rel="bookmark" >                     <img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image_value", true ); ?>&w=69&h=54&zc=1" alt="<?php the_title(); ?>" />                                          <?php the_title(); ?>
                 <?php                     endwhile;                 ?>

      Basically when hovering on a post - image , the "Check out the latest..." changes to the name of the post. When the plugin WP-PostRatings is activated, the dock doesn't work on homepage. ONLY on post-pages and pages... When I deactivate the plugin it's all working fine again... Is there any other plugin for ratings that I can customize and put wherever I want it ? Or is there a way to fix this ?


title: Exclude category from drop down list form

text: I need a bit of quick help. How do I exclude category ID number 50 for example in drop down list form in Wordpress? I have this code and I need to just insert the excluded category id.               <?php     $cate_id = retrieve_cat_data(true);     $cate_name = retrieve_cat_data(false);     for ($i = 0; $i < count($cate_name); $i++ ) {      ?>          <option value="<?php echo $cate_id[$i]; ?>"><?php echo $cate_name[$i]; ?>     </option><?php } ?>      Thanks in advance to everyone :)


title: the_post_thumbnail() get the URL to the "medium" sized image

text: In the script below, I need to get the URL path to the "medium" size image in the "data-responsive" attribute. Its currently returning the thumbnail size.               the_post_thumbnail("thumbnail",          array(             'itemprop' => 'image',             'class' => 'alignleft',              'style' => 'margin:5px 15px 10px 0;',              'data-responsive' => wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID),'medium')             )         );      I want the thumbnail used as the default image, however, I need to write the URL to the medium sized image so that I can use that in media queries to swap the image to higher res on larger devices.


title: Set post comments open function

text: I've been searching high and low for a php function to set a comments of a given postID open only found function to check what the comment status is               <?php comments_open( $post_id ); ?>      I need one to set comment would expect it to be               <?php set_comments_open( $post_id ); ?>      But it isnt anybody got any idea what the function is or if there isnt one how to do it?


title: Build Specific Apps on the Wordpress Framework?

text: I'm planning to use wordpress as a backend for theming and user registration/login features. I'm creating an app using php which I'd like to work within a wordpress site. I don't know how to build wordpress plugin but I want to use it as a backend. Any idea how it can be done?


title: Change quick edit terms list to radio buttons

text: is it possible to remove the current tax term checklist from the quick edit screen? i have switched the metabox for the "subject" taxonomy, to radio buttons, and would like to do the same in the quick edit box. i don't see any filters/hooks for changing the existing method, only an action for adding new items to the quick edit screen. is my only solution, therefore with javascript? quick edit only works w/ javascript enabled anyway. ![screenshot of quick edit](http://i.stack.imgur.com/1WRp7.png)


title: E commerce on Wordpress

text: What is involved with WordPress and trying to develop our commerce site that way? Will it integrate with our CounterPoint register and inventory system? Does it calculate weights and shipping? Generate a confirmation email when an order gets placed? Does it get built in a similar way that I'm working with WordPress in that you can see the item you are loading, preview the page, attach appropriate tags, etc? Is there a website that you know of that is using WordPress for their commerce that we can view?


title: How does Show Posts based on a keyword search work in WP_Query

text: I am wondering how the search go through by defining 's' parameter in WP_Query. For example if I have a post assigned to "East" term in taxonomy "Direction", the post didn't mention any "East" or "Direction" word in the post content or title. When I define the 's' value as "east" (no other parameter defined) in the WP_Query, can wp_query found the post? Sorry for my bad English, hope you understand. Thanks


title: How to bring an old edited/modified post in the front of page?

text: Is there a way to bring, automaticaly, an old edited/modified post in the front of page? More clear, I want that every time when i edit a post to display it in front of my page, like sticky posts or something. Is that possible? **Edit** First, thanks for your promptly answer! Yes, in part this is it, but it's not exactly what I want. **This function add posts in front of my page and it's OK:**               <?php query_posts($query_string . '&orderby=modified&order=desc'); ?>      but, in addition, I would like this to happen in sidebar too, in " _recent posts widget_ " and in " _Featured Posts Grid_ ", it's the Featured Content Slider that i use it. **This function doesn't work for me, i don't know why:**               <?php      function wpse10691_alter_query( $query )      {          if ( $query->is_main_query() && ( $query->is_home() || $query->is_search() || $query->is_archive() )  )          {              $query->set( 'orderby', 'modified' );              $query->set( 'order', 'desc' );          }      }      add_action( 'pre_get_posts', 'wpse10691_alter_query' );      ?>


title: How to remove all javascript in a theme wordpress?

text: I have a theme name is mytheme in `themes/mythem/functions.php` I using code:               function remove_scripts() {        remove_action('wp_head','mytheme_head_scripts');     }     add_action('init', 'remove_scripts');      =>but result can't remove all javascript, how to fix it ?


title: File names are being overridden when uploading new media

text: I want to hook into the media upload function and prefix file names with a timestamp. We're uploading a lot of stuff within a month, so we can't rely on the directory structure, and we're also dealing with a bunch of teenagers, so I'm looking for a step around the user. Anyone have a solution?


title: How can I hide the Permalink/Shortlink for certain user logged in Users of a certain level?

text: I would like to keep logged in Users who can write and edit their own posts from seeing the Permalink/Shortcode for the post (located under the Title field). I've been able to cut out other features but can't figure this one out. Any ideas?


title: Restricting Users to view only Custom Taxonomies they have entered?

text: I've been able to restrict users to only seeing their own posts, both on the front end and within the admin section. Now I would like to restrict them to only seeing the Custom Taxonomy data they have entered. My example: I have created a Custom Taxonomy called Partners. I would like each user to be able to add his or her partners so they can be associated with a post. I want to keep a User's Partners only available to the User who created them. Does that make sense? Does anyone have a way to implement this? Thanks!


title: Strange Behavior on New Theme Points to Idiocy

text: I was trying to block public access to my site while I developed a theme on a new domain. I was doing it with GD Press Tools' "Prevent website access if the user is not logged in" feature, because it's so damn easy to tick off a checkmark. Strangely, it didn't work on my new theme. You may say, "try another way of blocking public access", and I'd agree with you. But, it's worrying because it's not GD Press Tools' fault. The "prevent website access" feature is perfectly functional on the default twentyeleven theme. So basically I'm at fault somehow, and if GD Press Tools isn't liking it, I must've screwed up something major. I've pastebin'd the entirety of my theme so far here. It's extremely bare and simple, consisting of index.php and style.css. *Note that pastebin isn't showing wp_head before the closing head tag, but it's there. My 404.php page is slightly custom, but commenting out the entirety of the file made no difference. You can view the code here. I have no idea what is going on here. Would you mind taking a look at my code?


title: Get author_id in wordpress

text: I'm having problems to get author_id in this code. Don't show nothing. Some can help me?               <?php global $query_string;          query_posts( $query_string . '&orderby=rand' ); ?>          <?php while(have_posts()): the_post();     $author_id = the_author_meta('ID');     echo 'Autor:'.$author_id;     $ofertas = array();          // Second Loop     $i = 0;     $args = array(         'author' => $author_id,         'post_type' => 'ofertas'     );     $the_query = new WP_Query( $args );     if ($the_query->have_posts()) :          while ($the_query->have_posts()) : $the_query->the_post(); // check if it has offers, if it has, loop over the offers             $ofertas[$i]['title'] = get_the_title(); // or anything you need             $i++;         endwhile; // close the loop     else: // if it has no post         continue; // we don't display the post     endif;          wp_reset_postdata();      ?>              <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>


title: Get latest blog post from another multisite blog

text: I have a site at the main domain and then a blog at blog.domain.com. Any way to retrieve the latest post from the blog.domain.com and echo it out on the top of my home.php file? Not really sure where to look, many outdated examples :X


title: Exclude sticky post from main query?

text: I am having alot of trouble with this. I was using `<?php query_posts( array( 'post__not_in' => get_option( 'sticky_posts' ), 'paged' => get_query_var( 'paged' ) ) ); ?>` to exclude the posts from the main query on the my homepage because stickies are being used in the slider. I am making this theme for wordpress.org and I was told that was not recommended. I then tried adding this to my functions.php but to no avail:               /**      * Excluding sticky posts from home page. Sticky posts are in a slider.      *      * @since 0.1      */     function essential_exclude_sticky( $query ) {              /* Exclude if is home and is main query. */         if ( is_home() && $query->is_main_query() )             $query->set( 'ignore_sticky_posts', true );          }      ` Any idea on what I am doing wrong?


title: problem with register_activation_hook in plugin

text: I am developing a plugin that inserts content to wordpress on plugin activation. I also have an admin are where I can add a link to the inserted post. The admin is a input box where I can input my link and click save and it should be updated in the post. Basically the plugin works as far as inserting post when it's activated, saving the link in the admin area, but the problem is that the link is not updated in the post when I enter one in the admin area. I believe this is one of those headers already sent issues since register activation hook runs before the admin setting is updated. Can someone point me to the right direction. My admin page look like this.               function link_input(){     global $options. this is the global function that hold the setting. i.e $options = get_option(my_settings);     ob_start();// starts php output buffer.     ?>          <form action ="options.php" method="POST"><?php echo settings_fields('link_group');?>              <input type="text" name="my_settings['my_link']" value="<?php echo options['my_link'];?>"/>              <input type="button" class="button-primary" value="save link"/>          </form>     <?php     echo ob_get_clean();     }      This is the function that inserts post on plugin activation.               function insert_post_on_activation(){     global $options; // this is the link that I enter in the admin area. Set to global.          // Create post object     $my_post = array(       'post_title'    => 'Test Post',       'post_content'  => 'This is my post. Link',/*this is the link that is not reflecting what I insert in the admin are */       'post_status'   => 'publish',       'post_author'   => 1     );          // Insert the post into the database     wp_insert_post( $my_post );          }     register_activation_hook(__FILE__, 'insert_post_on_activation');


title: How do I add a timezone offset to this query?

text: Problem is that $today is pulling GMT from the database; I need to offset GMT by -6 hours; Have been unable to find a query with an offset like that.               <?php        $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;        $today = date('Y-m-d');        query_posts(array(        'post_type' => 'performance',         'posts_per_page' => 4,         'caller_get_posts' => 4,         'paged' => $paged,        'meta_key' => 'order-date',        'orderby' => 'meta_value',        'order' => 'ASC',            'meta_query' => array(                array(                  'key' => 'order-date',                  'meta-value' => $value,                  'value' => $today,                  'compare' => '>=',                  'type' => 'CHAR'              )           )         ));       if (have_posts()) :       while (have_posts()) : the_post();     ?>


title: Custom User Role: Upload and edit images, but not edit posts - any other way?

text: I have a question pretty similar to this one: Why does my custom WP role need edit_posts to edit images? but I couldn't make their solution work. And I couldn't comment there because I don't have enough reputation yet -.- I want to my custom user role to be able to upload, manage and delete media from the media gallery, but I do not want to give them edit_post rights. They are only supposed to edit the custom post type "kunstwerke". With my present user role the user is able to see the pictures and upload own pictures, but not able to edit pictures that are already uploaded - neither by the user himself or other users. I did add 'upload_files' and 'edit_files' capabilities. Here is my custom post type and custom user role:               register_post_type('albertis-kunstwerke',         array(         'labels' => array(             'name' => __('Kunstwerke'),             'singular_name' => __('Kunstwerk')),         'public'=> true,         'has_archive'=>true,         'rewrite'=>array('slug' => 'kunstwerke'),     /*  'taxonomies' => array('category'), */         'supports' => array(/*'title','categorys',*/'thumbnail'),         'capability_type' => array('kunstwerk', 'kunstwerke'),         'map_meta_cap' => true,         'capabilities' => array(             'edit_post' => 'edit_kunstwerk',             'edit_posts' => 'edit_kunstwerke',             'manage_post' => 'edit_kunstwerk',             'manage_posts' => 'manage_kunstwerke',             'read_kunstwerk' => 'read_kunstwerk',             'read_kunstwerke' => 'read_kunstwerke',             'edit_published_post' => 'edit_published_kunstwerk',             'edit_others_posts' => 'edit_others_kunstwerke',             )     ));      }               //CREATION OF CUSTOM USER ROLE          add_role('albertis-redakteur', 'Albertis-Redakteur', array(                 'edit_kunstwerk' => true,                 'edit_kunstwerke' => true,                 'delete_kunstwerk'=> true,                 'delete_kunstwerke'=> true,                 'read_kunstwerk'=> true,                 'read_kunstwerke'=> true,                 'edit_others_kunstwerk'=> true,                 'edit_others_kunstwerke'=> true,                 'publish_kunstwerk'=> true,                 'publish_kunstwerke'=> true,                 'edit_published_kunstwerk'=> true,                 'edit_published_kunstwerke'=> true,                 'delete_published_kunstwerk'=> true,                 'delete_published_kunstwerke'=> true,                 'edit_pages'=> true,                 'publish_pages'=> true,                 'delete_pages'=> true,                 'delete_others_pages'=> true,                 'delete_published_pages'=> true,                 'edit_published_pages'=> true,                 'edit_dashboard'=> true,                 'upload_files'=> true,                 'edit_files'=> true,                 'activate_plugins'=> true,                 'update_core'=> true,                 'update_plugins'=> true,                 'edit_theme_options'=>true,         )) ;      Help is greatly appreciated. Also: I don't want to use plugins for this, as part of the project requirements.


title: Using wp_filesystem in Plugins to store customizer settings

text: I try to fix my plugin with the answers i got here: Using wp_filesystem in Plugins Background i wrote a theme (https://github.com/bassjobsen/jamedo- bootstrap-start-theme) and a plugin (https://github.com/bassjobsen/wp-less-to- css) now i want to integrate the plugin in the theme. The plugin wrote a CSS file to a folder. Write files with native PHP function is not secure as described here: http://ottopress.com/2011/tutorial-using-the-wp_filesystem/. The previous answer helps me to fix this issues for the plugin. The solution provide by @otto relays on `request_filesystem_credentials` which seems to requires a URL. This URL will give me some troubles when integrate the plugin with the theme. My target is to use settings from the customizer after saving to create a new css file. Now i have in functions.php:               add_action( 'customize_save_after', 'lesscustomize' );          function lesscustomize($setting)     {     //$setting is no used here     $updatecss = WP_LESS_to_CSS::$instance;     add_filter( 'add_extra_less_code', 'add_extra_less_now_live');          function add_extra_less_now_live($parser)     {         return 'h1{color:'.get_theme_mod( 'heading_color').'}';               }     $updatecss->wpless2csssavecss();     }      Where `wpless2csssavecss()` now saves the file with `file_put_contents`. The `file_put_contents` should be replace with a `$wp_filesystem->put_contents();`. Cause `$wp_filesystem` will be used as a global i think it should be possible to get the file system credentials in my `lesscustomize()` function. Beside i have no idea how to do this without a URL. There will be a URL but it is called by Ajax and not visible for the user. The idea to use 'customize_save_after' came from http://stackoverflow.com/questions/14802251/hook-into-the-wordpress-theme- customizer-save-action/16679837 My initial question will it be possible to get file system credentials in my `lesscustomize()`? Or if not will there be an alternative to hook the customizer settings save action and get file system credentials to save my settings? **update** In this update of the question, i will react on the useful answer of Mark Kaplun. I expect this will help to understand my initial question. > What you are trying to do is wrong if it is for general purpose use and is > not >tailored for the needs of a specific client. Dynamically modifying your > >theme's code, and css is code like JS, is usually a bad idea that bring > only >maintenance problems In my theme i use LESS in stead of CSS (although you could also write CSS). I think this will be useful and fits the needs of the theme users. In the first place LESS keeps things clean and in the second place my theme is build with Twitter's Bootstrap. LESS will be the most kind of direct way to modify Bootstrap based HTML/CSS. I don't modify my theme code, i only want to save my CSS to file, where CSS will be compiled from LESS. Maintenance strategy of the code i have described here: http://bassjobsen.weblogs.fm/integrate-less-jbst- wordpress-theme/ > In addition to the theoretical reasons there are user expectations related > to the UX of theme customization which do not involve writing files to the > server. I do not understand what write files has to do with UX. People using my theme choose a theme which use Bootstrap and so LESS. I think they should understand there should be written files somewhere. I agree an extra step for filling in your credentials will give a bad UX. > If you truly need to save files on the server then the right place for them > is >the /wp-content/uploads directory. Yes, that's what i do now. http://ottopress.com/2011/tutorial-using-the- wp_filesystem/ tells me it is a bad idea. Since WP3.8 it will also don't pass the theme tests on wordpress.org: "WARNING: file_put_contents was found in the file wp-less-to-css.php possible file operations." > The better way to do it is to have minimal LESS files that are relevant only > to the options that are controlled by the user. once the options are changed > you compile the LESS and store the generated CSS in an option and output it > as part of each pages HTML, like most themes are doing with their > customizable options. I agree this could be an option. Writing inline CSS does not be the best solution always, see also: https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery. Not all customization setting have to be critical or part of the above-the-fold CSS. Beside in my case some setting will also recompile Bootstrap's CSS (for example changing the @grid-float-breakingpoint) i can not inline thhis code.


title: Site no longer working following server crash - how to restore it

text: I have a site that suddenly stopped working earlier due to what I can only assume was the server going down. Now I can connect using ftp but in the browser I get the following. Any advice on how to get the site back again gratefully received. > Internal Server Error > > The server encountered an internal error or misconfiguration and was unable > to complete your request. > > Please contact the server administrator, webmaster@websitename and inform > them of the time the error occurred, and anything you might have done that > may have caused the error. > > More information about this error may be available in the server error log. > > Additionally, a 500 Internal Server Error error was encountered while trying > to use an ErrorDocument to handle the request.


title: Getting this code to work in Multisite

text: I'd like to run this code via cron on multisite. When I use the admin_init hook the code executes and works perfectly, deleting the blogs, however when I set it as a cron, and then run the event with the WP Crontrol plugin, the blogs don't get deleted. What gives?               register_activation_hook( __FILE__, 'remove_blogs_activation' );         /**          * On activation, set a time, frequency and name of an action hook to be scheduled.          */         function remove_blogs_activation() {             wp_schedule_event( 1386979200, 'daily', 'remove_blogs_hook' );         }                   add_action( 'remove_blogs_hook', 'remove_blogs_daily' );              function remove_blogs_daily() {              $all_blogs = wp_get_sites();                      foreach ( $all_blogs as $key => $val ) {                      $blogs_to_keep = array( '1','2' );                 if ( ! in_array( $val['blog_id'], $blogs_to_keep ) ) {                     wpmu_delete_blog( $val['blog_id'], true );                           }                  }         }      The new code I'm using, to also clear the users:                   <?php                        register_activation_hook( __FILE__, 'wpchat_clear_sites_activation' );         /**          * On activation, set a time, frequency and name of an action hook to be scheduled.          */         function wpchat_clear_sites_activation() {             wp_schedule_event( 1386979200, 'daily', 'daily_clear_sites_hook' );         }                   add_action( 'daily_clear_sites_hook', 'wpchat_clear_out_sites_daily' );         /**          * Clear out the sites and users          */         function wpchat_clear_out_sites_daily() {              require_once( ABSPATH . 'wp-admin/includes/admin.php' );             require_once( ABSPATH . 'wp-admin/includes/user.php' );                  if( ! function_exists( 'wpmu_delete_blog' ) ) return;                      $users_to_keep = array( '1','4','43' );                  $blogs_to_keep = array( '1','4' );                  $all_sites = wp_get_sites();                      // Remove all blogs except for the main blog and the template blog             foreach ( $all_sites as $key => $val ) {                      $users = get_users( array( 'blog_id' => $val['blog_id'], 'fields' => ID ) );                      // Remove all users except for the test site admins                 foreach ( $users as $user) {                           if ( ! in_array( $user, $users_to_keep ) ) {                         wp_delete_user( $user['ID'] );                     }                 }                      if ( ! in_array( $val['blog_id'], $blogs_to_keep ) ) {                     wpmu_delete_blog( $val['blog_id'], true );                           }                  }         }              register_deactivation_hook( __FILE__, 'wpchat_clear_sites_deactivation' );         /**          * On deactivation, remove all functions from the scheduled action hook.          */         function wpchat_clear_sites_deactivation() {             wp_clear_scheduled_hook( 'daily_clear_sites_hook' );         }


title: How to stop mobile theme inheriting desktop navigation menu?

text: UPDATE************ Well I have a working solution, although not ideal. Using the Genesis sandbox child theme which has a mobile nav button built-in, I was able to set that to use the primary nav menu, so that takes care of minimised desktops. I then added the responsive menu plugin which allowed me to choose my custom mobile menu for the source. Then I hid the plugin for desktop use, and hid the Genesis menu button for mobiles. Will leave it a few days and then choose who gets the 50 points - thanks to all for your contributions... * * * (QUESTION RE-PHRASED) Trying to build a mobile version of my site. 2 themes, 1 for desktop and another just for mobile visitors (mobile theme selected automatically for mobile visitors with "any mobile theme plugin"). I have created a custom menu for each theme in wp admin / menus - desktop menu and mobile menu. With the desktop theme activated I select the desktop menu for the primary navigation. With the mobile theme activated I set the primary navigation to mobile menu. The problem is that I have to have the desktop theme active for normal operation. Mobile visitors do see the alternative mobile theme, but the navigation always follows whatever the desktop primary navigation is set to. How can I stop this happening and force the mobile theme to always/only use the mobile navigation?


title: Check to see if post is live before displaying the content

text: I'm trying to pull the content from a post/page into a template file. I'm using the following code, which works fine HOWEVER the content is pulled in regardless of whether it is set to 'live' or 'draft'. Is there a way of checking to see whether the post is live before pulling in the content?               <?php  show_post('Offers');  // Shows the content of the offers page. ?>      Thank you * * * Please note this function is being used...               <?php      function show_post( $path ) {         $post = get_page_by_path( $path );          $content = apply_filters( 'the_content', $post->post_content );          echo $content;     }      ?>


title: Archive template

text: I have several custom post types and we need to create separate archive templates for these. I tried the following advice, but it's still using the default archive template. > In the form of the single-type-template. In the same way that posts are > shown on their own page with single.php, custom post types will use > single-{posttype}.php if it's available. > > So for the above example, you could create a single-acme_product.php file > and the product posts would be shown using that template. > > In the form of the archive-type-template. In the same way that posts are > shown on their own archive with archive.php, custom post types will use > archive-{posttype}.php if it's available. > > So for the above example, you could create a archive-acme_product.php file > and the product posts would be shown using that template. Any help would be greatly appreciated. **Here is my code**               function camps_register_post_type() {        register_post_type('camps', array(            'labels' => array(                'name' => 'Camps & holidays',                'singular_name' => 'Camps & holidays',                'add_new' => 'Add New Camps & holidays',                'edit_item' => 'Edit Camps & holidays',                'new_item' => 'New Camps & holidays',                'view_item' => 'View Camps & holidays',                'search_items' => 'Search Camps & holidays',                'not_found' => 'No Camps & holidays found',                'not_found_in_trash' => 'No Camps & holidays found in Trash'            ),            'public' => true,            'has_archive' => true,            'rewrite' => array("slug" => "camps"), // the slug for permalinks             'supports' => array('title', 'editor', 'thumbnail')        ));     }


title: Archive for CPT

text: I've created a CPT & used the default category & tags instead of creating new taxonomy for those CPT. Now while generating the 'list all'/ archive page, my query is returning only the posts that added through the default posts> section of admin menu. What if I want them separately? Should I use independent page templates with custom query?


title: Restrict users viewing post using age on database

text: Is there a way to have a birthday field on database then use the age to restrict viewing posts?


title: Theming media inserts

text: When I Insert media into my post or page it's rendered as a normal link. Would it be possible to somehow theme links that point to e.g. PDF or other file types?


title: How can I make my blog private?

text: I want to create a blog to share with my family, but random Internet strangers should not be able to read the posts. **How can I make posts hidden to the public, by default?** I know I can manually edit the visibility of single posts while I edit them - one at a time. **Is there some global preference setting that I could set to "private"?** That would have the benefit of also working with the Wordpress app for iPhone, as well as the "post-by-mail" feature of Jetpack. Both of these would otherwise publish a normal, public post. Several old answers mention variants of the outdated "Members only" plugin - but this is outdated so not an option, even though it might have been a good solution. This plugin question also has the same goal, but it's aimed at plugin development, and the answers don't apply. **Is there really no (current) plugin that does this?**


title: Using a wildcard with delete_transient()

text: I am using the Transients API to hold the output for a gallery plugin's shortcode I created. Due to the number of images used and different layouts needed, the transient name looks lik the following:               _transient_galleries_single_shortcode_5183five      So - the `int` portion is the post ID it is referencing and the `five` is this specific shortcode's column setting. Where I'm running into trouble is flushing these shortcodes on-save of the referenced galleries. What I'd normally do is something like following:               function galleries_delete_transient($post_id) {         switch (get_post_type()) {             case 'galleries':                 delete_transient('galleries_single_shortcode_'.$post_id);             break;         }     }     add_action('save_post','galleries_delete_transient');      The problem being here is that the column setting can be different based on a certain page's needs - so I was wondering if there is any type of wildcard I can use here to make this a bit more dynamic (to just clear all of them - something like `delete_transient('galleries_single_shortcode_'.$post_id%);`). Any help would be greatly appreciated. Thanks! # Update Complete shortcode function added for clarity how everything is constructed:               function galleries_single_shortcode($atts, $content = null) {         extract(shortcode_atts(array(                 "id"     => '',                 "columns" => 'four'         ), $atts));              global $galleries_options;              $galleries_single_shortcode_output = get_transient('galleries_single_shortcode_'.$id.$columns);         if ($galleries_single_shortcode_output === false) {                  ob_start();                  // OUTPUT HERE                  $galleries_single_shortcode_output = ob_get_contents();                  ob_end_clean();                  set_transient('galleries_single_shortcode_'.$id.$columns, $galleries_single_shortcode_output, 60 * 60 * 24);              }                   return $galleries_single_shortcode_output;     }     add_shortcode('galleries_single', 'galleries_single_shortcode');


title: How to remove version and thank you message from the admin footer

text: I've used following codes and no luck **1**               //Hide admin footer from admin     function change_footer_admin () {         return ' ';     }     add_filter('admin_footer_text', 'change_footer_admin', 9999);          function change_footer_version() {         return ' ';     }     add_filter( 'update_footer', 'change_footer_version', 9999);      **2**               function wpbeginner_remove_version() {     return '';     }     add_filter('the_generator', 'wpbeginner_remove_version');      **3**               function my_footer_shh() {         remove_filter( 'update_footer', 'core_update_footer' );      }     add_action( 'admin_menu', 'my_footer_shh' );      Still I see those texts and version on my footer. ![have a look at the screen shot](http://i.stack.imgur.com/4vqVy.jpg) So what is the accurate way to remove these? I've added these code snippets into my **child theme function.php**


title: Is there a way to define wp_blogs domains in wp-config?

text: In my multisite setup I have multiple environments that I want to share the same database, but use different domains.   * server1.example.com   * server2.example.com   * example.com ... each of those would point to the same database. This works perfectly fine in a standard WP install using `define( 'WP_HOME', 'http://server1.example.com' );` and `define( 'WP_SITEURL', 'http://server1.example.com' );`. When you add multisite to the mix it breaks. **The problem is that the`wp_blogs` table defines the domains too, so I need a way to define them in the config file. Is there anyway to do that?**


title: accessing wordpress serialized data outside wp

text: I've never worked with serialized data... I need a little help with how to load "text" widgets title and content in php script outside wordpress... my script just connects to database (including wp-config and using its values). secont thing is to load wp_options entries with option name `sidebars_widgets` and `widget_text`. Here is where I do not know how to continue - data is serialized (example follows) and I don't know, how to process it in php...               widget_text content:     a:7:{     i:2;a:3:{s:5:"title";s:11:"lorem ipsum";s:4:"text";s:17:"...lorem ipsum...";s:6:"filter";b:1;}     i:3;a:3:{s:5:"title";s:0:"";s:4:"text";s:3:"...";s:6:"filter";b:0;}     i:4;a:3:{s:5:"title";s:0:"";s:4:"text";s:3:"...";s:6:"filter";b:0;}     i:5;a:3:{s:5:"title";s:0:"";s:4:"text";s:3;"...";s:6:"filter";b:0;}     i:6;a:3:{s:5:"title";s:7:"1234567";s:4:"text";s:0:"";s:6:"filter";b:0;}     i:7;a:3:{s:5:"title";s:7:"1234567";s:4:"text";s:0:"";s:6:"filter";b:0;}     s:12:"_multiwidget";i:1;}      Thanks for help


title: How to create Repeater fields using Advanced Custom Fields?

text: I'm using Advanced Custom Fields and trying to create a field with the field type Repeater. But the problem is that the Repeater option doesn't appear in the select list with the field types. I can't figure out what's wrong. I'm using Advanced custom fields v3.5.3 and Wordpress 3.4.2. What could be the issue?


title: Exclude the category from the WordPress loop

text: I have this code for the loop, and I need to exclude a category `4` from this loop. Any suggestions on how to achieve this? Code that starts the loop                <?php if(have_posts()): ?>              <ol class="item_lists">                  <?php             $end = array(3,6,9,12,15,18,21,24,27,30,33,36,39,42,45);             $i = 0;                  while (have_posts()) : the_post();                $i++;                global $post;      ?>


title: get_children() returns ALL attachments instead only those attached to 'post_parent'

text:
I want to pull four random images from the current post's attachments to display as "featured images". Therefor I am using the following function:               function fs_gallery_featured_thumbs( $post_id ) {          // DEBUG: validate parent post ID         echo $post_id;         // Query to get images for this post         $query = array(             'post_parent'       => $post_id,             'post_type'         => 'attachment',             'post_mime_type'    => 'image',             'order'             => 'RAND',             'exclude'           => get_post_thumbnail_id( $post_id ) );              $images = array_rand( get_children( $query ), 4);             // If images exist for this page         if ( $images ) {             echo '
';             $i = 1;             foreach ( $images as $image ) {                 $imageAttributes = wp_get_attachment_image_src( $image, 'gallery-thumbnail-1x1' );                 echo '0)).'" class="featured-thumb featured-thumb-'.$i++.'" width="152px" height="152px" />';             }             echo '
';         }     }      The only parameter is passed from inside the loop via `the_ID()` and is in fact returning the correct parent post ID (I verified this using `echo $post_id;` inside above function. However, for some reason, the array `images` contains four random items of ALL images that are inside the media gallery, not only the ones which are attached to the current post. How can I really only get the images which are attached to the post? When I use the `[gallery]` shortcode in this post, the correct images are shown. All I want is four random images from that gallery. Any ideas? Not sure if this has anything to do with it: the posts which all the other (wrong) images were attached to, were deleted at some point. The images still linger inside the media gallery however, however the post ID of the post they are "used in" (not sure about the correct English term here, my WP is German) is different to my `post_parent`. Thx.


title: Date Archive template per category

text: I have the following template structure currently:               category-news.php     category-magazine.php     category-filmography.php      Each page has a different sidebar, and each page has an archive widget in that sidebar. I want to be able to retain the custom category layouts for archive searches BY DATE. Currently, i filter each archive widget on each sidebar by the category it is associated with, but as soon as you actually click an archive date you get the generic post list for that period. How can i retain my custom category page for the date queries too? Effectively, i want to be able to do something like:               date-news.php     date-magazine.php     date-filmography.php      Although i know that is not possible. Is there a workaround to this?


title: page shows 404 on form submit

text: I have creating a template page in which i have a form, upon testing it gave a 404 error. should i putting something else in action?               `<form action="results.php" method="post">         <!--my code-->     </form>`


title: metabox with custom post type values

text: I need to re-write a current WP website and I think Custom post types are required, combined with Meta Box. The basic layout is Author (custom) Books (custom) Photos (custom) All 3 custom post are individual but also "linked" in some way. An Author, will have written 2 Books and taken 10 photos The same goes for when browsing for Books, I need to link the author, and then photos of this author. How do I recreate a metaBox in each custom post to allow the Multi selection of other post. To clarify, when adding an Author, I need the ability to link Books and Photos to it (using their own types). I hope it's "kind" of clear. Will appreciate some help... thx


title: Include categories in search results?

text: I am using the standard WordPress search and search.php file to display results. I want to query both posts and categories at the same time and return results in order of relevance. For example, I have a category called 'Broadband' and several posts that also contain 'Broadband' in their title. By default, WordPress will only search through posts, so my category is not returned. Is there a way to search both posts and categories together so that it is possible to go to a category from the search results page?


title: Date, Time, and Timezones

text: I am a bit confused about using dates/times along with timezones in WordPress. I have the following questions:   1. What is the purpose of the timezone setting in the Admin -> Settings section?   2. Assume current time in GMT is 20:00, and Assume I am in EST (so it is 16:00 in EST time), how is the time of the blog saved?   3. Assume a reader is reading the post, and he/she is located in Turkey. So their local time is 23:00, do they see 23:00 as the post time?   4. Assume I am using a custom post type, and I am having an extra date/time field for other date information. How do I ensure that the custom date field behaves as the WordPress field?  I apologize for those basic questions, but I really need your help explaining those.


title: Is there a premium plugin for appointment reservation?

text: This question will probably be closed. In the off chance that it isn't.... I am looking for a premium plug in that will allow the user to book appointments by reserving a block of time. There will be a public calendar that shows time already reserved. There will be no financial transaction, which has caused me to rule out several options.


title: How to solve Robots.txt problem with WordPress fresh install?

text: I installed a fresh copy of WordPress few weeks ago and I have been having some strange problems. 1- I get this message : "Comments for Yad Faeq yadfaeq.com/ A description for this result is not available because of this site's robots.txt – learn more." When I google my name. I re-checked setting and I haven't checked the "discourage option" 2- I installed WP Better Security and Yoast SEO plugin. Now I have another problem! When I google my domain RANDOM Web Sniffing Websites come up that exposes my data server and many more thing! Where did I go wrong ? PS: My robots.txt is fixed to disallow only Plugin Folder since yesterday (not too long)


title: How can I add a custom "Text" widget to Appearance manager from functions.php?

text:
I'm trying to add a replica of the default WP text widget, with my own css class parameter, to functions.php so that it appears in the widgets manager and can be added to a sidebar. My first attempt is below, but I'm certain there has to be an easier way than how I'm doing it. Can this be done in a simpler manner? In functions.php, I've got this...               $google_search = TEMPLATEPATH . "/google_search.php";require_once($google_search);     add_action('widgets_init', create_function('', "register_widget('My_Widget_Search');"));      In google_search.php, I've got... (Everything works except the textarea field contents aren't being saved)               <?php          class My_Widget_Search extends WP_Widget {              function My_Widget_Search() {             $widget_ops = array( 'classname' => 'widget_search', 'description' => __( "Google Adsense Search Widget Placeholder" ) );             $this->WP_Widget('adsense_search', __('Adsense Search Widget'), $widget_ops);         }              function widget( $args, $instance ) {             extract( $args );             $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( '' ) : $instance['title']);             $text = apply_filters('widget_text', empty( $instance['text'] ) ? __( '' ) : $instance['text']);                  }              function update( $new_instance, $old_instance ) {             $instance = $old_instance;             $instance['title'] = strip_tags($new_instance['title']);             $instance['text'] = $new_instance['text'];                  return $instance;         }              function form( $instance ) {             //Defaults             $instance = wp_parse_args( (array) $instance, array( 'title' => '') );             $title = esc_attr( $instance['title'] );             $text = $instance['text'];     ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?>             <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
             <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name=""<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>     <?php         }          }


title: jQuery issue and wp_enqueue_script

text: Actually i have one theme with enqueue for insert jquery code and reference for the core and also jquery iu Bus happend things that i don´t understad, actually as i tell until i need insert code for create slide of images , simple slide with popular plugin which works perfect in single pages For this i create simple shortcode and show images and this move into slide When i create the shortcode this show the images but no move , i see if the code of plugin load in the DOM and i see the perfect reference and the reference also to the core of jquery inside the head in the theme and when load the page I see one time and other time and the slider no works , finally i put the reference remote code of jquery inside the content ofr shortcode and finally the scrip of slider works but all jquery code of the rest of my blog , never more works and in the dom i see 2 calls to load jquery core I don´t understand if i see in the head - in the DOM - the reference to general core of jquery , why no works the scripts all , because in the DOM i see this jquery core and all scripts mus works perfectly , if the core load , but also works if core of jquery it´s until inside the shortcode How it´s possible Sorry i hope understand all regards For example this , only works the codes about this plugin if until put the call to remote core of jquery and if no , no load nothing and this core code really load in the head .....               wp_enqueue_script('jquery-cycle',  TEMPLATE_PATH . '/js/jquery.cycle.all.js', array('jquery'), null );      For no get problems i create this but continue the problems :               function fix_noconflict() {     wp_deregister_script( 'jquery' );     wp_register_script( 'jquery' , 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );     }     add_action( 'wp_enqueue_scripts' , 'fix_noconflict' );


title: How to Override a Pluggable Function

text: How can I override a function in pluggable.php? I have tried making my own plugin -- got the fatal error on function already defined. I tried functions.php in my theme -- got the white screen. Is it possible to override a pluggable.php function without touching the source code file itself? Thanks. **Here is the function I wish to override (located in ../wp- includes/pluggable.php):**               if ( !function_exists('wp_new_user_notification') ) :     /**      * Notify the blog admin of a new user, normally via email.      *      * @since 2.0      *      * @param int $user_id User ID      * @param string $plaintext_pass Optional. The user's plaintext password      */     function wp_new_user_notification($user_id, $plaintext_pass = '') {     ...     }


title: User Tracking for Custom Post Type "Lesson". Database Queries and Performance

text: So I wrote this little code snippet to add a post id along with the current users id to the user meta table. I'll use this to show the "lesson" posts that a user has viewed back to them. My only concern with this way of doing it this way is that it seems Wordpress will have to loop through this whole table to retrieve these posts. What if there are tens of thousands of users (I'm being optimistic) and they all view on average 10 or 20 lessons? Could this cause performance issues? I don't know enough about databases yet to know. Is there maybe a better way to go about this that I'm missing?               <?php     if ( is_user_logged_in() ) {         $user_ID = get_current_user_id();         $post_ID = get_the_ID();         add_user_meta( $user_ID, 'viewed_lesson_tracking', $post_ID ); // tracks that user has viewed the current post     }     ?>      Thanks for your help!


title: themeforce (happytables framework) implementation

text: OK, I've been trying to implement themeforce in the roots theme and couldn't make it work. Then I tried it with the twentyeleven theme and still couldn't make it work. Instead all I get is an HTTP Error 500. PLEASE someone that has already implemented this, could you copy-paste the appropriate lines from your functions.php file? WP 3.4, latest themeforce from https://github.com/themeforce/framework What am I missing? I git cloned it inside my theme, added the wpthumb (also from git) 'cause it doesn't get copied when you clone the framework theme and then tried editing my functions.php


title: How to reduce Apache connections caused by plugins?

text: I've been having an increasing lack of performance in my server (slowness, stalling on page loads, largely backend issues where I spend most of my time) over the past month or two on what is primarily a standard blog. The site gets 20k hits a day though I even have these issues on weekends when traffic is lower as well. Current host/setup:   * Knownhost VS3 (VPS) / Apache / RAM: 1216 MB   * Optimizations: WP Super Cache & Cloudflare (CDN)   * Memory usage typically at 15-20% / Hard Drive: 50% of 60GB I tried uninstalling Super Cache & installing W3TC. That brought some additional issues including finding out the hard way that we couldn't enable object caching. Server issues have been ongoing for the past couple years with a few different companies. It's not new/recent, just getting worse. **My main question is whether the plugins I have enabled could be creating these problems as my host suggests & if so, how do I reduce the number of connections?** PConnect is not a possibility where I need caching. See the host's message below...               Please verify the number of apache connections to the plugins in the domain:          ---     root@host [~]# sh plugins.sh     70869 jetpack     241234 mailchimp     5099 shadowbox-js     206378 slidedeck-lite-2-for-wordpress     91584 twitter-blackbird-pie     ---          The 'mailchimp' is a recently installed plugin which has already created a high number of apache conenctions.          ---     # stat mailchimp     File: `mailchimp'     Size: 4096 Blocks: 8 IO Block: 4096 directory     Device: bbh/187d    Inode: 11994057 Links: 5     Access: 2012-04-23 00:09:45.533873264 -0400     Modify: 2012-04-23 00:09:52.778590301 -0400     Change: 2012-04-23 00:09:52.778590301 -0400     ---      Full plugin list (most of which are pretty essential to site functionality):               Akismet      All in One SEO Pack      Ambrosite Next/Previous Post Link Plus     Meta Box (custom - uses Alchemy)      Blackbird Pie      CloudFlare      Get The Image      Google XML Sitemaps      Jetpack by WordPress.com      Links in Captions     Load Scripts (custom - for enqueuing Javascript & CSS files)      Login LockDown      Mailchimp      Shadowbox JS      SlideDeck      VaultPress      WP Super Cache     WP to Twitter


title: How to get a feed for post type 'page'?

text: I'm trying to get a feed for pages and a separate feed for posts. The feed for posts works perfect as it is. I just want a separate one but i have tried all the plugins and searched for about a week straight and still could not find a solution Is it possible to take feed-rss2.php and duplicate it to change the code to include pages instead of posts and call it by `?feed=my_custom_feed`? EDIT BELOW: http://jsfiddle.net/oscarj24/qWdqc/ This is the script that I am using get the `<link>` tag from the item RSS. I want the pages to have an RSS feed unless anyone knows a different way of doing it without RSS. But the script above rotates the page every 30 seconds.


title: What is the way to add additional fields to attachments in 3.5+?

text: I used to use attachment_fields_to_edit filter, but it seems that in 3.5+ it has been dropped. What is the new way of adding additional attachment fields? **UPDATE:** It seems that it wasn't dropped, but - deprecated. In 3.6 it operates in compatibility mode. To make a new field appear in media popup, one should set additional param - `show_in_modal` to _true_ (helpful post here):               $form_fields['thumb-url'] = array(         'label' => __('Thumbnail Url'),         'input' => 'html',         'html'  => <p> ... some html here ... </p>,         'show_in_modal' => true // <- this one     );      But - still, the whole thing is deprecated and doomed to be dropped sooner or later. There should be a new way of doing things. Anyone knows what that'd be?


title: How to split the a table in  database?

text: Is there any option to `split` the `tables` in more `tables` in different `databases`? The problem is that my the `wp_posts` table is to big and it takes a lot of time to show in the Dashboards... (more than 20 seconds). I tried the `HyperDB` but this plugin just can split the database to different `databases` but the `tables` remain the same... Example: `wp_posts` from `database1` and `wp_postmeta` from `database2`, but I need to read and to write other ways... Something like below               database1 --> wp_posts [from row 0--10000]          database2 --> wp_posts [from row 10001 to 20000]      etc... I think that `searching` a single `post` between a lot of `databases` is not a big problem... there will be a great effect when `searching` through a hundred thousand of `posts` a specific query... As my project idea is to make `WordPress` to handle a lot of `products` `(posts)`, so analyzing a single table `(wp_posts)` takes a lot of time, but splitting this `table` to more `tables` in different `databases` (a databases will have it's own server) will show a very impressive result. Is this possible or not?


title: parse XML from URL (via SOAP)

text:
I am attempting to build out a dashboard widget that will perform a validation check on a site RSS feed using the W3 Validator. Their API docs (http://feed2.w3.org/docs/soap.html) provide the method. Here is my function to get the data:                   $feed       = 'http://domain.com/feed/';         $request    = new WP_Http;         $url        = 'http://validator.w3.org/feed/check.cgi?url='.urlencode($feed).'&output=soap12';         $response   = wp_remote_get ( $url );                   if( is_wp_error( $response ) ) {             echo '
Sorry, there was an error with your request.
';         } else {             $feed_data  = $response['body'];         }      Here is the return: http://pastie.org/4397488 For the life of me, I cannot seem to parse out that XML properly. Is there a 3rd party library I should be using, or is there a native WP function that will handle this?


title: Editing footer for one page, keeping it the same for others

text:
What I want to do is edit my footer for the front page of the site by making it bigger, but I want to keep it smaller for all the other pages. My footer.php looks like this:               !-- BEGIN FOOTER TOP -->

                     <?php wp_nav_menu( array( 'container' => false, 'theme_location' => 'footer-menu' ) ); ?>

                     Back to top

                      <?php   /* Widgetised Area */   if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Footer 1') ) ?>                      <?php   /* Widgetised Area */   if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Footer 2') ) ?>                      <?php   /* Widgetised Area */   if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Footer 3') ) ?>                      <?php   /* Widgetised Area */   if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Footer 4') ) ?>

                      <?php echo get_option('lp_footer-text-left'); ?>                 <?php echo get_option('lp_footer-text-right'); ?>

                       <?php wp_footer(); ?>              <?php $google_analytics = get_option('lp_google_analytics'); if ($google_analytics) { echo stripslashes($google_analytics); } ?>                               Every page calls the footer using so how would I make it look one way in the front page, and another in all the other pages? Site is http://www.botkai.com


title: What function can I use consistently to escape possible HTML for editing and display?

text: I'm very new to WP, and from following books and online examples, I have several different 'esacping' functions in my first plugin. I would like to know if there is one function, or a minimal set of functions, I can use to prevent malicious HTML stored in my DB from doing anything bad. I would, however, always like to store text exactly as it is captured, and only sanitize it when presenting it.


title: custom css and javascript not working on page defined as template?

text: I have written a web-page which is a web-app (a simple card database using php, mysql, and styled with css3). The page works as expected. A friend of mine proposed me to use wordpress for everything else to save time on coding - welcome page, etc, so I decided to try it out. I need to lock the page to users with password only, so I had to add the page via a template. I just added the needed php comment and expected everything to work fine when I was surprised to see that neither the css not the script were read. I use some javascript to define height and width of some column, link to images and so on. All I got is some unstyled divs :(:( here is the head of the page               <?php     /*     Template Name: Tarot     */     ?>               <html>     <head>              <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />         <title></title>              <!-- CSS  -->         <link rel="stylesheet" href="tarot/css/master.css">              <!-- Jquery main DB -->         <script type="text/javascript" src="tarot/js/jquery-1.8.0.min.js"></script>         <script type="text/javascript" src="tarot/js/jquery-ui-1.8.24.custom.min.js"></script>         <script type="text/javascript" src="tarot/js/jquery.flip.js"></script>              <!-- Main custom javascript file -->         <script src="tarot/js-system/db.js" type="text/javascript" charset="utf-8"></script>     </head>      I use jquery as a plugin, too...When I access the php drectly the page is working OK. Am I missing something? I dont need to define the page as a template, as long as I find a way to make the page accessible to registered users of the site only


title: Displaying image from a repeatable group

text:
I am having trouble displaying my image in a repeatable group. I am able to display all fields except the image. **Here is the code to display a repeatable group**                $meta_boxes['project_metaboxpress'] = array(           'id'         => 'project_metaboxpress',           'title'      => __( 'Press Information', 'cmb' ),           'pages'      => array( 'press', ), // Post type           'context'    => 'normal',           'priority'   => 'high',           'show_names' => true, // Show field names on the left           // 'articles_styles' => true, // Enqueue the articles stylesheet on the frontend      'fields'     => array(             array(                'id'          => $prefix . 'articles',                'type'        => 'group',                'description' => __( 'Articles Printed', 'cmb' ),                'options'     => array(                'group_title'   => __( 'Article {#}', 'cmb' ),                'add_button'    => __( 'Add Another Article', 'cmb' ),                'remove_button' => __( 'Remove Article', 'cmb' ),                'sortable'      => true, // beta           ),           'fields'  => array(                 array(                     'name' => 'Title',                     'id'   => 'title',                     'type' => 'text',                     'description' => '',                  ),                  array(                     'name' => 'Date Published',                     'desc' => '',                     'id'   => $prefix . 'date',                     'type' => 'text_date'                  ),                  array(                     'name'    => 'Print Type',                     'desc'    => 'Select an option',                     'id'      => $prefix . 'printType',                     'type'    => 'select',                     'options' => array(                          'Select'   => __( 'Select Print Type', 'cmb' ),                          'Print'       => __( 'Print', 'cmb' ),                          'Online'   => __( 'Online', 'cmb' ),                 ),                 'default' => 'custom',             ),             array(                 'name'  => 'Upload Article',                 'desc'  => 'Upload an image or enter an URL.',                 'id'    => $prefix . 'image',                 'type'  => 'file',                 'allow' => array( 'url', 'attachment' ) // limit to just attachments with array( 'attachment' )                 ),             ),             ),         ),     );      **Displaying on the front-end**
       <?php global $post; $entries = get_post_meta( get_the_ID(), '_cmb_articles', true ); foreach ( $entries as $key => $entry ) {?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

Article Title
                     <?php echo $entries [$key]['title'];?>

Date Published
                     <?php echo $entries [$key]['_cmb_date'];?>

Print Type
                     <?php echo $entries [$key]['_cmb_printType'];?>

<?php echo $img [$key]['_cmb_image'];?>

<?php edit_post_link('','',' '); ?>

                 <?php } //endforeach ?>
      echo $img [$key]['_cmb_image']; is what I am using to try and display my image but I can not get it to work. Any help would be great


title: Getting recent posts from all blogs on mother blog - multisite

text: I want to get the recent comments on all posts in a multisite network, and I want to display these ceomments in a sidebar on the multisites "mother" blog. To complicate: All blogs are forced to post in either category A or category B. I want two outputs on the mother blog, showing comments on posts in category A and a second output for comments posted in category B. Question: Is this possible?


title: Use wp_enqueue_style based on user option in widget

text: I currently developing wordpress widget for my website. This widget will pull user latest post in my website and show in their blog. In the widget there is option for user to use their css or my css for the widget I use this code in my widget and its work perfectly but this code will always load the css.               add_action( 'widgets_init', 'load_my_widgets' );          function load_my_widgets() {         register_widget( 'My_Widget' );         wp_register_style( 'my_widget_css', 'http://mydomain.com/css/my-widget.css' );         wp_enqueue_style( 'my_widget_css' );     }      The problem is how can I enable the CSS based on the user option? I try something like this but its not working               function widget( $args, $instance ) {         $own_css = isset( $instance['own_css'] ) ? true : false;              if ( ! $own_css ) {             wp_enqueue_style( 'my_widget_css' );         }     }