• Resolved stooryduster

    (@stooryduster)


    Hi

    I’m well up a steep learning curve mostly on my own so far but getting beyond myself now.

    The theme I’m using (Comicpress) – when I select from a category list it shows only the image and title from each of the posts in that category. I’d like it to show the text from the post as well.

    I’ve installed the plugin ‘Search Unleashed’ https://urbangiraffe.com/plugins/search-unleashed/ which suited my purposes for users to do a general word search. But what it also does is it forces the theme to show the text on the results page as well as the image and title. Which is what I would like to happen for the categories. Unfortunately I don’t know how it does it or where to begin.

    Selecting from categories is just another search isn’t it? Just a search by category rather than by words and uses the same results page?

    Anyone know how I can make the theme display also the blog text along with the image? Please.

Viewing 1 replies (of 1 total)
  • Thread Starter stooryduster

    (@stooryduster)

    Hi Stooryduster after much research and experimentation I figured out this is what you need to do.

    Plus help from Frumph on the Comicpress forum.

    It is certain that the Comicpress theme is missing the wp tag ‘php the_content()’ in the page that displays your blogs under chosen categories. That tag tells wp to display what is written in your blog (The tag has a back bracket question mark one end and a question mark forward bracket the other.).

    The correct file to edit – in Comicpress – I happen to know is ‘archive.php’. Open it in a text editor that won’t add any formatting to your text such as Dreamweaver or Bbedit.

    Do a search for the word ‘category’ and look for this part which is the area where you want to add the ‘the_content()’ tag.

    <?php while (have_posts()) : the_post() ?>
    
             <?php global $archive_comic_width; if (in_comic_category()) { ?>
    
                <div class="post-comic-head"></div>
                <div class="post-comic">
                   <div class="post-info">
                      <?php if ($enable_comic_post_author_gravatar == 'yes') { ?>
                         <div class="post-author-gravatar"><?php echo str_replace("alt='", "alt='".get_the_author_meta('display_name')."' title='".get_the_author_meta('display_name'),get_avatar(get_the_author_meta('email'), 64)); ?></div>
                      <?php } ?>
                      <?php if (function_exists('comicpress_show_mood_in_post')) comicpress_show_mood_in_post(); ?>
                      <?php if ($enable_comic_post_calendar == 'yes') { ?>
                         <div class="post-date">
                            <div class="date"><span><?php the_time('M') ?></span> <?php the_time('d') ?></div>
                         </div>
                      <?php } ?>
                      <div class="post-text">
                         <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><small> By <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y'); ?> <?php edit_post_link('Edit Post', ' [ ', ' ] '); ?></small><br />
                         <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
                      </div>
                      <div class="clear"></div>
                   </div>
                   <div class="comicarchiveframe" style="width:<?php echo $archive_comic_width; ?>px;">
                      <a href="<?php the_permalink() ?>"><img src="<?php the_comic_archive() ?>" alt="<?php the_title() ?>" title="Click for full size." width="<?php echo $archive_comic_width ?>" /></a><br />
                   </div>
                   <br class="clear-margins" />
                </div>
                <div class="post-comic-foot"></div>
    
             <?php } else { ?>

    If you want to experiment to see what appears where in the final web page try adding an easy to find and replace word such as Hellooooo in the page you are editing.

    Be sure to keep it between opening and closing html tags and never inside the php tags.

    Divs are the grouping boxes on the page. They form the page layout with position controlled by the css. A helpful site for beginners in html and css is https://www.w3schools.com

    Since you have a server running locally you can save the php page and then open it in a browser through your web site to test the results.

    You can undo the change in the php, then make another change, save again, refresh the page again in the browser and so on repeatedly to experiment.

    If you get a blank empty page you know you’ve done something wrong.

    To save you the trouble this is where you add the php ‘the_content()’ tag, see below. I added and enclosed it in html paragraph tags. It’s after the closing h2 tag. Notice the opening and closing post-text div containing it all.

    <div class="post-text">
                         <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><p><?php the_content() ?></p>
                         <small> By <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y'); ?> <?php edit_post_link('Edit Post', ' [ ', ' ] '); ?></small><br />
                         <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
                      </div>

    A tip I got from Lorrelle the genial headmistress of WordPress is here https://lorelle.wordpress.com/2006/07/19/display-post-excerpts-only-in-wordpress/ which was the article that led me to this solution. It is about using ‘the_excerpt()’ tag rather than ‘the_content()’ tag.

    This tag forces an excerpt from the post rather than displaying the whole thing. If you have long posts it’s better to keep it all just on its original blog page – usually.

    I know this helped.

    Cheers

Viewing 1 replies (of 1 total)
  • The topic ‘Force theme to display text from a search – only displays image and title’ is closed to new replies.