Show Taxonomy message in archive.php file

Hi there,

I use Artisteer for my theme design and i use Custompress to create Taxonomies.

I have created a Taxonomy with the name "sxoliki_xronia".
Here is the embed code:
[tax id="sxoliki_xronia" before="your text before: " separator=", " after=" your text after"].

In my archive.php file, when someone clicks on a specific Category or Tag, a message appears in the visitor which shows him which Category or Tags posts are shown.

What i want to do, is to add a similar message, when the visitor sees posts related to the Taxonomy "sxoliki_xronia".
Can someone help?

Thank you inanticipation.

Below i write the the code of my archive.php file:

<?php

if (have_posts()) {
global $posts;
$post = $posts[0];
theme_ob_start();

if (is_category()) {
echo '<div style="padding:6px;"><h6>' . 'Show posts of category: ' . single_cat_title('', false) . '</h6></div>';
} elseif (is_tag()) {
echo '<div style="padding:6px;"><h6>' . 'Show posts of Tag: ' . single_tag_title('', false) . '</h6></div>';
} elseif ........

  • Dimis13

    <?php
    /**
    *
    * archive.php
    *
    * The archive template. Used when a category, author, or date is queried.
    * Note that this template will be overridden by category.php, author.php, and date.php for their respective query types.
    *
    * More detailed information about template’s hierarchy: http://codex.wordpress.org/Template_Hierarchy
    *
    */
    get_header(); ?>
    <?php get_sidebar('top'); ?>

    <?php

    if (have_posts()) {
    global $posts;
    $post = $posts[0];
    theme_ob_start();

    if (is_category()) {
    echo '<div style="padding:6px;"><h6>' . 'Show Category posts: ' . single_cat_title('', false) . '</h6></div>';
    } elseif (is_tag()) {
    echo '<div style="padding:6px;"><h6>' . 'Show Tag posts: ' . single_tag_title('', false) . '</h6></div>';
    } elseif (is_day()) {
    echo '<h4>' . sprintf(__('Daily Archives: <span>%s</span>', THEME_NS), get_the_date()) . '</h4>';
    } elseif (is_month()) {
    echo '<h4>' . sprintf(__('Monthly Archives: <span>%s</span>', THEME_NS), get_the_date('F Y')) . '</h4>';
    } elseif (is_year()) {
    echo '<h4>' . sprintf(__('Yearly Archives: <span>%s</span>', THEME_NS), get_the_date('Y')) . '</h4>';
    } elseif (is_author()) {
    the_post();
    echo theme_get_avatar(array('id' => get_the_author_meta('user_email')));
    echo '<h4>' . get_the_author() . '</h4>';
    $desc = get_the_author_meta('description');
    if ($desc) {
    echo '<div class="author-description">' . $desc . '</div>';
    }
    rewind_posts();
    } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
    echo '<h4>' . __('Blog Archives', THEME_NS) . '</h4>';
    }
    theme_post_wrapper(array('content' => theme_ob_get_clean(), 'class' => 'breadcrumbs'));

    /* Display navigation to next/previous pages when applicable */
    if (theme_get_option('theme_top_posts_navigation')) {
    theme_page_navigation();
    }

    /* Start the Loop */
    while (have_posts()) {
    the_post();
    get_template_part('content', get_post_format());
    }

    /* Display navigation to next/previous pages when applicable */
    if (theme_get_option('theme_bottom_posts_navigation')) {
    theme_page_navigation();
    }
    } else {
    theme_404_content();
    }
    ?>
    <?php get_sidebar('bottom'); ?>
    <?php get_footer();

  • Dimis13

    Hi @aristath ,

    What works is the addition of the line below:
    if (is_tax('sxoliki_xronia')) {
    echo '<div style="padding:6px;"><h6>' . 'Show posts: ' . single_tag_title('', false) . '</h6></div>';

    }

    Also, it works if, instead of "single_tag_title", to write "single_tax_term".

    The second part of the addition which was: $wp_query->queried_object->name;, does not work and these messages show up:

    Parse error: syntax error, unexpected '.' in C:\wamp\...\archive.php on line 25
    require( 'C:\wamp\...\wp-blog-header.php' )
    require_once( 'C:\wamp\...\wp-includes\template-loader.php' )

    Anyway, your respone has solved my problem!!!
    Thank you very much for your time !!!

    Be well

    PS.
    I would be interested to know why the second part you proposed did not work $wp_query->queried_object->name;, but only if you have time!

    B

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.