Query children and parent title

I’m not entirely sure if I get your problem correctly, because of the “it’s not an option part”, but… You get children pages of page with ID = 2, so it looks like you want to display the title of that page. If so, then this code will solve your problem: <?php $args = array( … Read more

How can I make my custom templates respect permissions?

Message you quoted is being generated by members_content_permissions_protect() function. By default it is used as a filter on the_content() and the_excerpt() functions. Since your custom template doesn’t use these – there is no case for function to run. Try something like this in template: $content=”Content to protect”; echo members_content_permissions_protect( $content ); Another idea: $protected = … Read more

How to control template resolution if both Author and Category filter in place?

You could change the template loaded by hooking onto template_include, checking if is_author and is_category are both set, then switch the template for inclusion to the author template instead. Give this a shot.. add_filter( ‘template_include’, ‘my_template_setter’ ); function my_template_setter( $template ) { if( is_author() && is_category() && is_archive() ) $template = get_author_template(); return $template; } … Read more

modifying a template and adding jQuery to it

Rather than modifying the template, since you’re going to need jQuery anyway, you can do this.. Add to the functions.php add_action( ‘wp_enqueue_scripts’, ‘blogroll_toggles’ ); function blogroll_toggles() { if( is_page_template( ‘bookmarks.php’ ) ) wp_enqueue_script( ‘blogroll-toggle’, get_bloginfo( ‘stylesheet_directory’ ) . ‘/blogroll-toggle.js’, array( ‘jquery’ ) ); } Or create a new folder in the wp-content/plugins/ folder, create a … Read more

Can I apply a WP theme to a specific custom page template?

In fact there is, using template_redirect, which you would put in the functions.php file – Here’s what I use: function uniquename_default_template() { if(get_post_type() == ‘posttype’) : /* You could use is_single() instead of get_post_type() == ” or any type of conditional tag) */ include(TEMPLATEDIR . ‘path/to/theme/file.php’); /* You could use TEMPLATEDIR to get a file … Read more

How to override Category rendering mechanism

if you can use template_redirect hook and a simple function to set the template to use add_action( ‘template_redirect’, ‘category_set_redirect’ ); function category_set_redirect(){ //create the sets of categories $first_set= array(“1″,”2″,”3″,”4″,”5″,”6”); $second_set= array(“7″,”8″,”9″,”10″,”11″,”12”); if (is_category()){ if (in_array(get_query_var(‘cat’),$first_set)){ include(TEMPLATEPATH . “/first_category.php”); // include the corresponding template die(); } if (in_array(get_query_var(‘cat’),$second_set)){ include(TEMPLATEPATH . “/second_category.php”); // include the corresponding template … Read more

What code do you use to generate the text to go into the HTML title tag?

Mine is: function getDocumentTitle($separator = ” &laquo; “){ $title = get_bloginfo(‘name’); $desc = get_bloginfo(‘description’); if(is_front_page() && is_home() && !empty($desc)){ $title .= $separator.$desc; }elseif(is_home() || is_singular()){ $id = $GLOBALS[‘wp_query’]->get_queried_object_id(); if($meta = get_post_meta($id, ‘title’, true)) $title .= $separator.$meta; $title .= (empty($meta) && is_front_page() && !empty($desc)) ? $separator.$desc : $separator.get_post_field(‘post_title’, $id); }elseif(is_archive()){ if(is_category() || is_tag() || is_tax()){ $term … Read more

How to move style from template file to section?

What about putting styles before the function get_header(); <style type=”text/css”>#header { display: none; }</style> <?php get_header();?> <div class=”main-container-of-my-template”></div> <?php get_footer(); ?> However this is not recommended as it loads the styles even before the <html> not within the <head> section of your website, but as per your requirement this could be the only way to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)