• Resolved robb5

    (@robb5)


    Latest WP, Twenty Twenty theme

    Thanks for the plugin.

    I read the instructions and forum and, after an hour of playing around, still can’t get this working.

    Please explain in detail what to do with the code. Where in the file does it go? How does the code go into an img tag? Does anything in the code (“…if (function_exists…”) need to be changed for default and simple use?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Muhammad

    (@elzahlan)

    The plugin is designed to auto-detect it’s location then provide you with the category or the taxonomy image, or, at any time you can manually set the category or taxonomy id and it will get the image for you

    Now, let’s answer your questions:
    – Where in the files does it go?
    You can add any of the code snippets as mentioned in the documentation of the plugin, you can add it to category.php or any related files
    – How does the code go into an img tag?
    There are 2 functions you can use to get the category or the taxonomy image, the 1st one is z_taxonomy_image_url() and you can use it in any img tag like this <img src="<?php echo z_taxonomy_image_url(); ?>" />
    the 2nd is z_taxonomy_image() and it will create the img tag for you and you can use it like this <?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(); ?>

    Note that the function_exists is used to make sure that if you disabled the plugin it won’t break your website, it simply checkes if the plugin function is working or not before calling it

    Hope I helped, please let me know if you still need further assistant, thanks

    Thread Starter robb5

    (@robb5)

    I tried that before, tried it again…and get WP’s “…critical error…” message. That’s copying the code from here into the category.php file in wp-includes. If that’s really it, then I’ll have to move on to another method.

    Thanks for taking the time.

    Plugin Author Muhammad

    (@elzahlan)

    To be much more clearer, I would like to indicate that what I meant by category.php file is the one that exists in your active theme not the one in wp-includes folder, and if it doesn’t exist you can use archive.php or any relevant template files, thanks

    Thread Starter robb5

    (@robb5)

    Then let’s take this the final step. What are one or two relevant template files?

    I searched the directories and don’t see any other category.php, don’t see archive.php, and trying other files didn’t work. The handful of other files I tried were in wp-content->themes->twenty-twenty and, from there, ->template-parts.

    Plugin Author Muhammad

    (@elzahlan)

    By default, the twenty-twenty doesn’t include category.php or archive.php files, so I think you need to create one of these files, I suggest you copy it from any other theme

    Thread Starter robb5

    (@robb5)

    I really appreciate the time and hope someone else benefits from this. Unfortunately for me, I now have to try another plugin or method.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Clarify for those with minimal skills’ is closed to new replies.