WordPress.org

Ready to get started?Download WordPress

Forums

Customizing links of the posts list - is it possible? (4 posts)

  1. maisteriharju
    Member
    Posted 5 years ago #

    Hi,

    I'm planning to use WordPress as event calendar in a way that posts list is actually a list of future events. I'm using plugin which shows the future posts and which makes this whole thing possible.

    Problem is that sometimes there isn't any other info of event than the info which is said in the headline, in other words the name of the event, place + date and time (for example "Disco Mayhem @ Rex Nightclub 2/12/2008 22.00"). So there is not post - just the headline.

    Even if there is no post the posts list presents the headline as link - which in this case leads to an empty page which has only headline and no other info.

    Question: is it possible to make posts list work so that it shows plain text instead of a link in case there isn't anything else in a post than the headline?

    - TH

  2. geofftswin
    Member
    Posted 5 years ago #

    I'm using the following to simply display the contents of the post with no titles etc

    <?php
    global $post;
    $mpyposts = get_posts('numberposts=2&category=6&order=ASC');
    foreach ($mpyposts as $post):
    setup_postdata($post); ?>
    <ul>
    <?php the_content(); ?>
    </ul>
    <?php endforeach; ?>

    obviously this only displays 2 posts from my category in ascending order.

    If you change
    <?php the_content(): ?>
    to
    <?php the_title(); ?>
    you will simply get the title displaying with no link

  3. maisteriharju
    Member
    Posted 5 years ago #

    But if I use that method then there aren't any links in posts list at all - even if some of the titles should have link.

    Here is an imaginative example of the event list (posts list):

    -----------------------------------------
    Ballroom Dance, Club Rio 22.00 10/11/2008
    Horse Riding Competition, Horse Track 17.00 12/11/2008
    Pop Art Exhibition, Grand Museum 12.00 14/11/2008
    Car Show, Bubble Hall 16.00 15/11/2008
    -----------------------------------------

    Usually there is more information for one event than for example "Ballroom Dance, Club Rio 22.00 10/11/2008". If there is more information that information goes to the post and when you click the "Ballroom Dance" -link from the event list (posts list) the post part opens up and you can see that extra information. So it works like WordPress or any other blog does.

    But sometimes there isn't any other information for the event. For example if "Car Show, Bubble Hall 16.00 15/11/2008" is the only information there is of that event, that line is still presented as a link to a post. And it is my problem. I would like to have it so that there is no link, just plain text, if there isn't anything in the post.

    In short: Same events list (posts list) should show links to those posts which have some content in the actual post part and in the same time it should present only text-titles (no links) of those posts which doesn't have any other content than the title.

    I would like to know if it can be done.

  4. maisteriharju
    Member
    Posted 5 years ago #

    I believe I found the solution:
    http://wordpress.org/support/topic/137200?replies=3

    I have to look into it and see if it works as I want.

Topic Closed

This topic has been closed to new replies.

About this Topic