WordPress.org

Forums

[resolved] Recent Posts on Static Home Page (4 posts)

  1. craigpriestley
    Member
    Posted 5 years ago #

    Please help me.

    I'm really struggling with this. I've tried with the results I've found but I'm new to wordpress and think my template may be stopping it working?

    http://www.themusicmag.com/

    I've set 'music mag' as my static home page and my posts go to 'blog'

    I'd like to have either:

    - My latest posts appearing automatically under a Recent Posts header or something.

    - My Latest post appearing on my home page - if possible just a preview

    If you could help me I'd be very thankful.

  2. craigpriestley
    Member
    Posted 5 years ago #

    This is my index file if it helps:

    <?php get_header(); ?>

    <div id="content">

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

    <?php while (have_posts()) : the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">

    <h2>" rel="bookmark" title="<?php _e('Read',TEMPLATE_DOMAIN); ?> <?php the_title(); ?>"><?php the_title(); ?></h2>

    <?php if ($freshy_options['author']) : ?><small class="author"><?php the_author(); ?></small><?php endif; ?>
    <?php if ($freshy_options['date']) : ?>
    <small class="date"><?php if ($freshy_options['author']) : ?>|<?php endif; ?> <?php the_time(get_option('date_format')) ?></small>
    <?php endif; ?>
    <?php if ($freshy_options['time']) : ?>
    <small class="date"><?php if ($freshy_options['date']) : ?>|<?php endif; ?> <?php the_time() ?></small>
    <?php endif; ?>

    <div class="entry">
    <?php the_content('<span class="readmore">'.__('Read the rest of this entry »',TEMPLATE_DOMAIN).'</span>'); ?>
    </div>

    <div class="meta">
    <dl>

    <dt><?php _e('Comments',TEMPLATE_DOMAIN); ?></dt><dd><?php comments_popup_link(__('No Comments »',TEMPLATE_DOMAIN), __('1 Comment »',TEMPLATE_DOMAIN), __('% Comments »',TEMPLATE_DOMAIN)); ?></dd>
    <dt><?php _e('Categories',TEMPLATE_DOMAIN); ?></dt><dd><?php the_category(', ') ?></dd>
    <?php if(function_exists('the_tags')) : ?>
    <?php the_tags('<dt>Tags</dt><dd>', ', ', '</dd>'); ?>
    <?php endif; ?>
    <?php if(function_exists('the_bunny_tags')) : ?>
    <?php the_bunny_tags('<dt>Tags</dt><dd>', '</dd>', ', '); ?>
    <?php endif; ?>
    <?php if(function_exists('the_bookmark_links')) : ?>
    <dt><?php _e('Spread the word',TEMPLATE_DOMAIN); ?></dt><dd><?php the_bookmark_links(); ?></dd>
    <?php endif; ?>
    <?php if ('open' == $post-> comment_status) : ?>
    <dt><img alt="<?php _e('Comments rss',TEMPLATE_DOMAIN); ?>" src="<?php echo get_bloginfo('stylesheet_directory') ?>/images/icons/feed-icon-16x16.gif" /> <?php comments_rss_link(__('Comments rss',TEMPLATE_DOMAIN)); ?></dt>
    <?php endif; ?>
    <?php if ('open' == $post->ping_status) : ?>
    <dt><img alt="<?php _e('Trackback',TEMPLATE_DOMAIN); ?>" src="<?php echo get_bloginfo('stylesheet_directory') ?>/images/icons/trackback-icon-16x16.gif" /> " rel="trackback" title="<?php _e('Trackback',TEMPLATE_DOMAIN); ?>"><?php _e('Trackback',TEMPLATE_DOMAIN); ?></dt>
    <?php endif; ?>
    <?php if ($user_ID) : ?>
    <dt><img alt="<?php _e('Edit',TEMPLATE_DOMAIN); ?>" src="<?php echo get_bloginfo('stylesheet_directory') ?>/images/icons/edit-icon-16x16.gif" /> <?php edit_post_link(__('Edit',TEMPLATE_DOMAIN),'',''); ?></dt>
    <?php endif; ?>
    </dl>
    </div>

    </div>

    <?php endwhile; ?>

    <p class="navigation">
    <span class="alignleft"><?php next_posts_link(__('« Previous Entries',TEMPLATE_DOMAIN)) ?></span>
    <span class="alignright"><?php previous_posts_link(__('Next Entries »',TEMPLATE_DOMAIN)) ?></span>
    </p>

    <?php else : // nothing found ?>
    <div class="post" id="post-none">
    <h2><?php _e('Not found',TEMPLATE_DOMAIN); ?></h2>
    <p><?php _e("Sorry, but you are looking for something that is not here",TEMPLATE_DOMAIN); ?></p>
    </div>
    <?php endif; ?>

    </div>

    <?php // sidebars ?>
    <?php if ($freshy_options['sidebar_right'] == true) get_sidebar(); ?>
    <?php if ($freshy_options['sidebar_left'] == true) include (TEMPLATEPATH . '/sidebar_left.php'); ?>

    </div>

    <?php get_footer(); ?>

  3. craigpriestley
    Member
    Posted 5 years ago #

    I have tried editing the index.php but nothing changes, so i think it's in the header:

    <?php
    define ('TEMPLATE_DOMAIN','freshy2');
    load_theme_textdomain(TEMPLATE_DOMAIN);
    global $freshy_options;
    $freshy_options = get_option('freshy_options');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" title="Freshy"/>
    <!--[if lte IE 6]>
    <link rel="stylesheet" href="<?php print get_bloginfo('stylesheet_directory').'/fix-ie.php'; ?>" type="text/css" media="screen"/>
    <![endif]-->
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php wp_get_archives('type=monthly&format=link'); ?>
    <?php wp_head(); ?>
    <meta name="verify-v1" content="wkZ1x+iWBMwBm2+YaEJIzI8unHEVqOHsioosrFRYvB4=" />
    <meta name="msvalidate.01" content="44F3CD83E084F8D674E79DD3814787C7" />
    </head>
    <body>
    <div id="body">

    <div id="header">
    <div class="container">
    <div id="title">
    <h1>
    ">
    <span><?php bloginfo('name'); ?></span>

    </h1>
    <div class="description">
    <small><?php bloginfo('description'); ?></small>
    </div>
    <div id="quicklinks">

    <?php if($freshy_options['header_search']) : include (TEMPLATEPATH . '/searchform.php'); endif; ?>
    </div>
    </div>
    <div id="header_image">

    <div id="menu">
    <div class="menu_container">

    </div><span class="menu_end"></span>
    </div>

    </div>
    </div>
    </div>

    <div id="page" <?php echo freshy_layout_class() ?>>
    <div class="container">
    <div id="frame">

  4. craigpriestley
    Member
    Posted 5 years ago #

    I don't know why but.

    Editing the index.php was editing the page i POSTED to. Not the page i set as home.

    So i removed the static page, just had my post page as my home page and then edited the index.php file.

    And Viola! It works.

Topic Closed

This topic has been closed to new replies.

About this Topic