• Resolved hamimdev

    (@hamimdev)


    Hello,

    I have followed the instructions on this page. https://github.com/cabrerahector/wordpress-popular-posts/wiki/6.-Styling-the-list

    However, I am unable to see my custom theme in the dropdown list of the widget.

    I copied the theme folder into the currently active WP theme folder and used the following function in the functions.php

    /**
     * Registers my WPP theme.
     *
     * @param   array   $themes
     * @return  array
     */
    function register_my_wpp_theme($themes){
        // Absolute path to the theme
        $themes = get_template_directory() . '/wpp_hamim';
        return $themes;
    }
    add_filter('wpp_additional_themes', 'register_my_wpp_theme');
    • This topic was modified 4 years, 11 months ago by hamimdev.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @hamimdev,

    Your function has to return an array. It’s returning a string instead (the path to your theme).

    Please change:

    $themes =

    into:

    $themes[] =

    and check again.

    Thread Starter hamimdev

    (@hamimdev)

    Thanks a lot for the quick response. I have made the themes variable an array but the result is still the same.

    /**
     * Registers my WPP theme.
     *
     * @param   array   $themes
     * @return  array
     */
    function register_my_wpp_theme($themes){
        // Absolute path to the theme
        $themes[] = get_template_directory() . 'wpp_hamim';
        return $themes;
    }
    add_filter('wpp_additional_themes', 'register_my_wpp_theme');

    I have double checked the folder in the root theme directory and it is named as wpp_hamim and it contains two files. config.json and style.css. These are direct copies from Midnight theme and modified a little bit to change the color. That’s all.

    • This reply was modified 4 years, 11 months ago by hamimdev.
    Thread Starter hamimdev

    (@hamimdev)

    OK. I finally figured it out. Evidently get_template_directory does not return a forward-slash. I added a forwardslash in front of the folder name as /wpp_hamim and the theme shows up in the widget menu now. Thanks again.

    Plugin Author Hector Cabrera

    (@hcabrera)

    No problem, glad you were able to sort it out!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom theme not visible’ is closed to new replies.