WordPress.org

Forums

HMK Featured Images for Categories and pages.
[resolved] Help with HMK Featured Images for Categories and pages Plugin (18 posts)

  1. Androulla
    Member
    Posted 1 year ago #

    I tried to install the plugin HMK Featured Images for Categories and pages and I stack in the below instruction:

    The image can be displayed o front-end by using shortcode ['header_ads_image'] or Use <?php if (function_exists('hmk_taxonomy_image_url')) echo hmk_taxonomy_image_url(); ?> to get the url and put it in any img tag in header or any page template.

    Could you please give me more detailed instructions since I am newly introduced in this area?

    Also, I can upload an image in category but it cannot displayed in the website. Could you give me a hint?

    http://wordpress.org/plugins/hmk-add-images-for-categories-and-pages/

  2. Muhammad Kashif
    Member
    Plugin Author

    Posted 1 year ago #

    you need to display the image manually either by PHP function mentioned above or by using the provided shortcode in any page or post or in sidebar.

  3. subper
    Member
    Posted 1 year ago #

    Hi,

    this plugin would be great, unfortunatelly the image I set for categories doesn't display on frontend. I can see it in the admin, but no image in the live site. What can be the problem?
    http://elegazhozza.hu/category/mav/
    Thanks for your help!

    subper

  4. Muhammad Kashif
    Member
    Plugin Author

    Posted 1 year ago #

    Hey,

    the plugin don't display the image on front end automatically because it provides the choice to display that image on any place via shortcode or php function :

    The image can be displayed on front-end by using shortcode ['header_ads_image'] or Use <?php if (function_exists('hmk_taxonomy_image_url')) echo hmk_taxonomy_image_url(); ?> to get the url and put it in any img tag in header or any page template.

  5. Muhammad Kashif
    Member
    Plugin Author

    Posted 1 year ago #

    I hope that helped.

  6. subper
    Member
    Posted 1 year ago #

    Hi,
    thanks for your reply!
    Sorry, I'm not a coder, can you please tell me where to put either the shortcode or the php script?

    Thanks much!

    subper

  7. Muhammad Kashif
    Member
    Plugin Author

    Posted 1 year ago #

    where you want to display the image on front end ?

  8. subper
    Member
    Posted 1 year ago #

    I'd like header images for each category page

  9. Muhammad Kashif
    Member
    Plugin Author

    Posted 1 year ago #

    here is an example code :

    <img src="<?php echo hmk_taxonomy_image_url(); ?>" />

    You can place above code for image in your themes header.php at your desired position.

  10. subper
    Member
    Posted 1 year ago #

    Thank you, but I have no idea where can be the desired position, I'm not a coder. Can you please show me the exact place? Thanks! Here is my header php:

    <body class="<?php hybrid_body_class()?>">
    
    	<?php do_action( 'mantel_body_open' ); ?>
    
    		<div id="page" class="site">
    
    			<?php do_action( 'mantel_header_before' ); ?>
    
    				<header id="masthead" class="site-header" role="banner">
    
    					<?php do_action( 'mantel_header_open' ); ?>
    
    						<div class="blocks">
    
    								<div class="header">
    
    									<div class="site-branding">
    										<?php mantel_site_title(); ?>
    									</div><!-- .site-branding -->
    
    									<nav class="top-link" role="navigation">
    
    <ul>
    											<li class="search-wrap">
    
    											<span class="open-s">open s</span>
    												<?php
    													if ( is_plugin_active( 'yith-woocommerce-ajax-search/init.php' ) && class_exists('woocommerce') )
    														do_shortcode( '[yith_woocommerce_ajax_search]' );
    													elseif( is_plugin_active( 'woocommerce/woocommerce.php' ) )
    														get_search_form();
    												?>
    
    											<?php if ( ! is_user_logged_in() ) { global $woocommerce; ?>
    
    <li><a>" title="<?php esc_attr_e( 'Login', 'mantel' ); ?>"><?php _e( 'Login', 'mantel' ); ?></a></li>
    											<?php } else { 
    
    												$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
    
    												if ( $myaccount_page_id ) {
    
    												 $logout_url = wp_logout_url( get_permalink( $myaccount_page_id ) );
    
    												 if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' )
    												 $logout_url = str_replace( 'http:', 'https:', $logout_url );
    												}
    
    												?>
    
    <li><a>"><?php _e( 'Logout', 'mantel' ); ?></a></li>
    											<?php if ( function_exists( 'mantel_my_account_url' ) ) mantel_my_account_url(); ?>
    
    											<?php } ?>
    											<?php if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) : global $woocommerce; ?>
    											<li id="open-cart">
    												<a href="#"><?php _e( 'My Cart', 'mantel' ); ?>
    													<span class="mycart">
    														<?php echo $woocommerce->cart->cart_contents_count; ?>
    													</span>
    												</a>
    
    												<?php get_template_part( 'dropdown', 'cart' )?>
    
    											<?php endif; ?>
    
    </ul>
    									</nav><!-- .top-link -->
    
    								</div><!-- .header -->
    
    								<?php //do_action( 'mantel_header' ); ?>
    
    						</div><!-- .blocks -->
    
    					<?php do_action( 'mantel_header_close' ); ?>
    
    				</header><!-- #masthead .site-header -->
    
    			<?php do_action( 'mantel_header_after' ); ?>
    
    			<?php if ( ! is_page_template( 'page-templates/landing.php' ) ) get_template_part( 'menu', 'primary' ); // Loads the menu-primary.php template. ?>
    
    			<?php do_action( 'mantel_main_before' ); ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code has now been permanently damaged by the forum's parser.]

  11. algerdes
    Member
    Posted 1 year ago #

    I too do not understand this placement of code.

    An example, with specifics, would go a long way toward understanding - especially for those of us who are very new.

  12. n.allen
    Member
    Posted 1 year ago #

    I've installed your plugin, that's so much for writing this! I have zero PHP knowledge, but recognize how to update code. I see that you offered a short code, but how does the short code know which image to display based on the category page being viewed? I'm looking for banner images, rather than header images to display. Where would the short code be inserted?

  13. Muhammad Kashif
    Member
    Plugin Author

    Posted 11 months ago #

    @ n.allen , its coded in a way it detects automatically the page or category being displayed and will display the image accordingly.

    you can place the short-code in content , in sidebar or any other position of your choice.

  14. Muhammad Kashif
    Member
    Plugin Author

    Posted 11 months ago #

    @ algerdes do you want to place it via shortcode or via PHP ?

  15. n.allen
    Member
    Posted 11 months ago #

    Thanks, Kashif. I'm using the short-code now. I appreciate the help!

  16. waynecoda
    Member
    Posted 8 months ago #

    Hi Kashif Ali,

    GREAT plugin first of all. I am using an ecommerce plugin called 'woocommerce' to sell products. I have managed to use this php code:

    <img src="<?php if (function_exists('hmk_taxonomy_image_url')) echo hmk_taxonomy_image_url(); ?>" >

    in order to make the category header image change, however, i cannot seem to change the main shop page. Any ideas why? Other than that i works on the pagaes and product category, just not the main shop archive page.

    Thanks

  17. Muhammad Kashif
    Member
    Plugin Author

    Posted 8 months ago #

    Hey waynecoda,

    Have you added featured image to shop page?

  18. waynecoda
    Member
    Posted 8 months ago #

    Hi yes i did that but not working.

    i think the error os with woocommerce plugin. It is not recognising that as a normal page, because i cannot change the template of that page either. The categories work OK but not the shop base page. odd

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • HMK Featured Images for Categories and pages.
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic