WordPress.org

Ready to get started?Download WordPress

Forums

Page2cat: Category, Pages & Posts Shortcodes
[resolved] Help me! How to use this plugin? (9 posts)

  1. Giulio86
    Member
    Posted 1 year ago #

    I don't understand how to use this plugin. Sorry but i'm new in WordPress.
    Where i enter this code <?php do_shortcode('[showauto]'); ?> ?
    I tried to put this code in category.php but nothing has changed

    http://wordpress.org/extend/plugins/page2cat/

  2. swergroup
    Member
    Plugin Author

    Posted 1 year ago #

  3. Giulio86
    Member
    Posted 1 year ago #

    i read the plugin documentation but i'understand this shortcodes [showauto].
    I have to write [showauto] on the page or only in category.php?
    excuse my ignorance

  4. swergroup
    Member
    Plugin Author

    Posted 1 year ago #

    short story: [showauto] won't work as every other shortcode, so please don't use it unless you have understood what's different and where it works.

    more details:

    [showauto] is something different from the other shortcodes, it should be explained better in the documentation.

    Apart from shortcodes, this plugin offers the ability to link a page to a category, in order to show the page content as header on your theme's category template. This let you replace the usual 'Archive for <category>' with a more ample fixed header.

    To make this work, you must define a page -> category relationship (hence the original plugin name: page2cat): you can do that on the "edit page" screen (look for a side box) or in the "edit category" screen.

    Finally, when you have set up this exclusive relationship you need to edit the category.php template (or whatever it ships with your chosen theme) in order to display your page/header content: here's where [showauto] is needed (and it's the *only* place it should work). If you search in the forum you'll find a lot of questions about this.

    Here you should find some hints about the template modification.

    Hope it helps!

  5. swergroup
    Member
    Plugin Author

    Posted 1 year ago #

    The online documentation now reflects this explaination. Also there's a new micro-tutorial - with screenshots - on template file editing.

  6. Giulio86
    Member
    Posted 1 year ago #

    I followed exactly the example but does not work (I used the same theme). The page seems not connected to the category:

    (category.php)
    ...
    get_header(); ?>

    <section id="primary" class="site-content">
    <div id="content" role="main">

    <?php if ( have_posts() ) : ?>
    <header class="archive-header">
    <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>

    <div class="archive-meta"> <?php echo do_shortcode('[showauto]'); ?></div>

    </header><!-- .archive-header -->
    ...

    where am I wrong?

    thanks for the help

  7. swergroup
    Member
    Plugin Author

    Posted 1 year ago #

    you did not. the shortcode is INSIDE the loop, after have_posts(). you need to use it OUTSIDE, or it won't work.

    This is the modified category.php template file for twentytwelve theme:

    https://gist.github.com/swergroup/5648630

  8. Giulio86
    Member
    Posted 1 year ago #

    I know in effect the shortcode is out of the loop, is in the header. However i have tried to put before have_posts() but don't work.
    I do not know what to do.
    thanks for your patience

  9. swergroup
    Member
    Plugin Author

    Posted 1 year ago #

    Did you set up a category->page relation before?

    If you have set up it, try looking your category archive page using this category.php template file in your theme: it will show the page content as header.

    If this don't work, you need to set up a category->page relation with the meta box in the page editing screen (as in the first image in this tutorial: the select should be set on a page instead of 'none').

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags