Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jlindblom

    (@jlindblom)

    Thanks esmi! I will do! But first I wonder one more thing. If I want different output for the different categories, how to do then?

    I mean, if i want to show tags, content and title for the category blog, and only title and content for the category tweets, and for the category photos just thumbnail and title. How to do then? I know the codes for tags etc, but not how to make the if, else etc.

    Thanks again for your kind helping!

    Thread Starter jlindblom

    (@jlindblom)

    Thanks for your kind help esmi! That worked fine!:) What to do now, as I’m new here, will I change this thread to “solved”? Because if I got more questions about this, how to do then, start a new thread?

    Thread Starter jlindblom

    (@jlindblom)

    Hello esmi! Thanks for your reply! I uploaded the whole code here: https://pastebin.com/RFnmdTM9.

    I changed it a little bit now, and now I’m getting the information (as title and text) even if there is no thumbnail/featured image attached to the post. See here, blog.jimmylindblom.se. Sorry now, but I want one more solution. And I hope you can help me. You seem to be to WordPress, what “Foppa” was to the icehockey!:)

    As you can see at blog.jimmylindblom.se, there is a title and text even for the posts which include a thumbnail, like on post TEST 8 (the text which has a line through the text). I only want to show content text when there is no thumbnail. I’m going to make in this way. I will have some different categories, like photos, tweets, portfolio and blog. And for every category, I want different styles of showing posts. Like for category photos I only want the thumbnail to show and title, for blog I want to show title and content, etc.

    Is there a difficult solution behind this? I now how to style each post different by using CSS, but PHP isn’t my best side, sorry. And I need the PHP to make to show and hide title etc, I guess. Hope I’ve got all the information within this post to explain my problem for you. And I want you to know I’m really glad for your help, and thankful! Have a nice day/night!

    Thread Starter jlindblom

    (@jlindblom)

    Thanks for your fast reply Esmi! I used your code, and as many other times I got this error:

    Parse error: syntax error, unexpected T_ENDWHILE on line 80

    What am I doing wrong? Really thankful for your helping esmi! Thanks again!

    See the code I used;

    <?php
    $postPosts = new WP_Query();
    $postPosts->query('');
    ?>
    
    <?php
    while ($postPosts->have_posts()) : $postPosts->the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="thumbnail">
    <?php
    if ( has_post_thumbnail() ) : the_post_thumbnail();
    else: ?><h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    }
    ?>
    </div>
    </div>
    <?php endwhile; ?>
    
    <?php endif;?>
Viewing 4 replies - 1 through 4 (of 4 total)