Forums

[resolved] I need help with post category. (4 posts)

  1. taghaboy
    Member
    Posted 1 year ago #

    Hello,
    I hop some one understand my Idea :)
    in my frontpage i used 2 category to show "News" and "other" post content, so i set 2 templates (news.php and other.php) who i'd like to include one of theme when the single.php load.
    so how can i let the single.php to know that the link i click it's from the "news" or "others" category, like in this exemple who work only with the "Category"

    <?php if (is_category('news')) { ?>
    include News template
      <?php } else { ?>
    include other template
      <?php } ?>

    Big thanks for your HELP

  2. taghaboy
    Member
    Posted 1 year ago #

    Resolved
    her a PARADISE of solutions :
    http://wordpress.org/support/topic/178151?replies=12
    :)

  3. taghaboy
    Member
    Posted 1 year ago #

    Ok this is the code i use, i change some lines:

    <?php
    $post = $wp_query->post;
    if (in_category('news')) {
    	include ('news.php');
    	return;
    } else { ?>
    	<?php include ('other.php');?>
    <?php } ?>

    Thanks ALLAH.

  4. taghaboy
    Member
    Posted 1 year ago #

    Ops i clean it :

    <?php
    $post = $wp_query->post;
    if (in_category('avis')) {
    	include ('single_news.php');
    	return;
    } else {
    	include ('single_table.php');
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic