• Resolved rotoblueprint

    (@rotoblueprint)


    I have spent about 2 days reading with about 12 hours of video trying to get my child theme up and rolling. I havent done TON of tinkering, but I am getting much more comfortable.

    Here is my main hurdle right now (please feel free to link to a previous discussion because I sense Im not the first with this exact issue:

    -I cant get the snippets I put in functions.php to work.
    -I have tried several different methods, but clearly there is something wrong with the way I am starting. I either get a white screen and shut down my site OR I see the text from the code at the top of my site with no actual changes having had taken place.

    What Ive done so far (again this probably sounds silly the way I am saying it because of my noob status:
    -created a child theme through Bluehost’s c-panel
    -style.css is good to go
    -I have tried to upload the functions.php starting with:

    <?php

    /**
    * My Custom Functions
    */

    but nothing I put in below seems to take.

    I realize I have a lot to learn and you probably dont know where to start, so definitely not asking for you to teach me anything, but is there a resource you would recommend to help me get started on having a better understanding of what’s going wrong? This is the code I am trying to use at the moment, btw:

    add_filter(‘tc_fp_link_url’ , ‘my_custom_fp_links’, 10 ,2);
    function my_custom_fp_links( $original_link , $fp_id ) {

    //assigns a custom link by page id
    $custom_link = array(
    //page id => ‘Custom link’
    2 => ‘https://www.rotoblueprint.com/?cat=5&#8217;,
    9 => ‘https://www.rotoblueprint.com/?cat=7&#8217;
    );

    foreach ($custom_link as $page_id => $link) {
    if ( get_permalink($page_id) == $original_link )
    return $link;
    }

    //if no custom title is defined for the current page id, return original
    return $original_link;
    }

    add_filter(‘tc_category_archive_title’ , ‘my_cat_title’);
    function my_cat_title($title) {
    return ‘My archives title for : ‘;
    }

Viewing 7 replies - 1 through 7 (of 7 total)
  • Looks like this CSS code will block the rest from working:

    /**
    * My Custom Functions
    */

    Start each line with // if you want to add comments.

    Try that first and come back.

    I presume you’ve read this

    I think that in the first function, you need to make sure that the page numbers (2 and 9 in the code above) correspond to the page numbers that you originally assigned as featured pages.

    Thread Starter rotoblueprint

    (@rotoblueprint)

    @rdellconsulting I have read that and come across quite a few of yours and EFs comments….super helpful! That said, I am still having a problem seeing results from changes I’ve made in functions.php.

    My steps so far, I have created the folder customizr-child….all I have in it is the style.css file with no added code and the functions.php file (which I have to keep deleting when my website goes white). I have uploaded through FTP software and through the C Panel to see if it makes a difference. Unfortunately, nothing. I feel like I am missing something sort of major.

    I am attempting to have the featured pages link to categories…here’s what I have

    <?php
    
    add_filter('tc_fp_link_url' , 'my_custom_fp_links', 10 ,2);
    function my_custom_fp_links( $original_link , $fp_id ) {
    
        //assigns a custom link by page id
        $custom_link = array(
            //page id => 'Custom link'
            101 => 'https://www.rotoblueprint.com/?cat=5',
            93 => 'https://www.rotoblueprint.com/?cat=7'
        );
    
        foreach ($custom_link as $page_id => $link) {
            if ( get_permalink($page_id) == $original_link )
                return $link;
        }

    @electricfeet…I changed to the 101 and 93 because those where the page=ids that corresponded with the pages they link to in the them customization. Is my mind in the right place on that?

    Is there a very simple “function” you would recommend I try. Something that I could put in the function.php file and would most certainly work and if it doesnt I am doing something majorly wrong.

    Crazy in dept to both you guys. I read your comments EVERYWHERE and some are a decade old! Thank you!

    OK, take out everything in functions.php except the <?php and add this:

    add_filter('tc_logo_text_display', 'your_logo_display');
    add_filter('tc_logo_img_display', 'your_logo_display');
    function your_logo_display($output) {
    return str_replace('brand span3', 'brand span10 offset1', $output, -1);
    }

    It should simply center your logo.

    Tell us what the effect of doing this is.

    Thread Starter rotoblueprint

    (@rotoblueprint)

    I simply copied and pasted below <?php …white screen:(

    I tried to upload through Cyberduck and then tried doing it through the editor in WP.

    The only time it seems I dont get a white screen is when the function.php file only has:

    <?php

    I am doing something very wrong.

    I am doing something very wrong.

    Yup ??

    In the code above, you’ve missed off the last 2 lines (3 if you include the comment) of the function that you got from this snippet.

    Those lines are vital because:

    – Without the return $original_link; the filter would break when you tried to go to a featured page link that you hadn’t reassigned
    – Without the final closing }, php throws a hissy fit, as it always does when you aren’t anal about syntax. The format should give you a clue, as properly formatted code will have a } at the same indent level as the function() call—they line up nicely.

    So in your case, the full php file should look like this:

    <?php
    
    add_filter('tc_fp_link_url' , 'my_custom_fp_links', 10 ,2);
    function my_custom_fp_links( $original_link , $fp_id ) {
    
        //assigns a custom link by page id
        $custom_link = array(
            //page id => 'Custom link'
            101 => 'https://www.rotoblueprint.com/category/batters-eye/',
            93 => 'https://www.rotoblueprint.com/category/commissioner-tools/'
        );
    
        foreach ($custom_link as $page_id => $link) {
            if ( get_permalink($page_id) == $original_link )
                return $link;
        }
    
        //if no custom title is defined for the current page id, return original
        return $original_link;
    }

    Thread Starter rotoblueprint

    (@rotoblueprint)

    Oh. My. Goodness. I know my problem are FAR from over, but that just did something. I dont know why

    add_filter('tc_logo_text_display', 'your_logo_display');
    add_filter('tc_logo_img_display', 'your_logo_display');
    function your_logo_display($output) {
    return str_replace('brand span3', 'brand span10 offset1', $output, -1);
    }

    Didnt work, but that just did something.

    Thank you both again.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘So close…functions.php…just a little more help’ is closed to new replies.