Featured pages in Customizr – how to change their number and disposition

A few days ago we posted a tutorial on how to add your own custom colors scheme to the Customizr theme, without interfering with the built-in ones.

Let’s add another step towards full customization, by changing the number of featured pages on the home page.

How to change the number of featured pages on the home page

Let’s address today another topic of interest modifying how many featured pages to display on the home page of your site.


Here are the steps to follow:


 

Step 1. – Create and activate a Customizr child theme, if you have not done so previously

If you need guidance on how to do this, please refer to our brief tutorial right here.

Step 2 – Create the necessary structure in the child theme folder

If you have not already done so, create in the wp-content/themes/customizr-child folder a subdirectory named inc, and a subfolder parts to this one, so that you get wp-content/themes/customizr-child/inc/parts/.

Step 3. – Add the necessary files in the child theme.

Reminder: all the files in the child theme bearing the same name as files in the parent theme replace the latter. So let us copy the needed files from the parent theme and paste them in the child theme, where we shall modify them to suit our needs.

wp-content/themes/customizr/inc/class-fire-init.php -> wp-content/themes/customizr-child/inc/class-fire-init.php

wp-content/themes/customizr/inc/class-fire-utils_settings_map.php -> wp-content/themes/customizr-child/inc/class-fire-utils_settings_map.php

wp-content/themes/customizr/inc/parts/class-content-featured-pages.php -> wp-content/themes/customizr-child/inc/parts/class-content-featured-pages.php

And now we shall no more touch to the parent theme files, all the subsequent actions will be done uniquely in the child theme.

Step 4. – Change the number of featured pages

