Digital Raindrops
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Inheriting Page Parents ThumbnailNot sure where you are using this but try:
UNTESTED:<?php global $post; $parents = get_post_ancestors( $post->ID ); /* Get the ID of the 'top most' Page if not return current page ID */ $id = ($parents) ? $parents[count($parents)-1]: $post->ID; if(has_post_thumbnail( $id )) { the_post_thumbnail( $id, 'thumbnail'); } ?>HTH
David
Forum: Fixing WordPress
In reply to: Modifying the Loop for category templatesHold fire for a bit, I have started so will finish with a tested solution, note the page names!
File Save As page-category.php
File Save As: loop-title.phpDavid
Forum: Themes and Templates
In reply to: [Coraline] [Theme: Coraline] Unable to create a new header styleThe style is being over-ridden because the title is nested inside the class .entry-content so something like (Tested with FireBug Live Edit):
.entry-content .news { color: #322F80; font-family: "Helvetica Neue",Arial,Helvetica,"Nimbus Sans L",sans-serif; font-size: 30px; font-weight: bold; text-rendering: optimizelegibility; }HTH
David
Forum: Fixing WordPress
In reply to: Modifying the Loop for category templatesHi Ben!
Have a look at this as a solution, it uses page.php far better, and it also uses the page and category slugs to find the recepies, so just a single template needed!
This is a page template that give the page title and content, and the list of news stories underneath, so in your case you can title the page, Cup Cakes {cup-cakes} write a few lines about Cup Cakes, with the Cup Cake {cup-cakes} category post lists below.
HTH
David
Forum: Fixing WordPress
In reply to: Modifying the Loop for category templatesHi Ben,
I have just edited the post above and included a pastebin, this gives the previous and next page linksYou would not want 1000 links on a page, so look to add them in a div and style the div for say 50 on a page!
This example use a page.php as a template page then use the page slug to match the category slug.
global $post; $slug = $post->post_name; $args = array( 'posts_per_page' => 30, 'category_name' => $slug, 'paged' => $paged ); query_posts( $args );HTH
David
Forum: Fixing WordPress
In reply to: Modifying the Loop for category templatesHi Ben,
Open loop.php and save this as loop-titles.php, open loop-titles.php and make any changes in the new file!Or copy and save this as loop-titles.php, just post title in the loop
get_template_part({slug},{name}); How this works is {slug} is the template file, in this case loop.php, {name} looks for a hyphon ‘-‘ and variant of the loop, in this case it is {category}, WordPress will look for slug-name.php, if it finds it it will include it, if not it will fall through to slug.php
This looks for a file loop-category.php if it is not present then loads loop.php
get_template_part( 'loop', 'category' );In your template files change it to:
get_template_part( 'loop', 'titles' );HTH
David
Forum: Fixing WordPress
In reply to: Using is_page Conditional Tag for Page Specific CSSCan make it a little shorter!
function is_tree( $pid ) { // $pid = The ID of the page we're looking for pages underneath global $post; // load details about this page if ( is_page($pid) ) return true; // we're at the page or at a sub page $anc = get_post_ancestors( $post->ID ); return ( isset($anc) && in_array( $pid , $anc ) ) ? true : false; //is the $pid in the ancestors array }David
Forum: Themes and Templates
In reply to: need to add a custom filed for category thumbnail !Great,
Mark this topic as resolved please!David π
Forum: Fixing WordPress
In reply to: Using is_page Conditional Tag for Page Specific CSSYou could use the ancestors / parents {slug} for the children, just use the Body_Class(), in header.php look for the <body tag!
UNTESTED:
</head> <?php $class = ''; if( is_page() ) { global $post; $parents = get_post_ancestors( $post->ID ); /* Get the ID of the top most Page */ $id = ($parents) ? $parents[count($parents)-1]: $post->ID; $parent = get_page( $id ); $class = $parent->post_name; } ?> <body <?php body_class( $class ); ?>>If you did not want to use the page slug, you could use a custom field eg: ‘body_class’, on the top level page and set the class in the post meta.
</head> <?php $class = ''; if( is_page() ) { global $post; $parents = get_post_ancestors( $post->ID ); $id = ($parents) ? $parents[count($parents)-1]: $post->ID; $class = get_post_meta( $id, 'body_class', true ); } ?> <body <?php body_class( $class ); ?>>HTH
David
Forum: Themes and Templates
In reply to: twenty xs widthHi Andrew,
That is how I do it in a twenty eleven child theme, it may help others finding this topic πI can go into “appearance” and then under “twentyXS” settings it allows you to customize the css
That is where you would add the first block in your theme.
The second should already be in functions.php, you would edit the value.
You should really use a child theme, as it is based on a default theme it should support child themes.
HTH
David
Forum: Themes and Templates
In reply to: need to add a custom filed for category thumbnail !Inside the loop!
Have a look at the examples from Codex you could return the description, or have images in a themes folder.
Untested:
Get the First Category Description Only, inside the loop!<?php $category = get_the_category(); if ($category[0]->description) : echo '<img src="' . $category[0]->description . '" alt="' . $category->cat_name . '" />'; endif; ?>HTH
David
Something Like:
<?php $args = array( 'cat' => '-3,-4', 'posts_per_page' => 10, 'paged' => $paged ); query_posts( $args ); ?>Not sure if it is:
'cat' => array(-3,-4),Or:
'cat' => '-3,-4',HTH
David
Forum: Fixing WordPress
In reply to: Proving Blog OwnershipUse a plugin for Google!
There is also an option on google to create a validation file, do that and ftp or upload it to your website to prove ownership
HTH
David
Forum: Themes and Templates
In reply to: need to add a custom filed for category thumbnail !Check out the code in the advanced one, that will allow you to add a new field to the category, there are no custom fields for categories.
Here is a very simple solution that should work in the category.php page as the $cat is a WordPress global, paste the image link into the category description and then:
<?php global $cat; ?> <?php if( category_description($cat) ): ?> <img src="<?php echo category_description($cat); ?>" alt="" height="42" width="42" /> <?php endif; ?>Or:
<?php global $cat; ?> <?php if( category_description($cat) ): ?> <img src="<?php echo htmlspecialchars( category_description($cat) ); ?>" alt="" height="42" width="42" /> <?php endif; ?>HTH
David
Use a query_string while still Preserving Existing Query Parameters:
<?php query_posts($query_string . "&posts_per_page=10"); ?>Just Before:
<?php if ( have_posts() ) : ?>HTH
David