0

Please look at it here TAG page morsblog [dot] dk/tag/stranden/

For THIS TAG, I want to write some text in WordPress (it should have possibility to add defined text to any defined tag). It should look something like this: http://farblog.dk/tag/motorsav-bukser/

Is it possible to make a little plugin that make the text be shown, and providing an opportunity to display the Adsense code below?

Thanks!

2 Answers 2

1

You can add a tag description by editing the tag in your WordPress admin (Posts > Post Tags), then use the following code to display the description in your template file:

$tag = $wp_query->get_queried_object();
echo $tag->description;
0

In my previous theme I made some code for this, though not in plugin format.

I not only wanted to add some text but for specific tag pages other theme layout, other sidebar, other header, etc...

For this I made the structure to make directories /inc/tags/ in the theme directory.

Then ... there is quite some code but e.g.my tag.php looked liked this:

<?php
$tagname = get_query_var('tag');
get_header();
$tagdirectory = TEMPLATEPATH . '/inc/tags/' . $tagname . '/';
$includedirectory = TEMPLATEPATH . '/inc/';
include ($includedirectory . "directorytag.php");
     include ($includedirectory . "header_top.php");
      ?>

<div id="maincontent">
   <?php
        if (file_exists($tagdirectory . "header.php")) {
        include ($tagdirectory. "header.php");
        }
        ?>
        <?php
        if (function_exists('postbar')) postbar();
        include ($includedirectory . "loop_tag.php");
        if (function_exists('postbar')) postbar();
    ?>
</div>
<div id="sidebar">
         <?php
            include($includedirectory . "sidebar_tags_top.php");
            if (file_exists($tagdirectory . "sidebar.php")) {
            include ($tagdirectory . "sidebar.php");
            }
            include($includedirectory . "sidebar_tags_bottom.php");
            ?>
</div>
    <?php get_footer(); ?>

The idea behind it was like this:

I think someone who just starts with blogging without a real purpose will blog along... and during the years he will discover that he wrote quite a lot about some things indicated by a greater amount of tags. So these more interesting tags give both some insight in his interests and lead to kind of subsite based on these tags. So very "evolutionary" as opposed to "I have these interest and will start a wp multisite on these topics".

So (technically) : as soon as you add a directory under the /inc/tags/ directory with the name of the tag you can add files like "header_top.php", "sidebar_tags_top.php" etc... and... if a certain tags has really specific functionality you can also include it in the loop to show up on the page. You could even add a total different application in the tag directory as time goes by. Therefore: since many combinations are possible this is not really pluggable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.