keep h1 title on homepage - php

I have h1 title i put in my home page, but i want to keep it only in my home page. now it shows in
every single page in the site
im using wordpress and i put it in the header php
<?php
get_template_part( 'framework/parts/breaking-news' ); // Get Breaking News template
tie_banner('banner_below_header' , '<div class="e3lan e3lan-below_header">' , '</div>' );
?>
**<h1 style="padding-left:25px; padding-bottom:5px">stiri sportive</h1>**
this is all the header.php code
<!DOCTYPE html>
<html <?php language_attributes(); ?> prefix="og: http://ogp.me/ns#">
<head>
<meta name="google-site-verification" content="PUSf9MdDStKBNkOow1SskiNxuNcQOOzCf7ruKMyjCyE" />
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php wp_head(); ?>
</head>
<?php global $is_IE ?>
<body id="top" <?php body_class(); ?>>
<div class="wrapper-outer">
<?php if( tie_get_option('banner_bg_url') && tie_get_option('banner_bg') ): ?>
<?php else: ?>
<div class="background-cover"></div>
<?php endif; ?>
<?php if( tie_get_option( 'mobile_menu_active' ) ): ?>
<aside id="slide-out">
<?php if( tie_get_option( 'mobile_menu_search' ) ): ?>
<div class="search-mobile">
<form method="get" id="searchform-mobile" action="<?php echo home_url(); ?>/">
<button class="search-button" type="submit" value="<?php if( !$is_IE ) _eti( 'Search' ) ?>"><i class="fa fa-search"></i></button>
<input type="text" id="s-mobile" name="s" title="<?php _eti( 'Search' ) ?>" value="<?php _eti( 'Search' ) ?>" onfocus="if (this.value == '<?php _eti( 'Search' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _eti( 'Search' ) ?>';}" />
</form>
</div><!-- .search-mobile /-->
<?php endif; ?>
<?php if( tie_get_option('mobile_menu_social') ):
tie_get_social( true , false , 'ttip-none' ); ?>
<?php endif; ?>
<div id="mobile-menu" <?php if( !tie_get_option('mobile_menu_hide_icons') ) echo' class="mobile-hide-icons"';?>></div>
</aside><!-- #slide-out /-->
<?php endif; ?>
<?php $full_width =''; if( tie_get_option( 'full_logo' )) $full_width = ' full-logo';
$center_logo =''; if( tie_get_option( 'center_logo' )) $center_logo = ' center-logo';
$theme_layout = 'boxed';
if( tie_get_option( 'theme_layout' ) == 'full' ) $theme_layout = 'wide-layout';
if( tie_get_option( 'theme_layout' ) == 'boxed-all' ) $theme_layout = 'boxed-all';
?>
<div id="wrapper" class="<?php echo $theme_layout ?>">
<div class="inner-wrapper">
<header id="theme-header" class="theme-header<?php echo $full_width.$center_logo ?>">
<?php if( tie_get_option( 'top_menu' ) ): ?>
<div id="top-nav" class="top-nav">
<div class="container">
<?php if(tie_get_option( 'top_date' )):
if( tie_get_option('todaydate_format') ) $date_format = tie_get_option('todaydate_format');
else $date_format = 'l , j F Y';
?>
<span class="today-date"><?php echo date_i18n( $date_format , current_time( 'timestamp' ) ); ?></span><?php endif; ?>
<?php wp_nav_menu( array( 'container_class' => 'top-menu', 'theme_location' => 'top-menu' ) ); ?>
<?php if( tie_get_option( 'top_search' ) ): ?>
<div class="search-block">
<form method="get" id="searchform-header" action="<?php echo home_url(); ?>/">
<button class="search-button" type="submit" value="<?php if( !$is_IE ) _eti( 'Search' ) ?>"><i class="fa fa-search"></i></button>
<input class="search-live" type="text" id="s-header" name="s" title="<?php _eti( 'Search' ) ?>" value="<?php _eti( 'Search' ) ?>" onfocus="if (this.value == '<?php _eti( 'Search' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _eti( 'Search' ) ?>';}" />
</form>
</div><!-- .search-block /-->
<?php endif;
if( tie_get_option('top_social') ):
tie_get_social( true , false , 'ttip-none' ); ?>
<?php endif; ?>
<?php tie_language_selector_flags(); ?>
</div><!-- .container /-->
</div><!-- .top-menu /-->
<?php endif; ?>
<div class="header-content">
<?php if( tie_get_option( 'mobile_menu_active' ) ): ?>
<a id="slide-out-open" class="slide-out-open" href="#"><span></span></a>
<?php endif; ?>
<?php
if( is_category() || is_single() ){
if( is_category() ) $category_id = get_query_var('cat') ;
if( is_single() ){
$categories = get_the_category( $post->ID );
if( !empty( $categories[0]->term_id ) )
$category_id = $categories[0]->term_id ;
}
if( !empty( $category_id ) ){
$tie_cats_options = get_option( 'tie_cats_options' );
if( !empty( $tie_cats_options[ $category_id ] ) )
$cat_options = $tie_cats_options[ $category_id ];
}
}
if( !empty($cat_options['cat_custom_logo']) ){
$logo_margin ='';
if( !empty( $cat_options['logo_margin'] ) || !empty( $cat_options['logo_margin_bottom'] ) ){
$logo_margin = ' style="';
if( !empty( $cat_options['logo_margin'] ) )
$logo_margin .= ' margin-top:'.$cat_options['logo_margin'].'px;';
if( !empty( $cat_options['logo_margin_bottom'] ) )
$logo_margin .= ' margin-bottom:'.$cat_options['logo_margin_bottom'].'px;';
$logo_margin .= '"';
}
?>
<div class="logo"<?php echo $logo_margin ?>>
<h2>
<?php if( $cat_options['logo_setting'] == 'title' ): ?>
<?php echo single_cat_title( '', false ) ?>
<?php else : ?>
<?php if( !empty($cat_options['logo']) ) $logo = $cat_options['logo'];
elseif( tie_get_option( 'logo' ) ) $logo = tie_get_option( 'logo' );
else $logo = get_stylesheet_directory_uri().'/images/logo.png';
?>
<a title="<?php bloginfo('name'); ?>" href="<?php echo home_url(); ?>/">
<img src="<?php echo $logo ; ?>" alt="<?php echo single_cat_title( '', false ) ?>" <?php if( $cat_options['logo_retina_width'] && $cat_options['logo_retina_height'] ) echo 'width="'.$cat_options['logo_retina_width'] .'" height="'.$cat_options['logo_retina_height'].'"'; ?> /><strong><?php echo single_cat_title( '', false ) ?></strong>
</a>
<?php endif; ?>
</h2>
</div><!-- .logo /-->
<?php if( $cat_options['logo_retina'] && $cat_options['logo_retina_width'] && $cat_options['logo_retina_height']): ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
var retina = window.devicePixelRatio > 1 ? true : false;
if(retina) {
jQuery('#theme-header .logo img').attr('src', '<?php echo $cat_options['logo_retina']; ?>');
jQuery('#theme-header .logo img').attr('width', '<?php echo $cat_options['logo_retina_width']; ?>');
jQuery('#theme-header .logo img').attr('height', '<?php echo $cat_options['logo_retina_height']; ?>');
}
});
</script>
<?php endif; ?>
<?php
}else{
$logo_margin ='';
if( tie_get_option( 'logo_margin' ) || tie_get_option( 'logo_margin_bottom' ) ){
$logo_margin = ' style="';
if( tie_get_option( 'logo_margin' ) )
$logo_margin .= ' margin-top:'.tie_get_option( 'logo_margin' ).'px;';
if( tie_get_option( 'logo_margin_bottom' ) )
$logo_margin .= ' margin-bottom:'.tie_get_option( 'logo_margin_bottom' ).'px;';
$logo_margin .= '"';
}
?>
<div class="logo"<?php echo $logo_margin ?>>
<?php if( is_home() || is_front_page() ) echo '<img>'; else echo '<img>'; ?>
<?php if( tie_get_option('logo_setting') == 'title' ): ?>
<?php bloginfo('name'); ?>
<span><?php bloginfo( 'description' ); ?></span>
<?php else : ?>
<?php if( tie_get_option( 'logo' ) ) $logo = tie_get_option( 'logo' );
else $logo = get_stylesheet_directory_uri().'/images/logo.png';
?>
<a title="<?php bloginfo('name'); ?>" href="<?php echo home_url(); ?>/">
<img src="<?php echo $logo ; ?>" alt="<?php bloginfo('name'); ?>" <?php if( tie_get_option('logo_retina_width') && tie_get_option('logo_retina_height') ) echo 'width="'.tie_get_option('logo_retina_width') .'" height="'.tie_get_option('logo_retina_height').'"'; ?> /><strong><?php bloginfo('name'); ?> <?php bloginfo( 'description' ); ?></strong>
</a>
<?php endif; ?>
<?php if( is_home() || is_front_page() ) echo '</img>'; else echo '</img>'; ?>
</div><!-- .logo /-->
<?php if( tie_get_option( 'logo_retina' ) && tie_get_option( 'logo_retina_width' ) && tie_get_option( 'logo_retina_height' )): ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
var retina = window.devicePixelRatio > 1 ? true : false;
if(retina) {
jQuery('#theme-header .logo img').attr('src', '<?php echo tie_get_option( 'logo_retina' ); ?>');
jQuery('#theme-header .logo img').attr('width', '<?php echo tie_get_option( 'logo_retina_width' ); ?>');
jQuery('#theme-header .logo img').attr('height', '<?php echo tie_get_option( 'logo_retina_height' ); ?>');
}
});
</script>
<?php endif; ?>
<?php } ?>
<?php tie_banner('banner_top' , '<div class="e3lan e3lan-top">' , '</div>' ); ?>
<div class="clear"></div>
</div>
<?php $stick = ''; ?>
<?php if( tie_get_option( 'stick_nav' ) ) $stick = ' class="fixed-enabled"' ?>
<?php if( tie_get_option( 'main_nav' ) ): ?>
<?php
//UberMenu Support
$navID = 'main-nav';
if ( class_exists( 'UberMenu' ) ){
$uberMenus = get_option( 'wp-mega-menu-nav-locations' );
if( !empty($uberMenus) && is_array($uberMenus) && in_array("primary", $uberMenus)) $navID = 'main-nav-uber';
}?>
<nav id="<?php echo $navID; ?>"<?php echo $stick; ?>>
<div class="container">
<?php if( tie_get_option( 'nav_logo' ) ): ?>
<a class="main-nav-logo" title="<?php bloginfo('name'); ?>" href="<?php echo home_url(); ?>/">
<img src="<?php echo tie_get_option( 'nav_logo' ) ?>" width="195" height="54" alt="<?php bloginfo('name'); ?>">
</a>
<?php endif ?>
<?php wp_nav_menu( array( 'container_class' => 'main-menu', 'theme_location' => 'primary', 'walker' => new tie_mega_menu_walker(), 'fallback_cb'=> false) ); ?>
<?php if(tie_get_option( 'random_article' )): ?>
<i class="fa fa-random"></i>
<?php endif ?>
<?php if( tie_get_option( 'shopping_cart' ) && function_exists( 'is_woocommerce' ) ):
global $woocommerce; ?>
<a class="tie-cart ttip" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _eti( 'View your shopping cart' ); ?>"><span class="shooping-count-outer"><?php if( isset( $woocommerce->cart->cart_contents_count ) && ( $woocommerce->cart->cart_contents_count != 0 ) ){ ?><span class="shooping-count"><?php echo $woocommerce->cart->cart_contents_count ?></span><?php } ?><i class="fa fa-shopping-cart"></i></span></a>
<?php endif ?>
</div>
</nav><!-- .main-nav /-->
<?php endif; ?>
</header><!-- #header /-->
<?php get_template_part( 'framework/parts/breaking-news' ); // Get Breaking News template ?>
<?php tie_banner('banner_below_header' , '<div class="e3lan e3lan-below_header">' , '</div>' ); ?>
<h1 style="padding-left:25px; padding-bottom:5px">stiri sportive</h1>
<?php
$sidebar = '';
if( tie_get_option( 'sidebar_pos' ) == 'left' ) $sidebar = ' sidebar-left';
if( is_singular() || ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) ){
$current_ID = $post->ID;
if( function_exists( 'is_woocommerce' ) && is_woocommerce() ) $current_ID = woocommerce_get_page_id('shop');
$get_meta = get_post_custom( $current_ID );
if( !empty($get_meta["tie_sidebar_pos"][0]) ){
$sidebar_pos = $get_meta["tie_sidebar_pos"][0];
if( $sidebar_pos == 'left' ) $sidebar = ' sidebar-left';
elseif( $sidebar_pos == 'full' ) $sidebar = ' full-width';
elseif( $sidebar_pos == 'right' ) $sidebar = ' sidebar-right';
}
}
if( ( function_exists('is_bbpress') && is_bbpress() && tie_get_option( 'bbpress_full' )) || is_404() ) $sidebar = ' full-width';
?>
<div id="main-content" class="container<?php echo $sidebar ; ?>">
what to add to the code so the title will show only in the homepage

