Forums

No visual output, just code output (1 post)

  1. Mathieu Scholtes
    Member
    Posted 1 year ago #

    Hi, WordPress Friends

    I have this code below, it shows a output from the category slug, on the website. I want it to give it's output only in the code.

    // In that way I can use the slug as a direction for a php include based on the category.

    How do I fix this? (I assume I need to change echo?)

    <?php
    if (is_category( )) {
    $cat = get_query_var('cat');
    $yourcat = get_category ($cat);
    echo $yourcat->slug;
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by Mathieu Scholtes
  • This topic is not resolved
  • WordPress version: 3.0.1

Tags

No tags yet.