WordPress.org

Forums

Categories Images
[resolved] How do you write an if function does not exist for this plugin? (2 posts)

  1. davidjs
    Member
    Posted 2 years ago #

    I have a default header image and Im trying to write a function that will check if z_taxonomy_image_url has a value in it, if not my default header will display. I also have to check if header_top exist.
    I tried
    <?php if ( ! get_field('header_top') && !function_exists('z_taxonomy_image_url') ) {

    It seams that the function always exist so my default header never shows, so I need a function that not only checks if the function exist but if its blank. So my default header code will show when header_top and taxonomy image are blank.

    http://wordpress.org/extend/plugins/categories-images/

  2. Muhammad
    Member
    Plugin Author

    Posted 2 years ago #

    :)
    You simply need to store the returned value of the function in a variable and then check if this variable are empty or not, for example:

    $cat_img_url= z_taxonomy_image_url();
    if (!empty($cat_img_url))
     // display your category image here
    else
     // display your header image here

    try it and tell me if you still need help.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Categories Images
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.