wp_guy
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Several archive pages, how?Instead of creating a separate file, you can use the is_category() conditional tag. Like this for example:
<?php if(is_category("rock")): ?> <h2>Greatest rock bands</h2> <?php endif; ?>
Hope that helps…
Forum: Fixing WordPress
In reply to: Archive only since a given dateHi,
You can do that by adding the following code to the functions.php file of your theme:
function getarchives_since($string){ return $string . " AND post_date > '2008-01-01 00:00:00'"; } add_filter('getarchives_where', 'getarchives_since');
However, that will make your Archives page also show the archives since January 2008.
Forum: Themes and Templates
In reply to: How to call a pageTurns out it’s much easier than that… the comments_template(); function accepts one parameter, the file that you want to load. So this should work:
<?php comments_template("/comments2.php"); ?>
Forum: Fixing WordPress
In reply to: I need to get the category slug from the category IDOk… different approach:
<?php function replace_id_for_slug($option){ $categories = get_categories("hide_empty=0"); preg_match('/value="(\d*)"/', $option[0], $matches); $id = $matches[1]; $slug = ""; foreach($categories as $category){ if($category->cat_ID == $id){ $slug = $category->slug; } } return preg_replace("/value=\"(\d*)\"/", "value=\"$slug\"", $option[0]); } $select = wp_dropdown_categories("hierarchical=1&hide_empty=0&echo=0"); $select = preg_replace_callback("#<option[^>]*>[^<]*</option>#", "replace_id_for_slug", $select); echo $select; ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value != -1 ) { location.href = "<?php echo get_option('home');?>/category/"+dropdown.options[dropdown.selectedIndex].value+"/"; } } dropdown.onchange = onCatChange; --></script>
Forum: Themes and Templates
In reply to: how can i reduce the font of my header site name?You can do that by editing the style.css file of your theme.
This is the part that tells the browser what size the header title has to be:
#header h1 { font-size: 3.0em;
3.0em means that it’s three times the default font size, which in your case is 10. That means a font size of 30 pixels.
You can change that for 2.0em, 2.5em or whatever you want.
Cheers!
Forum: Themes and Templates
In reply to: Generic Banner specified in CSSAw, sorry… forgot to close the div… Should be something like this:
<div <?php if ( is_page('emotional-wellbeing') ) { ?>class="lookhere emotionalwellbeing"<?php } elseif ( is_page('healthy-eating-exercise') ) { ?>class="lookhere healthyeating_exercise"<?php } elseif ( is_page('general-health') ) { ?>class="lookhere generalhealth"<?php } else { ?>class="lookhere contactus"<?php } ?>></div>
Forum: Themes and Templates
In reply to: Generic Banner specified in CSSHow about this:
<div <?php if ( is_page('emotional-wellbeing') ) { ?>class="lookhere emotionalwellbeing"<?php } elseif ( is_page('healthy-eating-exercise') ) { ?>class="lookhere healthyeating_exercise"<?php } elseif ( is_page('general-health') ) { ?>class="lookhere generalhealth"<?php } else { // Your code here }
Forum: Developing with WordPress
In reply to: PHP 4As far as I know… you shouldn’t experience any problems.
Forum: Themes and Templates
In reply to: Urgent. What files are called with get_sidebar();From what I can see… the problem doesn’t seem to be in the CSS but in the HTML.
In the home page, both columns are inside a #columns div, but doesn’t seem to be the case in the archive.php.
According to the W3C validator, you’ve got some extra </div> or something:
Forum: Themes and Templates
In reply to: How to call a pageIf you’re trying to use comments2.php as a page template, then the file must start with:
<?php /* Template Name: Comments 2 */ ?>
Then you can create a page and choose “Comments 2” from the Page Template dropdown menu.
Or, if you’re just trying to include that file inside another, then all you have to do is:
<?php include('comments2.php'); ?>
Forum: Fixing WordPress
In reply to: I need to get the category slug from the category IDYou’ll have to custom code the drop down menu, like this:
<?php $categories = get_categories(); $select = "<select name='cat' id='cat' class='postform'>\n"; $select.= "<option value='-1'>Select category</option>\n"; foreach($categories as $category){ if($category->count > 0){ $select.= "<option value='".$category->slug."'>".$category->name."</option>"; } } $select.= "</select>"; echo $select; ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value != -1 ) { location.href = "<?php echo get_option('home');?>/category/"+dropdown.options[dropdown.selectedIndex].value+"/"; } } dropdown.onchange = onCatChange; --></script>
Forum: Fixing WordPress
In reply to: Edit wordpress default mail messageSeems to be here:
/wordpress/wp-admin/includes/upgrade.php
around the line 112.
Forum: Fixing WordPress
In reply to: Cant get media to upload?Can you be more specific? Do you get any errors?
Forum: Themes and Templates
In reply to: display cats and archive on blog onlyNotice that adam-s’ code has an exclamation mark (!) in front of the is_page() (which would be like saying isnt_page() if you know what I mean)…
if(!is_page()){ // Your categories and archives }
That would make the categories and archives appear in the home page, in the single post page, etc. Everywhere but the pages (eg. About, Contact, etc.)
Forum: Plugins
In reply to: Question About A Random Post PluginGot it!
<?php $rand_posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'publish' AND post_type='post' ORDER BY RAND() LIMIT 1"); foreach($rand_posts as $post){ setup_postdata($post); the_excerpt("Read More..."); } ?>
Works 100% (you can choose to use the_content() instead of the_excerpt() if you’d like).