In the file wp-content/themes/customizr-child/inc/class-fire-init.php, search the string $this -> fp_ids = array( ‘one’ , ‘two’ , ‘three’ ); (it should be about the line #191) and add to the list as many elements as your desired featured pages.

Suppose you want to display 4 instead of 3 pages, that line should be changed to: $this -> fp_ids = array( ‘one’ , ‘two’ , ‘three’ , ‘four’ );

If you need 6 featured pages, then you should change it to: $this -> fp_ids = array( ‘one’ , ‘two’ , ‘three’ , ‘four’ , ‘five’ , ‘six’ );

Step 5. – How many featured pages per row do you want to display?

In the file wp-content/themes/customizr-child/inc/parts/class-content-featured-pages.php, locate the function tc_fp_block_display() and look for a line that looks like this: $fp_per_row = apply_filters( ‘tc_fp_per_line’, 3 ); (it should be the line #43 or thereabout). Change it to reflect the desired number of featured pages per row.

Let’s suppose you want to have 4 featured pages, all displayed on the same row. Then you should change the line to: $fp_per_row = apply_filters( ‘tc_fp_per_line’, 4 );.

If you want to have 6 featured pages, displayed on two rows, then the line should remain unchanged, reading: $fp_per_row = apply_filters( ‘tc_fp_per_line’, 3 );.

The Modified Customizr Featured Pages options panel

The modified Customizr Featured Pages options panel

Step 6 – Update the options panel

Now we need to update the options panel (Appearance/ Customize/…/ FEATURED PAGES OPTIONS) so that we can setup the supplementary featured pages.

In the file wp-content/themes/customizr-child/inc/class-fire-utils_settings_map.php, locate the function private function tc_generates_featured_pages() (about line #46) and, for each featured page, add a line in the dropdown array and another one in the text array.

The lines added in the dropdown array will display, for each featured page, a drop-down list of the existing pages, to select the appropriate one; those in the text array will render a textarea to input a description of the featured page, if desired.

As an example, here is what you should have if you want 4 featured pages:

private function tc_generates_featured_pages() {
$default = array(
  'dropdown'  =>  array(
    'one'   => __('Home featured page one', 'customizr'),
    'two'   => __('Home featured page two', 'customizr'),
    'three' => __('Home featured page three', 'customizr'),
    'four' => __('Home featured page four', 'customizr')
  ),
  'text'    => array(
    'one'   => __('Featured text one (200 car. max)', 'customizr'),
    'two'   => __('Featured text two (200 car. max)', 'customizr'),
    'three' => __('Featured text three (200 car. max)', 'customizr'),
    'four' => __('Featured text four (200 car. max)', 'customizr')
  )
);
...

19 Comments

  1. Avatar
    06 Sep 2015 at 2:08 PM · Reply

    Hey there, thanks for this article. It really helps, but only one thing isn’t working – i cant get the text for pages 4-6 to display. Even though i have added to the ‘dropdown’ and ‘text’ arrays, when i add text into the box, it does not update/display the text in the page. For pages 1-3 it is fine, i can add my custom text, but 4-6 does not want to work.

    Any thoughts as to why the text will not show?

    • Avatar
      06 Sep 2015 at 2:20 PM · Reply

      Okay, hold up! I’m an idiot!! 😛

      When typing in the text box for FP(featured pages) 4-6, it does not update while you’re typing as it does for FP 1-3. Once i actually save and publish and then view the page, it does display the text for FP 4-6.

      Thanks again for this great article, it is easy to understand and implement.

  2. Avatar
    Henning
    08 Dec 2015 at 3:37 PM · Reply

    hi,
    thanks for your effort. definitely an option i want to use.
    I did it as you explained it, but since then i m getting a server error and cant access neither the page nor the wordpress-admin as well until i delete the theme in filezilla.
    the only thing i did extra which you didnt describe:

    while copying in step 3 i created the folder “parts” for the child theme as i have to copy it from the customizr to the customizr-child… but i guess that’s right, or?

    maybe you ve got an idea?
    cheers!
    henning

    • Manuela Kherouf
      08 Dec 2015 at 4:18 PM · Reply

      Hi,

      Yes, creating the “wp-content/themes/customizr-child/inc/parts/” folder definitely was the right thing to do. I can’t think why you get that severe error… could it be a spelling error somewhere? In a folder name, file name or in the manually input text?

      Try to trap the error with the WordPress debugger, maybe the error log could help you locate it. To do so, use the steps described in the Codex or in this article.

      Good luck and, when you find it, please come back to share with us the cause of the error.
      Manuela

  3. Avatar
    Henning
    08 Dec 2015 at 4:17 PM · Reply

    FORGET IT…WORKED….!!! when i left out step 5..was my plan anyway,,,,.thank you!

  4. Avatar
    Henning
    09 Dec 2015 at 8:34 AM · Reply

    Ok, here the summary of what went wrong.

    It seems as when you don’t want to change anything in step 5 (you want to have the standard 3 featured pages in a row) you shouldn’t
    copy the php-file wp-content/themes/customizr-child/inc/parts/class-content-featured-pages.php into the child theme and dont create the subdirectory “parts”.

    when I followed step by step (creating “parts” and copying the php file) but didnt do any adjustments in Step 5, I couldnt access my page anymore.

    now everything’s fine (http://www.thehorizonisourhome.de/): the site is not finished, but there are 6 featured pages on the front page 🙂

    maybe this helps if others have the same problem.

    thx again for this useful adjustment-manual, manuela!

    henning

    • Manuela Kherouf
      09 Dec 2015 at 9:02 AM · Reply

      Thank you for taking the time to share your conclusions, I’ll make a few changes to the code, so that this error doesn’t occur anymore.

      Have a great day!
      Manuela

  5. Pingback: Broken site after Customizr theme update: how to fix it > CI MediaCI Media

  6. Avatar
    Юрий
    11 Apr 2016 at 8:38 PM · Reply

    Thank you very much!!!!! I tried to add 4 – four, get !!!!!! Sorry for my English

    • Manuela Kherouf
      11 Apr 2016 at 9:07 PM · Reply

      That’s great, I’m so glad my post was useful to you. Cheers!

  7. Avatar
    08 Feb 2017 at 5:47 PM · Reply

    Hi!
    I used this tutorial to change the featured pages in an older version of the theme successfully,
    but since the update of the parent theme (in the old version the editor crashed), the additional featured pages in my child theme are gone.

    I took a look in the parent theme:
    It seems as if the whole /inc-folder and the several class-fire_xxxx.php-files have been moved to /core.
    I tried it myself by adjusting here and there in the child thme but I am somehow not able to get my six featured pages back.
    Do you have any advice where & what I have to do in the child-theme in the actual parent theme (3.5)

    Thanks in advance!
    Henning

    • Manuela Kherouf
      08 Feb 2017 at 6:16 PM · Reply

      Hi Henning,

      There definitely were deep changes in the Customizr theme, so that the steps in this article don’t have the intended effect anymore. This is not only about moving files to other locations, but also about significant code changes. Given time (which I don’t have right now), one could manage to locate and fix the glitch, but that is not the point. The real problem is that even if a solution were found, it would not be a reliable one. The theme author admitted himself that this was not a standard theme, and its evolution over time showed unpredictable changes. No one can tell what’s next, and whether a customization implemented by a user at version [n.1] will still work at version [n.2].

      That leaves the user with 3 choices: 1) use the free Customizr theme as-is, 2) buy the Pro version with the associated plugins allowing some more customization or 3) move on to another WP theme.

  8. Avatar
    Edin Foric
    12 Feb 2017 at 1:27 PM · Reply

    Hi, can I make changes on the main files, do I need too create a child theme? Can I skip those steps?

    • Manuela Kherouf
      12 Feb 2017 at 1:54 PM · Reply

      Hello,

      Any changes you make on the main files will work, but you’ll lose them at the next theme update (an update overwrites all the previous version files). This is why it is always recommended to use child themes.

      Before you proceed though, you might want to consider the remarks in my reply to Henning’s comment above, concerning the reliability of user changes of the Customizr theme.

  9. Avatar
    Michael Weber
    13 Sep 2017 at 3:30 PM · Reply

    Hoi,

    i really appreciate the work you have done here. So for Users of the new Theme here is a quick guide:

    Directory /core

    File init-base.php contains the fp_ids Array now around Line 105 ($this -> fp_ids = array(etc etc);
    File core-settings-map.php contains the Options Panel Stuff now. The function is named ‘czr_fn_generates_geatured_pages’ now instead of ‘tc_generates_featured_pages()’

    Directory /inc

    File czr-front-ccat.php at around Line 3607 contains the ‘tc_fp_per_line’ value (3 is default)

    That’s it – apart from the different filenames and functions your guide still works like a charm. Cheers!

    • Manuela Kherouf
      13 Sep 2017 at 3:58 PM · Reply

      Awesome! Thank you for the update, I am sure it will help a lot of users.

      Have a great day!

    • Avatar
      Anja
      31 Aug 2018 at 7:09 PM · Reply

      Hello,

      First of, thank you for this guide.

      I hope my question is not too basic, I am quite new to wordpress. So, I did as you described, found all the files and functions and copied and altered the files in my child theme folder (which I set up with the Child Theme Configurator, to avoid messing things up). Up to this point nothing is visibly messed up about my page, I did not do any other configurations in the child file. I usually solve my smaller problems with local css, but the front page is clean of that, too. However, my child theme seems to simply ignore the changes, because no additional option for a fourth child theme shows up. If I add in the functions.php
      require_once( get_stylesheet_directory() . ‘/core/init-base.php’ );
      require_once( get_stylesheet_directory() . ‘/core/core-settings-map.php’) ;
      require_once( get_stylesheet_directory() . ‘/inc/czr-front-ccat.php’);
      The webpage goes simply blank and I can not even go in the wordpress admin area anymore. This happens if I try to force any combination of the pages, so it seems not to be, that only one of the files causes troubles.

      So the question I can not manage to figure out on my own is where I messed up.

      Best

      Anja

      • Manuela Kherouf
        01 Sep 2018 at 8:26 AM · Reply

        Hello Anja,

        I’m sorry you are experiencing all these problems. As I said in response to previous comments, this is the reason I quit using the Customizr theme – it being a non-standard one with unpredictable changes from one update to the next. From your comment it looks like another substantial change happened, so that even Michael Weber’s update is not working anymore.

        If you are not able to access your wordpress admin area I suggest to delete your child theme via FTP, so that you revert to the basic Customizr and start afresh.

        Good luck!
        Manuela

Leave a Comment

Sitemap

open