Community Forums › Forums › Archived Forums › General Discussion › Display content at archive page help please
Tagged: ACF, category archives, category pages
- This topic has 11 replies, 2 voices, and was last updated 8 years, 6 months ago by
wparrow.
-
AuthorPosts
-
May 10, 2017 at 5:01 am #206238
wparrow
MemberHi,
I am using Pods plugin to extend the content for archive page. I used the code below and insert to Simple Hooks at "genesis_after_loop" position.<div class="entry"><?php if (is_category()) { echo do_shortcode('[pods name="category"]{@extra_content_for_category}[/pods]'); } ?></div>The output is good but the problem is, the all extra content display at ALL categories.
The correct is: Extra content of category A only display at bottom of category A (for example).
I guest must have some condition of the code above to make it working correct with simple hooks
Please help!
ThanksMay 10, 2017 at 3:34 pm #206257Brad Dalton
ParticipantMay 15, 2017 at 9:21 pm #206503Brad Dalton
ParticipantCan't test this without installing Pods however this should work:
add_action( 'genesis_entry_footer', 'print_pods' ); function print_pods() { if ( is_category('a')) { echo do_shortcode('[pods name="category"]{@extra_content_for_category}[/pods]'); } }Where 1 is the i.d for your category. You can also use the category slug like this:
add_action( 'genesis_entry_footer', 'print_pods' ); function print_pods() { if ( is_category('news')) { echo do_shortcode('[pods name="category"]{@extra_content_for_category}[/pods]'); } }Where news is the category slug
May 16, 2017 at 12:16 am #206505wparrow
MemberThanks Brad for answer, after I paid and join into your site.
However, I want it dynamic works for all categories, not just one specific category.
Could you help?
Thanks
May 16, 2017 at 12:24 am #206506Brad Dalton
ParticipantChange the conditional tag to
is_category()
Note : I advise you not to use the Pods plugin as its not needed. If you want to use a plugin try ACF instead.
May 16, 2017 at 12:31 am #206507wparrow
MemberI used is_category() and it does not work, all Pods content display at all categories.
Pods support very good by Jim and other authors. You can access via the Pods's forum on WordPress.org if needed.
Thanks for your advice. I will try to use ACF now, never try before, hope it's easy
May 16, 2017 at 12:32 am #206508Brad Dalton
ParticipantBased on what you stated?
However, I want it dynamic works for all categories, not just one specific category.
May 16, 2017 at 1:03 am #206509wparrow
MemberPlease help create a sample on the given site as I gave you on FB chat. So, I can see how to do from your sample works.
If it's easy and can do the job, we will replace Pods plugin by ACF
Thanks
May 16, 2017 at 1:36 am #206510Brad Dalton
ParticipantMay 16, 2017 at 3:17 am #206515wparrow
MemberThanks, just applied your code to the site. But has one problem.
Extra content display fine but it's also display at bottom of Recent posts widget on the sidebar.
Please check this url
https://www.canthoshopping.com/category/category-1/May 16, 2017 at 4:10 am #206517Brad Dalton
ParticipantMay 16, 2017 at 4:27 am #206518wparrow
MemberThanks for quick fix. Everything is ok now.
-
AuthorPosts
- The topic ‘Display content at archive page help please’ is closed to new replies.