You could wrap the h1 in an if statement using is_home() and is_frontpage().
<?php if( is_home() || is_front_page() ) : ?>
<h1 style="padding-left:25px; padding-bottom:5px">stiri sportive</h1>
<?php endif; ?>
is_home() returns true or false depending on whether the page being shown is the 'Front Page' or not.
You should consider restructuring things though, so that this forms part of the home page template, rather than being run on every page of your website.
is_home() docs: https://developer.wordpress.org/reference/functions/is_home/

You can wrap your <h1> tag with a conditional statement checking whether the page is the homepage or not:
<?php if ( is_home() || is_front_page() ) { ?>
<h1 style="padding-left:25px; padding-bottom:5px">stiri sportive</h1>
<?php } ?>
This way, the H1 tag will only show on the website's homepage.

Related

WordPress google map showing the marker as "undefined"

Hi I'm currently experiencing a problem on my Wordpress website with the map, its showing that the marker is undefined like on this page here, how would i go about fixing this here is the code its pulling from:
<footer class="card__footer">
<?php
$rating = get_average_listing_rating( $post->ID, 1 );
$geolocation_street = get_post_meta( $post->ID, 'geolocation_street', true );
if ( ! empty( $rating ) ) { ?>
<div class="rating card__rating" itemprop="aggregateRating" itemscope
itemtype="http://schema.org/AggregateRating">
<meta itemprop="ratingValue"
content="<?php echo get_average_listing_rating( $post->ID, 1 ); ?>">
<meta itemprop="reviewCount" content="<?php echo get_comments_number( $post->ID ) ?>; ?>">
<span class="js-average-rating"><?php echo get_average_listing_rating( $post->ID, 1 ); ?></span>
</div>
<?php } elseif ( ! empty( $geolocation_street ) ) { ?>
<div class="card__rating card__pin">
<?php get_template_part( 'assets/svg/pin-simple-svg' ) ?>
</div>
<?php }
if ( ! is_wp_error( $terms ) && ( is_array( $terms ) || is_object( $terms ) ) ) { ?>
<ul class="card__tags">
<?php foreach ( $terms as $term ) {
$icon_url = listable_get_term_icon_url( $term->term_id );
$attachment_id = listable_get_term_icon_id( $term->term_id );
if ( empty( $icon_url ) ) {
continue;
} ?>
<li>
<div class="card__tag">
<div class="pin__icon">
<?php listable_display_image( $icon_url, '', true, $attachment_id ); ?>
</div>
</div>
</li>
<?php } ?>
</ul><!-- .card__tags -->
<?php }
$listing_address = listable_get_formatted_address( $post );
if ( ! empty( $listing_address ) ) { ?>
<div class="address card__address" itemprop="address" itemscope
itemtype="http://schema.org/PostalAddress">
<?php echo $listing_address ?>
</div>
<?php } ?>
</footer>
New to PHP, Thank you in advance!

YITH WooCommerce Wishlist: Help me show the first item / product thumbnail within the sidebar widget and wishlist manage areas?

