- This topic has 4 replies, 2 voices, and was last updated 11 years, 7 months ago by Sakin.
-
AuthorPosts
-
March 21, 2013 at 9:54 pm #5577William ColeParticipant
I’m using Simple Catch Pro.
I want a custom logo to go to another web address than
esc_url( home_url( ‘/’ ) )
I can do this by editing “simplecatch_functions.php” as follows
In the file simplecatch_functions.php on line no 233, is the following code:
$simplecatch_headerdetails .= ‘<h1 id=”site-logo”>’.'<a href=”‘.esc_url( home_url( ‘/’ ) ).'” title=”‘.esc_attr( get_bloginfo( ‘name’, ‘display’ ) ).'”>’;Replace the code with the following code:
$simplecatch_headerdetails .= ‘<h1 id=”site-logo”>’.'<a href=”‘.’http://www.utoronto.ca/home.htm’.'” title=”‘.esc_attr( get_bloginfo( ‘name’, ‘display’ ) ).'”>’;
I’ve made a chid theme but can’t get a function to modify
function simplecatch_headerdetails() {
There is a functions.php and a functions folder with simplecatch_functions.php
What do I put in the child theme to update this one line of code?
Thanks BillMarch 21, 2013 at 10:40 pm #5590SakinKeymaster@william: You need to create child theme and then remove the function with action hook. It will be somewhat like the below code
// Unhook default Simple Catch Pro functions
function unhook_simplecatch_functions() {
// Don't forget the position number if the original function has one
remove_action( 'simplecatch_before_sidebartop', 'simplecatch_headerdetails', 10 );
}
add_action( 'init', 'unhook_simplecatch_functions' );add_action( 'simplecatch_before_sidebartop', 'simplecatch_headerdetails_child', 10 );
/**
* Diplaying Header Logo, Site Title and Tagline
*/
function simplecatch_headerdetails_child() {}
I recommend you to take the expert help for this.
March 22, 2013 at 2:21 am #5623William ColeParticipantThank-you Sakin
It worked! Just had to give the function file name in the child theme something other than functions.php ( which yielded white screen of nothing)
xout-functions.php
with this inside
<?php
/**
* Simple Catch Pro child functions and definitions
*
* unhook functions and replace headerinfo function
* I think
*
*/
/**
* Set the content width based on the theme’s design and stylesheet.
*/
// Unhook default Simple Catch Pro functions
function unhook_simplecatch_functions() {
// Don’t forget the position number if the original function has one
remove_action( ‘simplecatch_before_sidebartop’, ‘simplecatch_headerdetails’, 10 );
}
add_action( ‘init’, ‘unhook_simplecatch_functions’ );
add_action( ‘simplecatch_before_sidebartop’, ‘simplecatch_headerdetails_child’, 10 );
/**
* Diplaying Header Logo, Site Title and Tagline
*/
function simplecatch_headerdetails_child() {
//delete_transient( ‘simplecatch_headerdetails’ );
global $simplecatch_options_settings;
$options = $simplecatch_options_settings;
if ( ( !$simplecatch_headerdetails = get_transient( ‘simplecatch_headerdetails’ ) ) && ( empty( $options[ ‘remove_header_logo’ ] ) || empty( $options[ ‘remove_site_title’ ] ) || empty( $options[ ‘remove_site_description’ ] ) ) ) {
echo ‘<!– refreshing cache –>’;
$simplecatch_headerdetails = ‘<hgroup class=”logo-wrap clearfix”>’;
if( empty( $options[ ‘remove_header_logo’ ] ) ) {
$simplecatch_headerdetails .= ‘<h1 id=”site-logo”>’.'<a href=”‘.’http://www.utoronto.ca/home.htm’.'” title=”‘.esc_attr( get_bloginfo( ‘name’, ‘display’ ) ).'”>’;
if ( !empty( $options[ ‘featured_logo_header’ ] ) ):
$simplecatch_headerdetails .= ‘<img src=”‘.esc_url( $options[‘featured_logo_header’] ).'” alt=”‘.get_bloginfo( ‘name’ ).'” />’;
else:
// if empty featured_logo_header on theme options, display default logo
$simplecatch_headerdetails .='<img src=”‘. get_template_directory_uri().’/images/logo.png” alt=”logo” />’;
endif;
$simplecatch_headerdetails .= ‘</a></h1>’;
}
if ( empty( $options[ ‘remove_site_title’ ] ) || empty( $options[ ‘remove_site_description’ ] ) ) {
$simplecatch_headerdetails .= ‘<div id=”site-details”>’;
if( empty( $options[ ‘remove_site_title’ ] ) ) {
$simplecatch_headerdetails .= ‘<h1 id=”site-title”><span><a href=”‘.esc_url( home_url( ‘/’ ) ).'” title=”‘.esc_attr( get_bloginfo( ‘name’, ‘display’ ) ).'”>’.esc_attr( get_bloginfo( ‘name’, ‘display’ ) ).'</a></span></h1>’;
}
if( empty( $options[ ‘remove_site_description’ ] ) ) {
$simplecatch_headerdetails .= ‘<h2 id=”site-description”>’.esc_attr( get_bloginfo( ‘description’ ) ).'</h2>’;
}
$simplecatch_headerdetails .= ‘</div>’;
}
$simplecatch_headerdetails .= ‘</hgroup>’;
set_transient( ‘simplecatch_headerdetails’, $simplecatch_headerdetails, 86940 );
}
echo $simplecatch_headerdetails;
} // simplecatch_headerdetails
add_action( ‘simplecatch_before_sidebartop’, ‘simplecatch_headerdetails’, 10 );
}
?>
March 27, 2013 at 2:18 am #5934William ColeParticipantThe new version of Simple Catch Pro (2.0) added an if statement in “simplecatch_functions.php”
344 if ( ! function_exists( ‘simplecatch_headerdetails’ ) ) :
This has made modification of this function so much easier as I can include it in functions.php of my child theme and it replaces the the code enclosed in the above if statement.
Thanks
some day I’ll figure out hooks and filters but not today.
Cheers Bill
March 27, 2013 at 11:17 pm #5999 -
AuthorPosts
- The topic ‘logo URL’ is closed to new replies.