- This topic has 13 replies, 4 voices, and was last updated 5 years, 5 months ago by
David.
-
AuthorPosts
-
January 5, 2021 at 8:56 am #1606838
Alfonso
Hi there,
I’ve added a image to categories with ACF plugin, is possible to display it on my Archive blog sidebar?
https://www.delahuertacasa.com/blog/
And how i can display empty categories on sidebar??
Thanks!
January 5, 2021 at 1:43 pm #1607147Tom
Lead DeveloperLead DeveloperHi there,
You could create a new Hook Element and set it to
generate_before_right_sidebar_content.Then add the ACF code to output the image.
As for the empty categories, this should help: https://www.wpbeginner.com/wp-tutorials/how-to-show-empty-categories-in-wordpress/#:~:text=Inside%20our%20function%20we%20have,display%20empty%20categories%20as%20well.
January 6, 2021 at 8:23 pm #1608826Alfonso
Thank you Tom, but i don’t understand you.
I can create a hook, but What should I put inside?
https://snipboard.io/oLqw6C.jpg
Then I have ACF configured like this, isn’t it correct?
https://snipboard.io/74uCp0.jpg
Now, my category having a image:
January 6, 2021 at 10:02 pm #1608880Elvin
StaffCustomer SupportI can create a hook, but What should I put inside?
You need to add the ACF shortcode that contains the image for the category on the code text area within the Hook element.
If you’re not familiar with ACF shortcodes, refer to this documentation:
https://www.advancedcustomfields.com/resources/shortcode/You then set the Hook Element’s hook to
generate_before_right_sidebar_contentand set the display rule location to “All Archive”.January 7, 2021 at 3:33 am #1609144Alfonso
Hi Elvin,
I’ve added this shortcode: [acf field=”imagen”]
but only get this:
https://snipboard.io/EAfT8W.jpg
The goal is to get my categories to display with your image, like this example:
January 7, 2021 at 4:15 am #1609201Elvin
StaffCustomer SupportTo verify: Is the Execute Shortcodes setting on the Hook Element checked? You have to check it so that the added shortcodes execute.
https://docs.generatepress.com/article/hooks-element-overview/#settingsJanuary 7, 2021 at 4:38 am #1609243Alfonso
Sorry, now “execute shortcode” is enabled but images are noy dispaying
January 7, 2021 at 4:44 am #1609250Elvin
StaffCustomer SupportSorry, now “execute shortcode” is enabled but images are noy dispaying
Let’s test if the shortcode works.
Can you try testing the same shortcode on a Shortcode block placed on content?
Does it display anything? Let us know.
January 7, 2021 at 4:48 am #1609259Alfonso
I’ve added the shortcode at the end of my single post and is not working.
[acf field=”imagen”]
My custom field is named “imagen”
January 7, 2021 at 5:41 am #1609336David
StaffCustomer SupportHi there,
are you wanting to display an image beside each of the category links ?
If so then maybe this ACF topic will help:
https://support.advancedcustomfields.com/forums/topic/category-list-with-thumbnails/
January 7, 2021 at 9:45 am #1609872Alfonso
Hi there,
I’m a bit lost on this.
I want to try another method following this documentation but it doesn’t work either. I have added a snippet to activate the thumbnail button but nothing appears
Snippet with this code: add_theme_support(‘category-thumbnails’);
January 7, 2021 at 3:04 pm #1610151David
StaffCustomer SupportAre you trying to add the images to the sidebar links – see example image ie. red boxes:
January 8, 2021 at 1:14 am #1610520Alfonso
Yes but i can’t do it.
The idea is to get this widget without plugins. To achieve this I had to install 2 plugins.
Now you can view at first time, categories without featured image or thumbnails and new widget with the same categories and his featured images.
January 8, 2021 at 4:52 am #1610725David
StaffCustomer SupportThe Category Widget that WordPress has built in doesn’t have any filters, so there is no way to insert the category images in there.
The only way to do this is either a Plugin ( like Advanced Category Widgets ) or to have it Custom Developed. If the plugin works and provides the features you require then i would use the plugin.
-
AuthorPosts
- You must be logged in to reply to this topic.