Monthly Archives: March 2011

Make Artisteer Header Area Clickable In WordPress

NOTE:  This only works for 3.0 Beta versions.  With 3.0 RC1, Artisteer changed the structure and names of classes.  A similar technique will work, but with different class names.

You really don’t need to modify any code to make an Artisteer 3.0 header area clickable.  You can do it all with CSS (at least in the designs I have tested).

I would suggest making a Child theme first so you don’t even need to change the generated style.css file.

Then, use Firefox with the Firebug addon, or another development tool so you can make on-the-fly changes to the CSS.

First, make sure the heading text generated by Artisteer is visible and clickable. Continue reading

Shortcode Function to List Post Titles

The code below can be added to your functions.php to provide a shortcode which will list post titles.

When you add the code to functions.php, you must be careful, because any errors will make your site unusable.  BACK UP your functions.php before adding this, and make sure that you know how to restore from the backup.

If your functions.php file ends with ‘?>’, just paste the entire code on the line following it.  If it does not end in ‘?>’, remove the ‘<?php’ line and the ‘?>’ line from the code below before pasting it in.

Once the code has been added to functions.php with no errors, create a new Page to display your titles.  Enter any content you want on the page.  Where you want the list of titles to show, enter the shortcode as shown in the comments in the code. Continue reading

List Links to Posts by Category

The code below will list links to posts grouped by the category of the post.  It was developed for WP 2.9’s  default theme.

See the Codex for the Function get_terms() for documentation of the arguments that can be used to alter the terms selected.


<?php
/**
 * @package WordPress
 * @subpackage Default_Theme
 */
/*
Template Name: listpostsbycategory
*/
?>
<?php /*
 Author: Mac McDonald
 Contact at wordpress.mcdspot.com using the Contact Me form.

 This program creates a list of posts by category as links to the posts.

*/?>

<?php get_header(); ?>
<div id="content" role="main">

<?php
$hide_empty = true;
$hierarchical = true;
$args = array(
 'hide_empty' => $hide_empty,
 'hierarchical' => $hierarchical,
);
$catarray = get_terms('category',$args);
//print_r($catarray);
foreach ($catarray as $category) {
   $catid = $category->term_id;
   $link = get_category_link($catid);
   if (!$hide_empty || $hierarchical) {
      echo "<h2><a href='$link' title='Link to Category $category->name' >Posts for Category $category->name</a></h2>";
   }
   //echo '<p>';print_r($category);echo '</p>';
   $myquery = new WP_Query(array('category__in' => array($catid)));
   if ($myquery->have_posts()) :
      if ($hide_empty && !$hierarchical ) echo "<h2><a href='$link' title='Link to Category $category->name' >Posts for Category $category->name</a></h2>";
      while ($myquery->have_posts()) : $myquery->the_post(); ?>
         <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
      <?php endwhile;
   else:
      if (!$hide_empty || $hierarchical) echo '<p> &nbsp;&nbsp;&nbsp;- None Found -</p>';
   endif;
}

?>
</div><!-- End content -->
<?php get_footer(); ?>