• Resolved Honkytonky

    (@honkytonky)


    Dear Pods team,

    I have some pods up and running, I display them with a pods template and shortcode…I don′t use Pods categories but assign the Pods CPT to my main wordpress post categories…that′s best solution for me as I have the CPTs and my posts display in the same categories. In my tenplate I display categories and tags like this:

    <p class=”buchcata”><b>Themen:</b> {@category}</p>
    <p class=”buchcata”><b>Schlüsselworte:</b> {@post_tag}</p>

    Unfortunately I don′t achieve to output the categories and tags as links just a plain text. Would you know how to achieve the usual WordPress behavior, I mean displaying the tag/ category as a lik to the archive?

    Any help/ hint/ idea is highly appreciated!

    Have a properous new year everyone! Cheers!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @honkytonky

    You could use an each loop for this:

    [each category]<a href="{@permalink}">{@title}</a>, [each]

    Cheers, Jory

    Thread Starter Honkytonky

    (@honkytonky)

    Hey Jory,

    thx so much, this sounds promising, at the moment it gives me a
    “Please provide either a template or field name” instead of each category by inserting

    [each category]<a href="{@permalink}">{@title}</a>[each]

    into my Pds template.

    It′s a little head-itching as I am already inside my pods template. Am I missing something? Is that because I use the wordpress post categories and tags with my CPT? I have everything enabled in the backend of the CPT though!

    Cheers and thx a lot for your dedication, I read a lot through your material here!

    • This reply was modified 4 years, 2 months ago by Honkytonky.
    • This reply was modified 4 years, 2 months ago by Honkytonky.
    • This reply was modified 4 years, 2 months ago by Honkytonky.
    Plugin Author Jory Hogeveen

    (@keraweb)

    No this is meant to be used within a Pods template.
    More info: https://docs.pods.io/displaying-pods/template-tags/each-loop-tag/

    Cheers, Jory

    Thread Starter Honkytonky

    (@honkytonky)

    Yes, actually I have it just inside a pods template…
    it also seems to count the actual categories…but it actually does not really display them, just the error to “please provide…” for each category/ tag assigned to the CPT.

    The code in my pod template is the following right now, I know the page for each-loop…actually I played around with the code a lot…it seems to count the elements for categories or tags…but somehow can′t read the values from the data base…?!

    Cheers!

    <header class="entry-header">
    <h4 class="entry-title h1"><a href="https://liberateipsum.cl/lesetipps/{@post_name}">{@post_title}</a></h4>
    <h5 class="autorh">{@autor}</h5>
    <p class="buchcata"><b>Themen:</b> [each category]<a href="{@permalink}">{@title}</a>[each] </p>
    <p class="buchcata"><b>Schlüsselworte:</b> {@post_tag}</p>
    </header>
    <div class="entry-content">
    <a href="localhost/lesetipps/{@post_name}">{@post_thumbnail.medium}</a>
    	<span class="kurzurteil">Kurz und knapp: {@kurzurteil}</span>
    </div>
    
    <!-- wp:separator -->
    <hr class="wp-block-separator"/>
    <!-- /wp:separator -->
    <!-- wp:spacer {"height":25} -->
    <div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>
    <!-- /wp:spacer -->
    • This reply was modified 4 years, 2 months ago by Honkytonky.
    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @honkytonky

    If you are already inside a Pods template I can only imagine this notice is coming from something else. This error only occurs when using the [pods] shortcode..
    Does it only appear when you add the each tag?

    Other things I notice in your code:

    {@autor} should probably be {@author}
    localhost/lesetipps/{@post_name} should probably be replaces with {@permalink}

    Cheers, Jory

    Thread Starter Honkytonky

    (@honkytonky)

    Jory,

    cheers! Actually, @autor is a custom field of the CPT, not the actual post author. @permanlink is much better, thank you!

    This error unfortunately is still persistent, but only when adding the each-tag.

    The strange thing is, I get one error “Pod not found/ add template” for each category assigned to he cpt, that mean, if my book (cpt) is assigned to 4 categories I have 4 errors displayed…it seems to count something, but not know what to display…

    Cheers!!!!
    Michael

    Thread Starter Honkytonky

    (@honkytonky)

    By the way, I am calling this pods template via a pods shortcode in my template file…it wouldn′t have something to do with this? Would I have to somehow register the each-loop in my functions.php?!?!?
    Cheers!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @honkytonky

    Actually, @autor is a custom field of the CPT, not the actual post author.

    Ah check!

    By the way, I am calling this pods template via a pods shortcode in my template file

    Could you share this shortcode?
    I’ll try to reproduce with the same code locally.

    Cheers, Jory

    Thread Starter Honkytonky

    (@honkytonky)

    Jory,

    the shortcode I call is

    [pods name="buch" template="Widget" limit="3" orderby="post_date DESC"]

    My cpt is book and the template from above is a pods template created in the pods backend named “Widget”.

    I am also fiddling around but unfortunately without success! Thx a lot for your insights!!!

    Michael

    • This reply was modified 4 years, 2 months ago by Honkytonky.
    • This reply was modified 4 years, 2 months ago by Honkytonky.
    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @honkytonky

    I tried to reproduce locally and it works fine here so there must be another issue.
    I assume the template is the code you posted here right?;
    https://www.ads-software.com/support/topic/linking-the-categories-in-pods-template/#post-13863879

    Could you please share everything that might be related to this? So if there are other shortcodes calling this template, share those as well. If there are other templates above this one, share those as well.
    Also, please enable debug to make sure any PHP issues are visible.

    Cheers, Jory

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Linking the categories in Pods Template’ is closed to new replies.