Wordpress / Joomla stuffs

Wordpress / Joomla stuffs

Bits I have come accross using Wordpress and Joomla and customising them.

Adding category index to wordpress.

Change sort order of blogroll from name in wordpress

Problem with show_image_in_imgtag.php in virtuemart missing images.

Joomla Metamod positioning problem

Adding category index to wordpress.

I wanted to change wordpress so that when people click on my categorys they get a nice index page with all the possible posts..

There were a few ways you could achieve this, but I plumped for modifiying archive.php, mostly because I like playing.

To do this, you need to edit wp-content/themes/yourthemename/archive.php.

In archive.php you will see a number of lines, find the one that has the following:

<?php if (have_posts()) : ?>

For me in my theme it was under a load of if elseif loops setting up the archive type.

Once you have found that part, insert the following ABOVE that line.

    $temp_category = single_cat_title(”,false);
  //  if (!empty($temp_category)){
    // give index
   // ?>
    <h1><?php single_cat_title(); ?></h1>
    <p><?php echo(category_description(the_category_ID(false))); ?></p>
<?php query_posts(‘posts_per_page=-1&cat=’.$cat); ?>
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

        <a href=”<?php the_permalink() ?>”><?php the_title(); ?></a><br><br><?php echo $the_post; ?></br>
    <?php endwhile; else: ?>
    <p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
   <?php endif; ?>
//   }else{ // give details or single post

 <?php query_posts(‘posts_per_page=3&cat=’.$cat); ?>


The line <?php query_posts(‘posts_per_page=-1&cat=’.$cat); ?> basically says dont limit the number of post headings that is displayed, I have it set to -1 which means all, but if you wanted you could limit this to whatever number you fancy – 10, 20 etc..

The line at the bottom – <?php query_posts(‘posts_per_page=3&cat=’.$cat); ?> says show the first 3 articles below for the category you are in, again you might want to increase or decrease this number.

You will also need to close things up at the end, parentheses and if statements.

Its hard to post this as  each template is different, so drop me a comment if you have trouble.

You will know if you haven’t closed as you will get an unexpected error when you try to view your page.

Change sort order of blogroll from name in wordpress

I dont think im the only one who doesnt neccesarily want my wordpress blogroll list to be sorted by name, i’d sooner be able to choose the order.

For me, I added the bookmarks in the order I wanted so the link_id column in the database was the one I wanted it to be sorted by.

To do this you need to modify the file wp-includes/bookmark-template.php

I’d suggest you make a backup of this file before you edit it, just incase, and dont forget to leave the last extention as php so it can’t be accessed by anyone whilst its there – i.e bookmark-template.bak.php etc..

find the line in that file that says

function wp_list_bookmarks($args = ”) {
$defaults = array(
‘orderby’ => ‘id’, ‘order’ => ‘ASC’,

function wp_list_bookmarks($args = ”) {

$defaults = array(

‘orderby’ => ‘name’, ‘order’ => ‘ASC’,

You want to change name to be id, and that will sort your blogroll by ID rather than Name.

Problem with show_image_in_imgtag.php in virtuemart missing images.

Well this was one that took me ages to fix..

But annoyingly I think I was being told about the problem in many other virtuemart posts, but im not sure.

I “thought” I had tried all the permissions fixes going, but still couldnt get it to work, but anyway here’s what I needed to do..

The problem that was occuring was virtuemart was failing to display the image thumbnails under the category section. The product image and thumbnail were fine, but the one on the category page wasn’t. Looking at the link it was calling the show_image_in_imgtag.php script but for some reason, if I called it manually to debug, it was giving me an internal server error.

Unfortunatly to make things harder because it was running on a cpanel install I didnt have access to all the files I would have liked to.

Anyway, the bottom line – the fix.

in your webroot directory where you have joomla or mambo installed there will be a components directory, I needed to chmod this 755. Once this was done, the images just kicked in.

Hope this saves someone some time!