Support » Theme: Atlast Business » How to add more projects?

  • Resolved arielyyy

    (@arielyyy)


    I use projects part in home page as a place to demonstrate my products. The default space is only 4 projects, but I want to add more space. The customizer doesn’t support it. I would like to know how to do it in code (which files, where to find it).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Archimidis Mertzanos

    (@archimidism)

    Hello dear @arielyyy
    I will send you a message in the next few hours!
    Thanks a lot for your understanding.

    PS: Do you like this theme? If yes you could rate it as well!

    Hi @archimidism,

    I would love to give a rate to this theme.
    I look forward to the solution toward this issue.

    Theme Author Archimidis Mertzanos

    (@archimidism)

    Dear @arielyyy thanks a lot for the review!!
    Well, you have to add some code in order to add more projects.

    The projects are actually pages. So you have to do 2 things.

    1. Create the corresponding settings to the customizer
    2. Show the projects in the corresponding section.

    === Adding new projects/ customizer settings ===
    Go to the theme folder and find the following:

    theme-init > init.php
    And find the following comment.
    /*============================================================*/
    /** Home Projects area */
    /*=============================================================*/

    Then you have to add the customizer controls and settings.

     $wp_customize->add_control($prefix . '_projects_section_page_5', array(
                'type' => 'dropdown-pages',
                'priority' => 15,
                'section' => $prefix . '_home_projects_section',
                'label' => esc_html__('Select the fifth project', 'atlast-business'),
            ));
     $wp_customize->add_setting($prefix . '_projects_section_page_5', array(
                'default' => '',
                'capability' => 'edit_theme_options',
                'sanitize_callback' => 'atlast_business_sanitize_dropdown_pages',
            ));

    You can add whatever number of projects. Be careful about this variable:
    ‘_projects_section_page_{your_number}’

    === Editing the frontpage template ===

    After you add the controls and their corresponding settings you should find the following file in the theme directory.

    theme-init > init.php (it is the same as the above ) and find the following function

    if (!function_exists('atlast_business_show_projects')):
        function atlast_business_show_projects()
        {
    
            $prefix = atlast_business_get_prefix();
            $pages = array(); // stores page id to use afterwards
    
            for ($i = 1; $i < 5; $i++) {
    
                $pageID = get_theme_mod($prefix . '_projects_section_page_' . $i, '');
    
                if (absint($pageID)) {
                    $pages[] = $pageID;
                }
            }
    
            return $pages;
        }
    endif;

    You can then change the 5 in the for loop
    for ($i = 1; $i < 5; $i++) to the number of your projects. Be careful that this number should be the sum of your project minus 1.

    If everything is ok, you should now see more projects in the home page.

    ArchimidisM

    Thank You so much. The problem got solved.

    I also want to know how to show gallery in home page gallery section. I already selected a page only has foogallery in gallery section, but nothing show up.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to add more projects?’ is closed to new replies.