• Resolved brlbeagle

    (@brlbeagle)


    Hey everyone – special thanks to those who have helped me get my site up and running and I think looking pretty good.
    I do have a question for ya –
    I’m using the soho serenity theme and on my front page there are 2 sections I would like to add text to (spotlight and upcoming events).j
    Both sections are part of the main php but I think they must also be either part of a category script or maybe blog script – I just figure out which.
    Can someone peek at my source file at let me know?
    https://www.beaglerescueleague.org

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi

    Its not possible to tell from looking at View Source on your homepage where the content for those two columns is supposed to come from. You would have to look at the PHP in the template source code. More than likely there are supposed to be posts assigned to two categories with specific category names.

    Thread Starter brlbeagle

    (@brlbeagle)

    Maybe this will help???

    <div class=”left-column”>
    <div class=”title”><h3>Spotlight</h3></div>
    <?php query_posts(‘cat=1&showposts=3’); ?>
    <?php $posts = get_posts(‘category=1&numberposts=3&offset=0’);
    foreach ($posts as $post) : start_wp(); ?>
    <div class=”entry”>
    <?php if(function_exists(‘get_the_image’)) { get_the_image(array(‘custom_key’ => array(‘Thumbnail’,’thumbnail’,’Medium’,’medium’,’Preview’,’preview’), ‘default_size’ => ‘preview’)); } ?>
    </div>
    <?php endforeach; ?>
    </div> <!– end left column –>

    hi

    yes, that is the code for the Spotlight column. It is including an image from each of the first 3 posts in category one, typically the Uncategorized category. I don’t see that it is displaying a post title. It is only displaying a post image, if there is one, from the 1st 3 posts.

    It also seems like incorrect code to me as it sets up a query posts to work with a secondary loop but then calls get_posts which is a whole other way to retrieve posts.

    If you want to display the title, change this part of the code

    <div class="entry">
    <?php if(function_exists('get_the_image')) { get_the_image(array('custom_key' => array('Thumbnail','thumbnail','Medium','medium','Preview','preview'), 'default_size' => 'preview')); } ?>
    </div>

    to this

    <div class="entry">
    <h3><?php the_title(); ?></h3>
    <?php if(function_exists('get_the_image')) { get_the_image(array('custom_key' => array('Thumbnail','thumbnail','Medium','medium','Preview','preview'), 'default_size' => 'preview')); } ?>
    </div>

    You will probably find a similar code block for the other column. The category number in the other block us probably different. You may need to create a new category, or else change the category number in the theme to the category ID # of the category whose posts you want to display in the column.

    Thread Starter brlbeagle

    (@brlbeagle)

    Ok – thats totally over my head ??
    I’ll have to figure out something else because I don’t have any categories set up at all right now.

    The whole point of that code (and most similar code) is to spotlight a specific category of posts in a block on the home page. You must have a way to tell WordPress what posts you want to display in a certain block, and assigning posts to a category is a common way to do that. It takes about 1 minute to create a new category so that part is not a big deal.

    Thread Starter brlbeagle

    (@brlbeagle)

    OK I got that – I think my issue is that I don’t really plan on using blog posts as part of this theme. I’d actually prefer to put a column of text beneath each of the Spotlight and Coming events headers.
    I might be able to do that by simply adding a table but I’m not sure. I may be misunderstanding the use of the term post but again, I’m not looking for bells & whistles – I’m looking for pretty vanilla stuff ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘help adding text to main php’ is closed to new replies.