[resolved] exchange logo in autofocus theme and make it clickable or add header logo (3 posts)

  1. raduletzgo
    Posted 6 years ago #

    so i got myself the autofocus pro theme hoping it would be easier, but boy was i wrong. how about support? well let's skip that.

    since the autofocus pro theme is a bit different than the regular autofocus theme, most of the tutorials did not work for me. and i am a php-css-noob. so here is what i got and i guess this is a pretty good solution/workaround. this only works for thematic child themes like autofocus. you could even use it on your own custom made theme.

    I don't know for sure where to insert code in the php file and the css file to make a custom and clickable (link to my site) logo appear, sure, the pro theme has an option button for a custom logo, but you can't click it. this sucks.

    i found help on this site

    all you need to do is open your thematic child's theme funtctions.php and paste the following piece of code into it. on top or at the bottom, it does not really matter. keep in mind that your functios.php already starts with <?php and ends with?>. I messed up the php closing the first time i did it. make sure you have a backup of your files before attempting. save the file. now you'll have an option for a custom clickable logo implemented in wordpress. it worked for me with the pro theme.

    // ---------- "Child Theme Options" menu STARTS HERE
    add_action('admin_menu' , 'childtheme_add_admin');
    function childtheme_add_admin() {
        add_submenu_page('themes.php', 'Child Theme Options', 'Child Theme Options', 'edit_themes', basename(__FILE__), 'childtheme_admin');
    function childtheme_admin() {
        $child_theme_image = get_option('child_theme_image');
        $enabled = get_option('child_theme_logo_enabled');
        if ($_POST['options-submit']){
            $enabled = htmlspecialchars($_POST['enabled']);
            update_option('child_theme_logo_enabled', $enabled);
            $file_name = $_FILES['logo_image']['name'];
            $temp_file = $_FILES['logo_image']['tmp_name'];
            $file_type = $_FILES['logo_image']['type'];
            if($file_type=="image/gif" || $file_type=="image/jpeg" || $file_type=="image/pjpeg" || $file_type=="image/png"){
                $fd = fopen($temp_file,’rb’);
                $wud = wp_upload_dir();
                if (file_exists($wud[path].'/'.strtolower($file_name))){
                    unlink ($wud[path].'/'.strtolower($file_name));
                $upload = wp_upload_bits( $file_name, '', $file_content);
            //  echo $upload['error'];
                $child_theme_image = $wud[url].'/'.strtolower($file_name);
                update_option('child_theme_image', $child_theme_image);
                <div class="updated"><p>Your new options have been successfully saved.</p></div>
        if($enabled) $checked='checked="checked"';
            <div class="wrap">
                <div id="icon-themes" class="icon32"></div>
                <h2>Child Theme Options</h2>
                <form name="theform" method="post" enctype="multipart/form-data" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']);?>">
                    <table class="form-table">
                            <td width="200">Use logo image instead of blog title and description:</td>
                            <td><input type="checkbox" name="enabled" value="1" <?php echo $checked; ?>/></td>
                            <td>Current image:</td>
                            <td><img src="<?php echo $child_theme_image; ?>" /></td>
                            <td>Logo image to use (gif/jpeg/png):</td>
                            <td><input type="file" name="logo_image"><br />(you must have writing permissions for your uploads directory)</td>
                    <input type="hidden" name="options-submit" value="1" />
                    <p class="submit"><input type="submit" name="submit" value="Save Options" /></p>
    // ---------- "Child Theme Options" menu ENDS HERE
    // ---------- Adding the logo image to the header STARTS HERE
        function remove_thematic_blogtitle() {
        function remove_thematic_blogdescription() {
        function thematic_logo_image() {
            echo '<div id="logo-image"><a href="'.get_option('home').'"><img src="'.get_option('child_theme_image').'" /></a></div>';
    // ---------- Adding the logo image to the header ENDS HERE

    i am not the expert here and credit goes to cristian @ cozmoslabs . so make sure to check out the comments for some troubleshooting like bad code etc.

  2. SThede
    Posted 5 years ago #

    Hi, I tried this and messed up my functions.php apparently...

    I have no idea why I tried this. I have virtually no experience with any code. Anyways I get:

    "Parse error: syntax error, unexpected '<' in /home1/simonthe/public_html/wp-content/themes/autofocuspro/functions.php on line 882"

    When I try to access any part of my site now, so I've already started to reinstall WordPress. Any help on how to fix this is totally appreciated, I'll post in general forums too.



    P.S. I still want a reasonably sized header to go in my Autofocus Pro template... Are there no alternatives? I'm finding the whole experience a bit ridiculous.

  3. SThede
    Posted 5 years ago #

    The rebooting worked. I guess I'll start from scratch. Any insights into this header business is appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic