Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Ouch. This one hurt. Lost my theme late last night (I think it got rid of the css and js I was minifying). I got those back on and then, in an effort to get around the htaccess thing, rolled back to 0.9.1.3 and now I have a internal server error and a steaming pile of poo of a site. WP Minify.

    Thread Starter bandwagon

    (@bandwagon)

    This solved my problem… placed it in functions.php of my current theme:

    `function get_install_dir() {
    $get_url = get_bloginfo(‘url’);
    $split_values = explode(“/”, $get_url);
    echo $split_values[3];
    }`

    To those interested chirping crickets out there, I wanted this in order to customize a multisite installation where several different blogs read from the same theme while calling different versions of images. I can now do this with:

    <img src="<?php bloginfo('template_directory'); ?>/graphics/<?php get_install_dir(); ?>/logo.jpg" alt="FacultyCommons" />

    I’m a bit surprised the answer to this question is so difficult to find. Or maybe I don’t know where/how to look. I’ve tried the following function, but it’s not working for in my widget (though it does work for me directly when I hard code it into sidebar.php).

    `// Works in single post outside of the Loop
    function function_name() {
    global $wp_query;
    $thePostID = $wp_query->post->ID;
    }`

    Let’s try that again:

    I’ve been wanting this same feature and also couldn’t find it as a plugin. I’m no genius with PHP, but I hacked together the following code with some help from this thread. It works for me and leaves out the current post. I have it at the very top of a sidebar that appears only on single.php. It also accounts for a post belonging to multiple categories by showing the posts related to each on separately.

    <?php
      $postid = $post->ID;
      foreach((get_the_category()) as $category) {
       echo "<h3>Related Posts in ".$category->cat_name." </h3>";
       $postlist = get_posts('category='.$category->cat_name);
       foreach ($postlist as $post) :
       $catpostid = $post->ID;
       if (in_category($category->cat_name) && ($catpostid != $postid)) { ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
       <?php }
       endforeach;
      } ?>

    I’ve been wanting this same feature and also couldn’t find it as a plugin. I’m no genius with PHP, but I hacked together the following code with some help from this thread. It works for me and leaves out the current post. I have it at the very top of a sidebar that appears only on single.php. It also accounts for a post belonging to multiple categories by showing the posts related to each on separately.

Viewing 5 replies - 1 through 5 (of 5 total)