I am using YITH Wishlist within WooCommerce, WordPress.
Within an individual wishlist - it displays the image, with 'remove from list', the product title and a link through to the individual product all working.
So going one step higher up the 'folders' when I display the individual wishlists within the Manage Wishlists page, I am only able to show the name of the list and the link through to that individual list where you can see all the products grouped. This is where I wish to be able to display the 'first product within that individual wishlist' 's first image or thumbnail.
I have tried and broken the script numerous times. How can I write a script that will grab that image and let me display it within the Manage Wishlist's page? Better yet, is there a shortcode that does this for me (if there is such a thing)?
Here is the pretty much stock relevant template files...
This is the manage page template (if you Ctrl+F for 'I WANT TO SHOW IMAGE HERE' to see where I want to pull image through) - where I want to display image:
<?php
/**
* Wishlist manage template
*
* #author Your Inspiration Themes
* #package YITH WooCommerce Wishlist
* #version 2.0.5
*/
if ( ! defined( 'YITH_WCWL' ) ) {
exit;
} // Exit if accessed directly
?>
<form id="yith-wcwl-form" action="<?php echo esc_url( YITH_WCWL()->get_wishlist_url( 'manage' ) ) ?>" method="post">
<!-- TITLE -->
<?php
do_action( 'yith_wcwl_before_wishlist_title' );
if( ! empty( $page_title ) ) {
echo apply_filters( 'yith_wcwl_wishlist_title', '<h2 class="h1 blue lh2 mt2 mb0 p0">Manage My Boards</h2>' );
}
do_action( 'yith_wcwl_before_wishlist_manage' );
?>
<table class="shop_table cart wishlist_table wishlist_manage_table" cellspacing="0" >
<thead>
<tr>
<th class="wishlist-name">
<span class="nobr">
Boards
<?php // echo apply_filters( 'yith_wcwl_wishlist_manage_name_heading', __( 'Wishlists', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php /* ?>
<th class="wishlist-privacy">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_privacy_heading', __( 'Privacy', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php */ ?>
<th class="wishlist-delete">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_delete_heading', __( 'Delete', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="wishlist-name">
<a title="<?php echo $default_wishlist_title ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'user' . '/' . $current_user_id ) ?>">
<?php echo $default_wishlist_title ?>
</a>
</td>
<?php /* ?>
<td class="wishlist-privacy">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_default_privacy', __( 'Public', 'yith-woocommerce-wishlist' ) )?>
</td>
<?php */ ?>
<td class="wishlist-delete"></td>
</tr>
<?php
$wishlist_count = 0;
if( ! empty( $user_wishlists ) ):
?>
<?php foreach( $user_wishlists as $wishlist ): ?>
<?php if( ! $wishlist['is_default'] ): ?>
<tr>
<td class="wishlist-name">
<a title="<?php echo $wishlist['wishlist_name'] ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] ) ?>">
<!-- I WANT TO SHOW IMAGE HERE (OF THE FIRST PRODUCT IN THE WISHLIST CURRENTLY BEING LOOPED THROUGH) -->
<?php echo $wishlist['wishlist_name'] ?>
</a>
</td>
<?php /* ?>
<td class="wishlist-privacy">
<select name="wishlist_options[<?php echo $wishlist['ID'] ?>][wishlist_privacy]" class="wishlist-visibility selectBox">
<option value="0" class="public-visibility" <?php selected( $wishlist['wishlist_privacy'], 0 ) ?> ><?php echo apply_filters( 'yith_wcwl_public_wishlist_visibility', __( 'Public', 'yith-woocommerce-wishlist' ) )?></option>
<option value="1" class="shared-visibility" <?php selected( $wishlist['wishlist_privacy'], 1 ) ?> ><?php echo apply_filters( 'yith_wcwl_shared_wishlist_visibility', __( 'Shared', 'yith-woocommerce-wishlist' ) )?></option>
<option value="2" class="private-visibility" <?php selected( $wishlist['wishlist_privacy'], 2 ) ?> ><?php echo apply_filters( 'yith_wcwl_private_wishlist_visibility', __( 'Private', 'yith-woocommerce-wishlist' ) )?></option>
</select>
</td>
<?php */ ?>
<td class="wishlist-delete">
<!-- <input type="checkbox" value="yes" name="wishlist_options[<?php echo $wishlist['ID'] ?>][delete]"/> -->
<a class="button" href="<?php echo esc_url( add_query_arg( 'wishlist_id', $wishlist['ID'], wp_nonce_url( YITH_WCWL()->get_wishlist_url( 'manage' ), 'yith_wcwl_delete_action', 'yith_wcwl_delete' ) ) ) ?>"><?php _e( 'Delete', 'yith-woocommerce-wishlist' ) ?></a>
</td>
</tr>
<?php
$wishlist_count ++;
endif;
?>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<a class="btn button create-new-wishlist" href="<?php echo YITH_WCWL()->get_wishlist_url( 'create' ) ?>">
<?php echo apply_filters( 'yith_wcwl_create_new_wishlist_icon', '<i class="icon-plus"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_create_new_wishlist_title', __( 'Create a new board', 'yith-woocommerce-wishlist' ) )?>
</a>
<?php if( ! empty( $user_wishlists ) && $wishlist_count ): ?>
<button class="submit-wishlist-changes">
<?php echo apply_filters( 'yith_wcwl_mange_wishlist_icon', '<i class="icon-ok"></i>' )?>
<?php _e( 'Save Settings', 'yith-woocommerce-wishlist' ) ?>
</button>
<?php endif; ?>
</td>
</tr>
</tfoot>
</table>
<?php wp_nonce_field( 'yith_wcwl_manage_action', 'yith_wcwl_manage' )?>
<?php do_action( 'yith_wcwl_after_wishlist_manage' ); ?>
</form>
This is the individual wishlist page, with the working Show Product Image script (Ctrl+F 'GRABBING THE IMAGE SUCCESSFULLY' to get to relevant code) - where I can see a working example of pulling the image from a product through:
<?php
/**
* Wishlist page template
*
* #author Your Inspiration Themes
* #package YITH WooCommerce Wishlist
* #version 2.0.12
*/
if ( ! defined( 'YITH_WCWL' ) ) {
exit;
} // Exit if accessed directly
?>
<script type="text/javascript">
var root = document.documentElement;
root.className += ' wishlist-view';
</script>
<?php do_action( 'yith_wcwl_before_wishlist_form', $wishlist_meta ); ?>
<?php
function cmp($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
uasort($users_wishlists, 'cmp');
?>
<?php /* ?>
<pre><code>
<?php
print_r($wishlist_items);
// print_r($users_wishlists);
?>
</code></pre>
<?php */ ?>
<!--
<div class="my-materials-sidebar bg-dark-blue white lg:absolute top-0 left-0 bottom-0">
<div class="bg-darken-3 p2 lg:p3 height-100 overflow-auto">
<h3 class="h1 mt0">My Materials</h3>
<h3 class="h2 lg:h1 mb1">My Boards</h3>
<ul class="list-reset my3 p0 uppercase lg:h3">
<li>Add new board</li>
<li>Manage boards</li>
</ul>
<ul class="list-reset m0 p0 uppercase lg:h3 boards">
<?php foreach ($users_wishlists as $users_wishlist) : ?>
<?php
$token = $users_wishlist['wishlist_token'];
$name = $users_wishlist['wishlist_name'];
?>
<?php /* <pre><code><?php print_r($users_wishlist); ?></code></pre> */ ?>
<li>
<?php if( $name ) : ?>
<a href="/my-materials/view/<?php echo $token; ?>">
<?php echo $name; ?>
</a>
<?php else : ?>
<a href="/my-materials">
Main board
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<ul class="list-reset m0 p0 uppercase lg:h3">
<li>
My account
</li>
<li>
Log out
</li>
</ul>
</div>
</div>
-->
<form id="yith-wcwl-form" action="<?php echo $form_action ?>" method="post" class="woocommerce">
<?php wp_nonce_field( 'yith-wcwl-form', 'yith_wcwl_form_nonce' ) ?>
<!-- TITLE -->
<?php
do_action( 'yith_wcwl_before_wishlist_title', $wishlist_meta );
if( ! empty( $page_title ) ) :
?>
All Boards
<?php if( count( $wishlist_items ) > 0 ) : ?>
<a href="#" class="btn dark-grey hover:black right" data-edit-board>Edit Board</a>
<?php else : ?>
<?php endif; ?>
<div class="wishlist-title <?php echo ( $is_custom_list ) ? 'wishlist-title-with-form' : ''?>">
<?php echo apply_filters( 'yith_wcwl_wishlist_title', '<h2 class="h1 blue lh2 mt2 mb0 p0">' . $page_title . '</h2>' ); ?>
<?php /* if( $is_custom_list ): ?>
<a class="btn button show-title-form">
<?php echo apply_filters( 'yith_wcwl_edit_title_icon', '<i class="fa fa-pencil"></i>' )?>
<?php _e( 'Edit title', 'yith-woocommerce-wishlist' ) ?>
</a>
<?php endif; */ ?>
</div>
<?php if( $is_custom_list ): ?>
<div class="hidden-title-form">
<input type="text" value="<?php echo $page_title ?>" name="wishlist_name"/>
<button class="button">
<?php echo apply_filters( 'yith_wcwl_save_wishlist_title_icon', '<i class="fa fa-check fa-fw"></i>' )?>
<span>
<?php _e( 'Save', 'yith-woocommerce-wishlist' )?>
</span>
</button>
<a class="hide-title-form btn button">
<?php echo apply_filters( 'yith_wcwl_cancel_wishlist_title_icon', '<i class="fa fa-remove fa-fw"></i>' )?>
<span>
<?php _e( 'Cancel', 'yith-woocommerce-wishlist' )?>
</span>
</a>
</div>
<?php endif; ?>
<?php
endif;
do_action( 'yith_wcwl_before_wishlist', $wishlist_meta ); ?>
<?php /* ?>
<ul class="products columns-4">
<?php if( count( $wishlist_items ) > 0 ) :
$added_items = array();
foreach( $wishlist_items as $item ) :
global $product;
$item['prod_id'] = yit_wpml_object_id ( $item['prod_id'], 'product', true );
if( in_array( $item['prod_id'], $added_items ) ){
continue;
}
$added_items[] = $item['prod_id'];
$product = wc_get_product( $item['prod_id'] );
$availability = $product->get_availability();
$stock_status = $availability['class'];
if( $product && $product->exists() ) :
?>
<li class="product">
<a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>">
<?php echo $product->get_image() ?>
<h2 class="woocommerce-loop-product__title"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></h2>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</a>
<?php if( $is_user_owner ): ?>
<div class="product-remove">
×
</div>
<?php endif; ?>
<?php if( $available_multi_wishlist && is_user_logged_in() && count( $users_wishlists ) > 1 && $move_to_another_wishlist && $is_user_owner ): ?>
<select class="change-wishlist selectBox-">
<option value=""><?php _e( 'Move', 'yith-woocommerce-wishlist' ) ?></option>
<?php
foreach( $users_wishlists as $wl ):
if( $wl['wishlist_token'] == $wishlist_meta['wishlist_token'] ){
continue;
}
?>
<option value="<?php echo esc_attr( $wl['wishlist_token'] ) ?>">
<?php
$wl_title = ! empty( $wl['wishlist_name'] ) ? esc_html( $wl['wishlist_name'] ) : esc_html( $default_wishlsit_title );
if( $wl['wishlist_privacy'] == 1 ){
$wl_privacy = __( 'Shared', 'yith-woocommerce-wishlist' );
}
elseif( $wl['wishlist_privacy'] == 2 ){
$wl_privacy = __( 'Private', 'yith-woocommerce-wishlist' );
}
else{
$wl_privacy = __( 'Public', 'yith-woocommerce-wishlist' );
}
// echo sprintf( '%s - %s', $wl_title, $wl_privacy );
echo sprintf( '%s', $wl_title );
?>
</option>
<?php
endforeach;
?>
</select>
<?php endif; ?>
</li>
<?php
endif;
endforeach;
else: ?>
<?php endif; ?>
</ul>
<?php */ ?>
<?php ?>
<!-- WISHLIST TABLE -->
<table class="shop_table cart wishlist_table" data-pagination="<?php echo esc_attr( $pagination )?>" data-per-page="<?php echo esc_attr( $per_page )?>" data-page="<?php echo esc_attr( $current_page )?>" data-id="<?php echo $wishlist_id ?>" data-token="<?php echo $wishlist_token ?>">
<?php $column_count = 2; ?>
<thead>
<tr>
<?php if( $show_cb ) : ?>
<th class="product-checkbox">
<input type="checkbox" value="" name="" id="bulk_add_to_cart"/>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $is_user_owner ): ?>
<th class="product-remove"></th>
<?php
$column_count ++;
endif;
?>
<th class="product-thumbnail"></th>
<th class="product-name">
<span class="nobr"><?php echo apply_filters( 'yith_wcwl_wishlist_view_name_heading', __( 'Product Name', 'yith-woocommerce-wishlist' ) ) ?></span>
</th>
<?php if( $show_price ) : ?>
<th class="product-price">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_view_price_heading', __( 'Unit Price', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $show_stock_status ) : ?>
<th class="product-stock-status">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_view_stock_heading', __( 'Stock Status', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $show_last_column ) : ?>
<th class="product-move"></th>
<?php
$column_count ++;
endif;
?>
</tr>
</thead>
<tbody>
<?php
if( count( $wishlist_items ) > 0 ) :
$added_items = array();
foreach( $wishlist_items as $item ) :
global $product;
$item['prod_id'] = yit_wpml_object_id ( $item['prod_id'], 'product', true );
if( in_array( $item['prod_id'], $added_items ) ){
continue;
}
$added_items[] = $item['prod_id'];
$product = wc_get_product( $item['prod_id'] );
$availability = $product->get_availability();
$stock_status = $availability['class'];
if( $product && $product->exists() ) :
?>
<tr id="yith-wcwl-row-<?php echo $item['prod_id'] ?>" data-row-id="<?php echo $item['prod_id'] ?>">
<?php if( $show_cb ) : ?>
<td class="product-checkbox">
<input type="checkbox" value="<?php echo esc_attr( $item['prod_id'] ) ?>" name="add_to_cart[]" <?php echo ( ! $product->is_type( 'simple' ) ) ? 'disabled="disabled"' : '' ?>/>
</td>
<?php endif ?>
<?php if( $is_user_owner ): ?>
<td class="product-remove">
<div>
×
</div>
</td>
<?php endif; ?>
<td class="product-thumbnail">
<a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>">
<!-- THIS IS GRABBING THE IMAGE SUCCESSFULLY -->
<?php echo $product->get_image() ?>
<h2 class="product-name"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></h2>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</a>
</td>
<?php /* ?>
<td class="product-name">
<?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</td>
<?php */ ?>
<?php if( $show_price ) : ?>
<td class="product-price">
<?php
$base_product = $product->is_type( 'variable' ) ? $product->get_variation_regular_price( 'max' ) : $product->get_price();
echo $base_product ? $product->get_price_html() : apply_filters( 'yith_free_text', __( 'Free!', 'yith-woocommerce-wishlist' ) );
?>
</td>
<?php endif ?>
<?php if( $show_stock_status ) : ?>
<td class="product-stock-status">
<?php echo $stock_status == 'out-of-stock' ? '<span class="wishlist-out-of-stock">' . __( 'Out of Stock', 'yith-woocommerce-wishlist' ) . '</span>' : '<span class="wishlist-in-stock">' . __( 'In Stock', 'yith-woocommerce-wishlist' ) . '</span>'; ?>
</td>
<?php endif ?>
<?php if( $show_last_column ): ?>
<td class="product-move">
<!-- Date added -->
<?php
if( $show_dateadded && isset( $item['dateadded'] ) ):
echo '<span class="dateadded">' . sprintf( __( 'Added on : %s', 'yith-woocommerce-wishlist' ), date_i18n( get_option( 'date_format' ), strtotime( $item['dateadded'] ) ) ) . '</span>';
endif;
?>
<!-- Add to cart button -->
<?php if( $show_add_to_cart && isset( $stock_status ) && $stock_status != 'out-of-stock' ): ?>
<?php woocommerce_template_loop_add_to_cart(); ?>
<?php endif ?>
<!-- Change wishlist -->
<?php if( $available_multi_wishlist && is_user_logged_in() && count( $users_wishlists ) > 1 && $move_to_another_wishlist && $is_user_owner ): ?>
<div class="product-move-trigger">
<!-- <img src="<?php echo get_template_directory_uri(); ?>/assets/img/plus-white.svg" alt="" class=""> -->
</div>
<div class="product-move-dropdown">
<h3>Move to Board</h3>
<select class="change-wishlist selectBox- select">
<option value=""><?php _e( 'Choose...', 'yith-woocommerce-wishlist' ) ?></option>
<?php
foreach( $users_wishlists as $wl ):
if( $wl['wishlist_token'] == $wishlist_meta['wishlist_token'] ){
continue;
}
?>
<option value="<?php echo esc_attr( $wl['wishlist_token'] ) ?>">
<?php
$wl_title = ! empty( $wl['wishlist_name'] ) ? esc_html( $wl['wishlist_name'] ) : esc_html( $default_wishlsit_title );
if( $wl['wishlist_privacy'] == 1 ){
$wl_privacy = __( 'Shared', 'yith-woocommerce-wishlist' );
}
elseif( $wl['wishlist_privacy'] == 2 ){
$wl_privacy = __( 'Private', 'yith-woocommerce-wishlist' );
}
else{
$wl_privacy = __( 'Public', 'yith-woocommerce-wishlist' );
}
if ( $wl_title == 'My Materials' ) {
$wl_title = 'Main board';
}
// echo sprintf( '%s - %s', $wl_title, $wl_privacy );
echo sprintf( '%s', $wl_title );
?>
</option>
<?php
endforeach;
?>
</select>
</div>
<?php endif; ?>
<!-- Remove from wishlist -->
<?php if( $is_user_owner && $repeat_remove_button ): ?>
<?php _e( 'Remove', 'yith-woocommerce-wishlist' ) ?>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php
endif;
endforeach;
else: ?>
<tr class="empty">
<td colspan="<?php echo esc_attr( $column_count ) ?>" class="wishlist-empty"><?php echo apply_filters( 'yith_wcwl_no_product_to_remove_message', __( 'No items have been added to this board yet', 'yith-woocommerce-wishlist' ) ) ?></td>
</tr>
<?php
endif;
if( ! empty( $page_links ) ) : ?>
<tr class="pagination-row">
<td colspan="<?php echo esc_attr( $column_count ) ?>"><?php echo $page_links ?></td>
</tr>
<?php endif ?>
</tbody>
<tfoot>
<tr>
<td colspan="<?php echo esc_attr( $column_count ) ?>">
<?php if( $show_cb ) : ?>
<div class="custom-add-to-cart-button-cotaniner">
<?php echo apply_filters( 'yith_wcwl_custom_add_to_cart_text', __( 'Add the selected products to the cart', 'yith-woocommerce-wishlist' ) ) ?>
</div>
<?php endif; ?>
<?php if ( $is_user_owner && $show_ask_estimate_button && $count > 0 ): ?>
<div class="ask-an-estimate-button-container">
<a href="<?php echo ( $additional_info || ! is_user_logged_in() ) ? '#ask_an_estimate_popup' : $ask_estimate_url ?>" class="btn button ask-an-estimate-button" <?php echo ( $additional_info ) ? 'data-rel="prettyPhoto[ask_an_estimate]"' : '' ?> >
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', '<i class="fa fa-shopping-cart"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', __( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
</a>
</div>
<?php endif; ?>
<?php
do_action( 'yith_wcwl_before_wishlist_share', $wishlist_meta );
if ( is_user_logged_in() && $is_user_owner && ! $is_private && $share_enabled ){
yith_wcwl_get_template( 'share.php', $share_atts );
}
do_action( 'yith_wcwl_after_wishlist_share', $wishlist_meta );
?>
</td>
</tr>
</tfoot>
</table>
<?php ?>
<?php wp_nonce_field( 'yith_wcwl_edit_wishlist_action', 'yith_wcwl_edit_wishlist' ); ?>
<?php if( ! $is_default ): ?>
<input type="hidden" value="<?php echo $wishlist_token ?>" name="wishlist_id" id="wishlist_id">
<?php endif; ?>
<?php do_action( 'yith_wcwl_after_wishlist', $wishlist_meta ); ?>
</form>
<?php do_action( 'yith_wcwl_after_wishlist_form', $wishlist_meta ); ?>
<?php if( $show_ask_estimate_button && ( ! is_user_logged_in() || $additional_info ) ): ?>
<div id="ask_an_estimate_popup">
<form action="<?php echo $ask_estimate_url ?>" method="post" class="wishlist-ask-an-estimate-popup">
<?php if( ! is_user_logged_in() ): ?>
<label for="reply_email"><?php echo apply_filters( 'yith_wcwl_ask_estimate_reply_mail_label', __( 'Your email', 'yith-woocommerce-wishlist' ) ) ?></label>
<input type="email" value="" name="reply_email" id="reply_email">
<?php endif; ?>
<?php if( ! empty( $additional_info_label ) ):?>
<label for="additional_notes"><?php echo esc_html( $additional_info_label ) ?></label>
<?php endif; ?>
<textarea id="additional_notes" name="additional_notes"></textarea>
<button class="btn button ask-an-estimate-button ask-an-estimate-button-popup" >
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', '<i class="fa fa-shopping-cart"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', __( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
</button>
</form>
</div>
<?php endif; ?>
I know this script cannot be directly copied as it is looking through product variables knowing which product it is looking through, I need to write something similar that will look inside the wishlist instead of inside the product.
I think I know what I need to do, I just have no idea how to do it.
I have tried simple stuff I predicted wouldn't work before even implementing it. Trying to guess shortcodes / scouring the web for a list of shortcodes.
Edit
Attempting to achieve this using 'simplehtmldom'...
I have downloaded and installed simplehtmldom then called it into the file:
<?php
$simplehtmldom = get_template_directory() . "/simplehtmldom/simple_html_dom.php";
include_once($simplehtmldom);
?>
Then gone on to try find the image within the wishlist by gathering the src of the first product in that wishlist:
<?php
$boardlink = YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] );
$html = file_get_html($boardlink);
$wishlistimage = $html->find('.attachment-woocommerce_thumbnail', 0)->src;
?>
The variable $boardlink value has been taken from the href within the section:
<a title="<?php echo $wishlist['wishlist_name'] ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] ) ?>">
So technically should / could work...
However, I get a range of errors:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /home/example/public_html/development/wp-content/themes/bolt/simplehtmldom/simple_html_dom.php on line 136
Warning: file_get_contents(): Failed to enable crypto in /home/example/public_html/development/wp-content/themes/bolt/simplehtmldom/simple_html_dom.php on line 136
Warning: file_get_contents(https://development.example.com/my-materials/view/9OW01M6785H9/): failed to open stream: operation failed in /home/example/public_html/development/wp-content/themes/bolt/simplehtmldom/simple_html_dom.php on line 136
This site doesn't have a valid SSL as it is just a staging dev site. The live site does have an SSL.
I think the main issue is with the wishlists being private to the user, I don't think we are able to scrape from these pages.

Adding different logo on different wordpress pages

i'm a beginner in code and even if people have probably answered this question i don't know how to implement it in my case...
in my wordpress, i have a woocommerce integrated and i would like to display a different header logo then the home page.
i have found the place where it is called but i dont know how to implement it correctly and not scrap all the code.
i would probably want something like this
<?php if (isset($class) && $class == 'woocommerce'): ?>
<img src="images/logo-with-white-text" />
<?php else: ?>
<img src="images/logo-with-dark-text" />
<?php endif; ?>
implemented in this code from my theme
<!-- START LOGO -->
<div id="logo" class="<?php echo $width_tagline ?>" >
<?php
if( yit_get_option( 'header-custom-logo' ) == 'yes' && yit_get_option( 'header-custom-logo-image' ) != '' ) : ?>
<a id="logo-img" href="<?php echo home_url() ?>" title="<?php bloginfo( 'name' ) ?>">
<?php $size = #getimagesize(yit_get_option( 'header-custom-logo-image' )); ?>
<img class="no-dark" src="<?php echo yit_ssl_url( yit_get_option( 'header-custom-logo-image' ) ) ?>" <?php if( yit_get_option( 'logo-retina-url' ) ): ?>data-at2x="<?php echo yit_ssl_url( yit_get_option( 'logo-retina-url' ) ) ?>"<?php endif ?>title="<?php bloginfo( 'name' ) ?>" alt="<?php bloginfo( 'name' ) ?>" <?php if( !empty($size) && isset($size[3] ) ) echo $size[3] ?> />
<?php if ( 'yes' == YIT_Layout()->enable_dark_header ) : ?>
<?php $size = #getimagesize(yit_get_option( 'header-dark-custom-logo-image' )); ?>
<img class="only-dark" src="<?php echo yit_ssl_url( yit_get_option( 'header-dark-custom-logo-image' ) ) ?>" title="<?php bloginfo( 'name' ) ?>" alt="<?php bloginfo( 'name' ) ?>" <?php if( !empty($size) && isset($size[3] ) ) echo $size[3] ?> />
<?php endif; ?>
</a>
<?php else : ?>
<a id="textual" href="<?php echo home_url() ?>" title="<?php echo str_replace( array( '[', ']' ), '', bloginfo( 'name' ) ) ?>">
<?php echo yit_decode_title( get_bloginfo( 'name' ) ) ?>
</a>
<?php endif ?>
<?php
if( yit_get_option( 'header-logo-tagline' ) == 'yes' ):
$class = array();
if ( strpos( get_bloginfo( 'description' ), '|') ) $class[] = 'multiline';
if ( yit_get_option('header-logo-tagline-mobile') == 'no' ) $class[] = 'hidden-xs';
$class = ! empty( $class ) ? ' class="' . implode( $class, ' ' ) . '"' : '';
?>
<?php yit_string( "<p id='tagline'{$class}>", yit_decode_title( get_bloginfo( 'description' ) ), '</p>' );?>
<?php endif ?>
</div>
<!-- END LOGO -->
I hope someone will be kind enough to help me out on this one!
Thanks in advance
My way doing this
<a href="<?php echo home_url(); ?>" class="logo_link">
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/logo.png" data-src="<?php echo get_template_directory_uri(); ?>/assets/images/logo-wc.png" alt="" class="logo">
</a>
<script>
$( document ).ready(function() {
if($('body').hasClass('woocommerce')) {
$('.logo_link img').attr('src', $(this).data('src'));
}
});
</script>
If woocommerce is installed and activated you can do this
<?php if(is_woocommerce()){ ?>
<img src="images/logo-with-white-text" />
<?php }else{ ?>
<img src="images/logo-with-white-text" />
<?php } ?>

Add different logo to wordpress pages

I have a theme i am customizing on wordpress(Increate themes), the thing is the owner wants a page that talks something different and it will also have a different logo, my question is how can i insert a different logo to the page.
this is my theme header.php logo part
<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?> class="no-js">
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<?php global $ht_options; ?>
<!-- favicon -->
<?php if($ht_options['custom_favicon']) { echo ht_favicon($ht_options['custom_favicon']);} ?>
<?php if($ht_options['apple_ipad_logo']): ?>
<!-- For iPad -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo $ht_options['apple_ipad_logo']; ?>">
<?php endif; ?>
<?php if($ht_options['apple_logo']): ?>
<!-- For iPhone -->
<link rel="apple-touch-icon-precomposed" href="<?php echo $ht_options['apple_logo']; ?>">
<?php endif; ?>
<!-- responsive -->
<?php if( $ht_options['responsive_layout'] =='responsive' ) {?>
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1,width=device-width">
<?php } ?>
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=EmulateIE8; IE=EDGE" />
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- RSS feed -->
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php if ( $ht_options['rss_id'] <> "" ) { echo $ht_options['rss_id']; } else { echo get_bloginfo_rss('rss2_url'); } ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php echo $ht_options['before_head']; ?>
<?php wp_head(); ?>
</head>
<?php
$dark_layout = '';
if( $ht_options['dark_skin'] ){
$dark_layout = 'dark-layout';
}
?>
<body <?php body_class($dark_layout); ?>>
<div id="frame_">
<div id="layout" class="<?php echo $ht_options['layout_type']; ?> ">
<header id="header">
<?php if(!$ht_options['disable_top_header']) {?>
<div class="head_up">
<div class="row clearfix">
<div class="l_ht">
<?php echo $ht_options['top_header_info'];?>
</div><!-- end text left -->
<div class="r_ht">
<?php
if( is_woocommerce_activated() ):
global $woocommerce;
$total_amount = $woocommerce->cart->get_cart_total();
$cart_item_counts = $woocommerce->cart->cart_contents_count;
$cart_url = $woocommerce->cart->get_cart_url();
$checkout_url = $woocommerce->cart->get_checkout_url();
?>
<div class="shopping_bag">
<div class="header_bag">
<i class="icon_bag_alt"></i><span> <?php echo $cart_item_counts;?> <?php _e("item(s)", "highthemes");?> / <?php echo $total_amount;?></span>
</div><!-- .header_bag -->
<div class="view_cart_mini">
<div class="view_cart">
<?php if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {?>
<ul class="cart_list">
<?php
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
if ( $_product->exists() && $values['quantity'] > 0 ) {
?>
<li class="clearfix">
<?php
$thumbnail = apply_filters( 'woocommerce_in_cart_product_thumbnail', $_product->get_image(), $values, $cart_item_key );
printf('%s', esc_url( get_permalink( apply_filters('woocommerce_in_cart_product_id', $values['product_id'] ) ) ), $thumbnail );
?>
<div class="cart_list_product_title">
<?php
if ( ! $_product->is_visible() || ( ! empty( $_product->variation_id ) && ! $_product->parent_is_visible() ) )
echo apply_filters( 'woocommerce_in_cart_product_title', $_product->get_title(), $values, $cart_item_key );
else
printf('%s', esc_url( get_permalink( apply_filters('woocommerce_in_cart_product_id', $values['product_id'] ) ) ), apply_filters('woocommerce_in_cart_product_title', $_product->get_title(), $values, $cart_item_key ) );
// Meta data
echo $woocommerce->cart->get_item_data( $values );
// Backorder notification
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $values['quantity'] ) )
echo '<p class="backorder_notification">' . __( 'Available on backorder', 'highthemes' ) . '</p>';
if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1', $cart_item_key );
} else {
$product_quantity = esc_attr( $values['quantity'] );
}
?>
<div class="cart_list_product_quantity"><?php _e("Quantity", "highthemes");?>: <?php echo $product_quantity;?> / <?php
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('[x]', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __( 'Remove this item', 'highthemes' ) ), $cart_item_key );
?>
</div><!-- .cart_list_prodcut_quantity -->
</div>
</li>
<?php
}
}
?>
</ul><!-- .cart_list-->
<span class="total_checkout fll"><?php _e("Cart subtotal", "highthemes");?></span>
<span class="amount_total flr">
<?php
echo $total_amount;
?>
</span>
<div class="tac" style="clear:both">
<span><?php _e("View Cart", "highthemes");?></span>
<span><i class="icon_cart_alt mi"></i><?php _e("Checkout", "highthemes");?></span>
</div>
<?php } else { // end check if cart ?>
<p>
<?php _e("Your cart is empty!", "highthemes");?>
</p>
<?php }?>
</div>
</div>
</div>
<?php endif // if woocommerc is activated;?>
<?php
if( function_exists('icl_get_languages') ){
$langs = icl_get_languages('skip_missing=1');
if($langs) {
$current_lang = '';
foreach ($langs as $key => $lang) {
if($lang['active']){
$current_lang = $lang;
unset($langs[$key]);
}
}
?>
<div class="languages">
<?php if ( $current_lang ) {
echo '<a title="'.$lang['native_name'].'" href="'. $current_lang['url'] .'"><span>'. strtoupper($current_lang['language_code']) .'</span></a>';
}?>
<div class="other_languages">
<?php
foreach ($langs as $key => $lang) {
echo '<a title="'.$lang['native_name'].'" href="'. $lang['url'] .'"><span>'. strtoupper($lang['language_code']) .'</span></a>';
}
?>
</div><!-- end other -->
</div><!-- end languages -->
<?php } }// end wpml ?>
<div class="social social_head">
<?php echo ht_social_icons_list();?>
</div><!-- end social -->
</div><!-- end social and bag -->
</div><!-- row -->
</div><!-- head -->
<?php }?>
<?php
$sticky_header = '';
if( $ht_options['sticky_header'] ) {
$sticky_header = 'my_sticky';
}
?>
<div class="headdown <?php echo $sticky_header;?>">
<div class="row clearfix">
<div class="logo">
<a title="<?php bloginfo("description");?>" href="<?php echo home_url();?>">
<?php if ($ht_options['logo_url']) { ?>
<img src="<?php echo $ht_options['logo_url'];?>" alt="<?php bloginfo('description'); ?>"/>
<?php } else { ?>
<img src="<?php echo get_template_directory_uri();?>/images/logo.png" alt="Logo"/>
<?php }?>
</a>
</div>
<?php if(!$ht_options['disable_top_search']) {?>
<div class="search">
<div class="search_icon"><i class="icon_search icon_close"></i></div>
<div class="s_form">
<form action="<?php echo site_url(); ?>/" id="search" method="get">
<input id="inputhead" name="s" type="text" onfocus="if (this.value=='<?php _e("Start Searching...", "highthemes");?>') this.value = '';" onblur="if (this.value=='') this.value = '<?php _e("Start Searching...", "highthemes");?>';" value="<?php _e("Start Searching...", "highthemes");?>" placeholder="<?php _e("Start Searching...", "highthemes");?>">
<button type="submit"><i class="icon_search"></i></button>
</form><!-- end form -->
</div>
</div>
<?php }?>
<?php wp_nav_menu( array('menu_class' => 'sf-menu', 'menu_id' => 'menu', 'menu' => 'default', 'container' => 'nav','theme_location' => 'nav', 'container_id' => 'nav' ) ); ?>
<!-- end nav -->
</div><!-- row -->
</div><!-- headdown -->
</header><!-- end header -->
<?php
$ht_header_type = '';
if($post){
$ht_header_type = ht_get_header_type(get_the_ID());
}
?>
<?php if ( is_page_template('tpl-under-construction.php') ) {?>
<?php } elseif( $ht_header_type =='rev-slider' ) { ?>
<div class="sliderr" id="main-slideshow">
<?php
if(function_exists('putRevSlider')) {
putRevSlider(get_post_meta(get_the_ID(), '_ht_rev_slider', true));
}
?>
</div>
<?php
$overlay_caption_title = get_post_meta( get_the_ID(), '_ht_overlay_caption_title', true );
$overlay_button1_title = get_post_meta( get_the_ID(), '_ht_overlay_button1_title', true );
$overlay_button1_link = get_post_meta( get_the_ID(), '_ht_overlay_button1_link', true );
$overlay_button1_icon = get_post_meta( get_the_ID(), '_ht_overlay_button1_icon', true );
$overlay_button2_title = get_post_meta( get_the_ID(), '_ht_overlay_button2_title', true );
$overlay_button2_link = get_post_meta( get_the_ID(), '_ht_overlay_button2_link', true );
$overlay_button2_icon = get_post_meta( get_the_ID(), '_ht_overlay_button2_icon', true );
if( !empty($overlay_button1_title) || !empty($overlay_button2_title) || !empty($overlay_caption_title) ) {?>
<div class="intro_p tac">
<div class="row inner clearfix">
<?php if( !empty($overlay_caption_title) ) {?>
<h2><?php echo $overlay_caption_title;?></h2>
<?php }?>
<?php if( !empty($overlay_button1_title) ) {?>
<a href="<?php echo $overlay_button1_link;?>" class="tbutton large">
<?php if( !empty($overlay_button1_icon) ) {?><i class="<?php echo $overlay_button1_icon;?>"></i><?php }?>
<span><?php echo $overlay_button1_title;?></span></a>
<?php } ?>
<?php if( !empty($overlay_button2_title) ) {?>
<a href="<?php echo $overlay_button2_link;?>" class="tbutton large m_left">
<?php if( !empty($overlay_button2_icon) ) {?><i class="<?php echo $overlay_button2_icon;?>"></i><?php }?>
<span><?php echo $overlay_button2_title;?></span></a>
<?php } ?>
</div><!-- End row -->
</div><!-- End intro p -->
<?php }?>
<?php } else if ( $ht_header_type =='title' ) {
$header_bg_repeat = $header_bg_position = $header_bg_cover = '';
if(is_page() || is_single() ) {
$header_centered = get_post_meta( get_the_ID(), '_ht_header_centered', true );
}
$header_background = get_post_meta( get_the_ID(), '_ht_header_background', true );
if( empty($header_background) || $header_background =='default' ) {
$header_bg = 'background-image:url('.get_template_directory_uri().'/images/assets/breadcrumb1.jpg); background-repeat: no-repeat;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size:cover; background-size: cover;' ;
} elseif ( $header_background == 'custom' ) {
$header_bg = get_post_meta( get_the_ID(), '_ht_header_bg', true );
$header_bg_repeat = get_post_meta( get_the_ID(), '_ht_header_bg_repeat', true );
$header_bg_position = get_post_meta( get_the_ID(), '_ht_header_bg_position', true );
$header_bg_cover = get_post_meta( get_the_ID(), '_ht_header_bg_cover', true );
$header_bg = ( !empty($header_bg) ) ? wp_get_attachment_image_src( $header_bg, 'full') : '';
$header_bg = ( !empty($header_bg) ) ? 'background-image:url(' . $header_bg[0] . ');' : '';
$header_bg_repeat = ( !empty($header_bg) ) ? 'background-repeat:' . $header_bg_repeat . ';' : '';
$header_bg_position = ( !empty($header_bg) ) ? 'background-position:' . $header_bg_position . ';' : '';
$header_bg_cover = ( !empty($header_bg) && !empty($header_bg_cover) ) ? 'background-repeat:no-repeat;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size:cover; background-size: cover;' : '';
} else {
$header_bg = 'background-image:url('.get_template_directory_uri().'/images/assets/'.$header_background.'); background-repeat: no-repeat;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size:cover; background-size: cover;' ;
}
$header_centered = ( !empty($header_centered) ) ? ' centered' : '';
$styles =
$header_bg.
$header_bg_repeat.
$header_bg_position.
$header_bg_cover;
?>
<div class="breadcrumb-place" style="<?php echo $styles;?>">
<div class="row clearfix">
<h3 class="page-title">
<?php
if( is_woocommerce_activated() ) {
if( is_shop() ) {
woocommerce_page_title();
}
}
if ( is_page() || is_single() ) the_title();
else if ( is_category() ) _e("Category : ",'highthemes'). single_cat_title('', true);
else if ( is_tag() ) _e("Tag : ",'highthemes').single_tag_title('', true);
else if ( is_year() ) echo get_the_date( _x( 'Y', 'yearly archives date format', 'highthemes' ) );
else if ( is_month() ) echo get_the_date( _x( 'F Y', 'monthly archives date format', 'highthemes' ) );
else if ( is_day() ) echo get_the_date();
else if ( is_author() ) echo get_the_author();
else if ( is_search() ) printf( __('Search results for','highthemes') . " %s", '"' . get_search_query() . '"' );
else if ( is_tax() ) {
global $wp_query;
$term = $wp_query->get_queried_object();
echo $term->name;
}
?>
</h3>
<?php
if( !is_woocommerce_activated() ) {
if($ht_options['breadcrumb_inner']){ ?>
<?php if (class_exists('simple_breadcrumb')) { $bc = new simple_breadcrumb; } ?>
<?php }
} else {
if(( is_woocommerce() || is_cart() || is_checkout() || is_account_page() ) and ($ht_options['breadcrumb_inner'])) {
woocommerce_breadcrumb();
} else if ($ht_options['breadcrumb_inner']) {
?>
<div id="breadcrumb" class="<?php echo $header_centered;?>">
<?php if (class_exists('simple_breadcrumb')) { $bc = new simple_breadcrumb; } ?>
</div>
<?php }
}
?>
</div><!-- row -->
</div><!-- end breadcrumb place -->
<?php } else if ( $ht_header_type =='no-title' ) { } ?>
<?php if(is_404()){?>
<div class="error_page">
<div class="row clearfix">
<div class="CLE">
<i class="icon_dislike errori"></i>
<h2 class="tac mtt"> <?php _e("PAGE NOT FOUND", "highthemes");?> <small> <?php _e("The page you are looking for might have been removed.","highthemes");?> </small></h2>
<span><i class="icons-arrow-left mi"></i> <?php _e("Back To Homepage", "highthemes");?></span>
</div>
</div><!-- row -->
</div><!-- end 404 place -->
<?php }?>
<?php
if( is_single() && get_post_type() == 'portfolio' ) {
$portfolio_single_layout = get_post_meta( get_the_ID(), '_ht_portfolio_single_layout', true);
if($portfolio_single_layout == 'image_left' || $portfolio_single_layout == 'image_right'){
?>
<div class="hidden-x page-content no-sidebar">
<?php } else { ?>
<div class="hidden-x page-content <?php echo ht_sidebar_layout();?>">
<?php }?>
<?php } else {?>
<div class="hidden-x page-content <?php echo ht_sidebar_layout();?> ">
<?php }?>
You could do something on header.php
if ($_SERVER["SCRIPT_NAME"] != '/the-page-you-want-a-custom-logo/index.php') {
<?php if ($ht_options['logo_url']) { ?>
<img src="<?php echo $ht_options['logo_url'];?>" alt="<?php bloginfo('description'); ?>"/>
<?php } else { ?>
<img src="<?php echo get_template_directory_uri();?>/images/logo.png" alt="Logo"/>
<?php }?>
} else {
<img src="/images/yourcustomlogo.jpg" alt="Logo"/>
}

