Hi all,
Can i have your help?
I want to show title in WooCommerce, is ok, no problems,
Problem is only when WooC is not installed
How can i fix this?
elseif (is_shop()) {
echo ‘<h1’ . esc_html__(‘My Shop Page’, ‘vanessa’) . ’ ';
}
Thank you
Hi all,
Can i have your help?
I want to show title in WooCommerce, is ok, no problems,
Problem is only when WooC is not installed
How can i fix this?
elseif (is_shop()) {
echo ‘<h1’ . esc_html__(‘My Shop Page’, ‘vanessa’) . ’ ';
}
Thank you
I know, I know… not good way, hardcode coming… I know, but:
elseif (is_shop()) {
echo ‘<h1’ . esc_html__(‘My Shop Page’, ‘vanessa’) . ’ ';
} else {
echo '<h1>YOUR TITLE IF WOO NOT INSTALLED</h1>';
}
Thanks,
Strange is that i have
Fatal error: Call to undefined function is_shop() in as error on line that i have/change with your code.
Ok. One more :
else {
if( class_exists( 'WooCommerce' ) ) {
if ( is_shop() ) {
echo '<h1' . esc_html__(‘My Shop Page’, ‘vanessa’) . ' ';
}
} else {
echo '<h1>YOUR TITLE IF WOO NOT INSTALLED</h1>';
}
}
Thank you again, I will post entire code to see how it is and to not spend so much time for me:
http://collabedit.com/mb9kf
if (is_home()) {
echo '<h2>' . esc_html__('Blog', 'vanessa') . ' </h2>';
} elseif (is_category()) {
echo '<h2>' . $current_category . ' </h2>';
} elseif (is_shop()) {
echo '<h2>' . esc_html__('My Shop Page', 'vanessa') . ' </h2>';
}elseif (is_tag()) {
echo '<h2>' . $current_tag . ' </h2>';
}elseif (is_product()) {
echo '<h2>' . get_the_title() . ' </h2>';
}elseif (get_post_type() == 'product') {
echo '<h2>' . $current_term . ' </h2>';
}elseif (is_author()) {
echo '<h2>' . get_the_author() . ' </h2>';
}elseif (is_search()) {
echo '<h2>' . get_search_query() . ' </h2>';
}else {
echo '<h2>' . get_the_title() . ' </h2>';
}
if ( is_home() ) {
echo '<h2>' . esc_html__('Blog', 'vanessa') . ' </h2>';
} elseif ( is_category() ) {
echo '<h2>' . $current_category . ' </h2>';
} elseif ( is_tag() ) {
echo '<h2>' . $current_tag . ' </h2>';
} elseif ( is_author() ) {
echo '<h2>' . get_the_author() . ' </h2>';
} elseif ( is_search() ) {
echo '<h2>' . get_search_query() . ' </h2>';
} else {
if( class_exists( 'WooCommerce' ) ) {
if ( is_shop() ) {
echo '<h2>' . esc_html__('My Shop Page', 'vanessa') . ' </h2>';
} elseif ( is_product() ) {
echo '<h2>' . get_the_title() . ' </h2>';
} elseif ( get_post_type() == 'product' ) {
echo '<h2>' . $current_term . ' </h2>';
} else {
echo '<h2>' . get_the_title() . ' </h2>';
}
} else {
echo '<h2>' . get_the_title() . ' </h2>';
}
}
Wow,
Thank you so much for your help
Is awesome.
Thank you again
You are welcome