Support » Theme: Customizr » 6 featured pages with images on front page

  • Resolved ashu8000

    (@ashu8000)


    How do I create 6 featured pages with cicular images on front page without damaging website? Can I make changes in admin customize file of parent theme. Can I copy everything in class content featured page file from parent to child theme and then edit the child theme file. Please guide

Viewing 15 replies - 1 through 15 (of 33 total)
  • Josiah

    (@josiahboyd)

    I would recommend not ever adjusting the parent theme if you can help it because the next update could override all of your home page changes.

    You will definitely need to adjust the home page php file so that it can pull in the six featured post.

    ashu8000

    (@ashu8000)

    Thanks but please guide me how to create 6 featured pages in child theme without touching parent theme files.

    Josiah

    (@josiahboyd)

    Basically you will create an index.php file and then alter your widgets area so that it will have 6 featured pages.

    this is a pretty intense modification, but can be done. You are basically duplicating the homepage widgets and then allowing for more featured posts.

    acub

    (@acub)

    @josiah: He needs to create a home.php template file, not index.php.

    ashu8000

    (@ashu8000)

    @acub: I an new to this field. Could you tell me what to write in home.php template file for 6 featured pages with circular images on front page. I was sucessful in creating 6 featured pages on front page but after that lost access to admin panel but site was visible and working fine.I created class-content-featured_pages.php in child theme and then modified it and made changes in admin_customize.php of parent theme also.But something was not correct becoz after that lost access to admin panel.Restored to original theme settings and want to create 6 featured pages with accesss to admin panel.

    acub

    (@acub)

    If you want to be able to edit all 6 pages at any time, it’s a bit complicated. You need to rewrite some core functions and register some additional fields for it. However, there is a workaround but, once you set pages 1, 2 and 3 it’s going to be a bit more complicated to change them, if you want others in their place.
    Here’s the solution: put pages 1, 2 and 3 in your featured pages. Go to front page and select “View page source” from your browser of choice and select all the contents of <div class=”container marketing”>. Only the contents, not the div itself.
    Save this somewhere, in a notepad or something.
    Add this function in your child themes’ functions.php:

    add_filter('tc_fp_block_display', 'add_extra_fp');
    function add_extra_fp($html) {
    $extra_fp_html = '';
    /* Copy-paste the html saved before in $extra_fp_html on the line above
     * between the single quotes. Make sure you escape any single quote
     * from that code, using a backslash (Example: Hell\'s kitchen)
    */
    return preg_replace('/'.preg_quote('<div class="container marketing">', '/').'/', '<div class="container marketing">'.$extra_fp_html, $html, -1);
    }

    It should do the trick. Now when you change your featured pages you will change featured pages 4, 5 and 6.
    If you want to change 1, 2 or 3, you either need to set them back and re-copy/paste the page source in the function. Or you could just edit the contents of the function if the change is easy to find.

    There is an option to do it in such a way that all 6 options remain editable but, since you don’t have the skills to do that, I suppose you have to find someone who has and convince that person to use them for you. The theme author is probably your best bet.

    ashu8000

    (@ashu8000)

    @acub: Thanks! I did copy that code in function.php of child theme along with all the contents of <div class=”container marketing”>. But nothing happened. I have to create 6 featured circle on front page.Is there any other way to do so?

    ashu8000

    (@ashu8000)

    @nikeo: How do I create 6 featured pages in child theme?

    acub

    (@acub)

    If:

    • you have put the function inside functions.php of your child theme,
    • your child theme’s functions.php is not a modified copy of it’s parent counterpart (read on how to add child themes if unsure),
    • your child theme is the active theme
    • you have put the html contents of div.container.marketing in between the backticks from line 3 in that php code above (in $extra_fp_html variable)
    • and your html doesn’t contain any unescaped backtick…

    …it should work.

    At this point it’s quite clear to me you have set out to modify this theme way beyond your coding skills. I have given you all the elements to achieve your goal, yet you missed some detail. I’d try again if I were you.

    Trust me, the function works. Just tested it here, to make sure: http://customizr.websiter.ro.

    ashu8000

    (@ashu8000)

    @acub:Thanks a million! I am not from computer back ground that’s why find it bit tough but not going to give up. I know how to create child theme and for sure child theme is active. May be missed something while doing copy paste. I did create function.php file in child theme. Do I need to copy everything from parent function.php to child function.php then need to add that code?

    acub

    (@acub)

    No! And it’s not function.php, it’s functions.php. This might be the reason why your functions.php wasn’t read. Because it didn’t exist. You created function.php instead.

    The important things about functions.php of you child theme are that:
    1. It has to have <?php on first line and ?> on last. So, an empty one would look like this:

    <?php
    
    ?>

    2. It shouldn’t have any function contained in parent file, with the exception of pluggable functions, which is of no interest to us here.

    Just put the code inside those lines and save it as functions.php. And upload. And you’re done.

    ashu8000

    (@ashu8000)

    Thanks Acub. I followed all your instructions but couldn’t do it. Do I need to make change add something in home.php or class-content-featured_page.php. What do you mean by “Now when you change your featured pages you will change featured pages 4, 5 and 6”. Then I tried to add four, five and six in class-content-featured_pages.php of parent theme. Result was 6 featured pages but these 3 pages were not there in “customize it” and I want to add four,five and six to class-content-featured_pages.php of the child not in parent php.

    acub

    (@acub)

    Please provide a link to your website.

    robkiewiet

    (@robkiewiet)

    Hi,

    I just want to add 1 featured page so the total would be 4.

    Is there an easier way to do that?

    ashu8000

    (@ashu8000)

    @acub: Link is here.

Viewing 15 replies - 1 through 15 (of 33 total)
  • The topic ‘6 featured pages with images on front page’ is closed to new replies.