add badge to thumbnail image

What I want to do on the front page where I have recent posts, is to add a small upper corner badge or ribbon that says "NEW" to the thumbnails of posts that were published on today's date. Below is my index.php which controls the front page layout:
<?php
/**
* The main template file.
*
* Used to display the homepage when home.php doesn't exist.
*/
?>
<?php
// Get options
$mts_options = get_option(MTS_THEME_NAME);
// Featured Section 1 settings ( slider is here) --------------------------------
$slider_enabled = ( $mts_options['mts_featured_slider'] === '1' ) ? true : false;
if ( empty($mts_options['mts_featured_slider_cat']) || !is_array($mts_options['mts_featured_slider_cat']) ) {
$mts_options['mts_featured_slider_cat'] = array('0');
}
$slider_cat = implode(",", $mts_options['mts_featured_slider_cat']);
// Featured Section settings --------------------------------------------------
$f2_title = $mts_options['mts_featured_section_2_title'];
if ( empty($mts_options['mts_featured_section_2_cat']) || !is_array($mts_options['mts_featured_section_2_cat']) ) {
$mts_options['mts_featured_section_2_cat'] = array('0');
}
$f2_cat= implode(",", $mts_options['mts_featured_section_2_cat']);
// Featured Section 3 settings --------------------------------------------------
get_header(); ?>
<div id="page">
<div class="article">
<?php if ( $slider_enabled && is_home() && !is_paged() ) { ?>
<section id="featured-section-1" class="featured-section featured-section-1-1 clearfix">
<div class="slider-container">
<div class="primary-slider-container clearfix loading">
<div id="slider" class="primary-slider">
<?php
$slider_full = 'best-featuredfull';
if ( empty( $mts_options['mts_custom_slider'] ) ) {
$my_query = new WP_Query('cat='.$slider_cat.'&posts_per_page='.$mts_options['mts_featured_slider_num']);
while ( $my_query->have_posts() ) : $my_query->the_post();
?>
<div>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail($slider_full,array('title' => '')); ?>
<div class="slider-caption">
<?php if(isset($mts_options['mts_home_headline_meta_info']['enabled']) && $mts_options['mts_home_headline_meta_info']['enabled']){ ?>
<div class="sliderdate">
<?php if(isset($mts_options['mts_home_headline_meta_info']['enabled']['date']) == '1') { ?>
<span class="thetime updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
<?php } ?>
</div>
<?php } ?>
<h2 class="slide-title"><?php the_title(); ?></h2>
</div>
<div class="post-day"><?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'review-total-only'); ?></div>
</a>
</div>
<?php endwhile; wp_reset_postdata();
} else { ?>
<?php foreach( $mts_options['mts_custom_slider'] as $slide ) : ?>
<div>
<a href="<?php echo esc_url( $slide['mts_custom_slider_link'] ); ?>">
<?php echo wp_get_attachment_image( $slide['mts_custom_slider_image'], $slider_full, false, array('title' => '') ); ?>
<div class="slider-caption">
<div class="sliderdate"><?php echo esc_html( $slide['mts_custom_slider_title'] ); ?></div>
<h2 class="slide-title"><?php echo esc_html( $slide['mts_custom_slider_text'] ); ?></h2>
</div>
</a>
</div>
<?php endforeach; ?>
<?php } ?>
</div>
</div>
</div><!-- slider-container -->
</section>
<?php } ?>
<?php if( $mts_options['mts_featured_section_2'] === '1' && is_home() && !is_paged() ) {// featured section 2 ?>
<section id="featured-section-3" class="featured-section clearfix">
<?php if (!empty($f2_title)) { ?><h4 class="featured-section-title"><?php echo $f2_title;?></h4><?php } ?>
<?php
$f2_query = new WP_Query('cat='.$f2_cat.'&posts_per_page=4');
$f2_count = 1; if ($f2_query->have_posts()) : while ($f2_query->have_posts()) : $f2_query->the_post();
$f2_loop_params = best_mixed_layout_params( 1, 2, $f2_count );// see functions.php
$f2_clear_class = $f2_loop_params['clear_class'];
$f2_type_class = $f2_loop_params['box_class'];
$f2_loop_thumb = $f2_loop_params['thumb'];
$f2_show_excerpt = $f2_loop_params['show_excerpt'];
$f2_show_author = $f2_loop_params['show_author'];
$begin_f2_extra_wrappers = $f2_loop_params['open_wrappers'];
$end_f2_extra_wrappers = $f2_loop_params['close_wrappers'];
?>
<article class="post-box latestPost mixed <?php echo $f2_type_class;?> <?php echo $f2_clear_class;?>">
<?php echo $begin_f2_extra_wrappers; ?>
<div class="post-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="nofollow">
<?php the_post_thumbnail($f2_loop_thumb,array('title' => '')); ?>
</a>
</div>
<div class="post-data">
<div class="post-data-container">
<header>
<h2 class="title post-title"><?php the_title(); ?></h2>
<?php mts_the_postinfo(); ?>
</header>
<?php if ($f2_show_excerpt) : ?>
<div class="post-excerpt">
<?php echo mts_excerpt(40); ?>
</div>
<?php endif; ?>
</div>
</div>
<?php echo $end_f2_extra_wrappers; ?>
</article><!--.post-box-->
<?php $f2_count++; endwhile;
endif; wp_reset_postdata();
?>
</section><!--#featured-section-3-->
<?php } ?>
<div id="content_box">
<?php $latest_posts_used = false;
if ( !empty( $mts_options['mts_featured_categories'] ) ) {
foreach ( $mts_options['mts_featured_categories'] as $section ) {
$category_id = $section['mts_featured_category'];
$featured_category_layout = $section['mts_featured_category_layout'];
$posts_num = $section['mts_featured_category_postsnum'];
if ( $category_id === 'latest' && ! $latest_posts_used ) {
$latest_posts_used = true;
$fc_section_class = ( in_array( $featured_category_layout, array( 'vertical', 'mixed' ) ) ) ? '' : ' '.$featured_category_layout;
?>
<section id="latest-posts" class="clearfix<?php echo $fc_section_class ?><?php //echo $fc_section_no_gap ?>">
<h4 class="featured-section-title"><?php _e( "Latest", "best" ); ?></h4>
<?php $j = 1; if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php best_the_homepage_article( $featured_category_layout, $j, true );?>
<?php $j++; endwhile; endif; ?>
<!--Start Pagination-->
<?php if (isset($mts_options['mts_pagenavigation_type']) && $mts_options['mts_pagenavigation_type'] == '1' ) { ?>
<?php $additional_loop = 0; mts_pagination($additional_loop['max_num_pages']); ?>
<?php } else { ?>
<div class="pagination pagination-previous-next">
<ul>
<li class="nav-previous"><?php next_posts_link( '<i class="fa fa-chevron-left"></i> '. __( 'Previous', 'best' ) ); ?></li>
<li class="nav-next"><?php previous_posts_link( __( 'Next', 'best' ).' <i class="fa fa-chevron-right"></i>' ); ?></li>
</ul>
</div>
<?php } ?>
<!--End Pagination-->
</section><!--#latest-posts-->
<?php } elseif ( $category_id !== 'latest' && !is_paged() ) {
$fc_section_class = ( in_array( $featured_category_layout, array( 'vertical', 'mixed' ) ) ) ? '' : ' '.$featured_category_layout;
?>
<section class="featured-section clearfix<?php echo $fc_section_class ?>">
<h4 class="featured-section-title"><?php echo get_cat_name($category_id); ?></h4>
<?php $cat_query = new WP_Query('cat='.$category_id.'&posts_per_page='.$posts_num); ?>
<?php $j = 1; if ($cat_query->have_posts()) : while ($cat_query->have_posts()) : $cat_query->the_post(); ?>
<?php best_the_homepage_article( $featured_category_layout, $j );?>
<?php $j++; endwhile; endif; wp_reset_postdata();?>
</section>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
What I have is this: to check the date and display the badge (not including css) but not sure where to input it exactly:
<?php
$days_old = (current_time(timestamp) - get_the_time('U') - (get_settings('gmt_offset') *3600 ) ) / (60*60*24);
if ($days_old <=1) {
echo <div class="post-badge">NEW</div>;
}
?>
I want to insert it into The Latest Post Section. Any help would be greatly appreciated:)

Categories