How can we help?

If you are looking for support for our PokaTheme, this is the place!

Home Forums PokaTheme support Adding a new customizer option in Review Style

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #17219

    Hi there!

    I’m using Pokatheme 4.03 with a child theme.

    I would like to add a new option “Review style4” in the Review style dropdown in Customizer > Visual Settings > Review > Review Style.

    (I already created the corresponding new style tempalte in /inc/templates/affiliates/affiliates-single-style4.php – that part is OK)

    I thought adding the following code in child’s functions.php would suffice to replace the existing dropdown by a new one with the 4th option appended at the end of the array,
    but it doesn’t work: the dropdown still only display the 3 style options, not the last.

    function new_customizer_settings($wp_customize) {

    $wp_customize->add_control(
    new WP_Customize_Control(
    $wp_customize,
    ‘general-review-style-control’,
    array(
    ‘label’ => __( ‘Review style’, ‘poka’ ),
    ‘section’ => ‘visual-reviews-section’,
    ‘settings’ => ‘general-review-style’,
    ‘type’ => ‘select’,
    ‘choices’ => array(
    ‘style1’ => ‘Review style1’,
    ‘style2’ => ‘Review style2’,
    ‘style3’ => ‘Review style3’,
    ‘style4’ => ‘Review style4 (NEW)’ // added this line
    ),
    )
    )
    );
    }
    add_action(‘customize_register’, ‘new_customizer_settings’);

    What am I doing wrong here?

    thanks!

    #17224

    Looks like it’s not the way to do it.

    How should I override Poka_Customizer class in order to alter simply that Review Styles drop down?

    Any other way / ideas to achieve this?

    thanks for assistance!

    #17253
    admin
    Keymaster

    Hi Jean,

    I’m sorry for the late reply!
    Currently there is no way to alter the options of this dropdown.
    We will add a new filter in the next version in order to have the ability to change these options from your child theme.

    #17256

    HI,

    ok, got it, thanks for letting me know 🙂

    #17345
    admin
    Keymaster

    Hi Jean,

    We added this feature in PokaTheme v.4.0.4

    Update the theme and then you can use the filters “poka_general_review_style” and “poka_review_template_style”.

    Check the codes you can add to your child theme’s functions.php (or in some custom plugin etc.)

    Example function for the Customizer general setting:

    add_filter( 'poka_general_review_style', 'poka_child_6374b50e3c694' );
    function poka_child_6374b50e3c694( $review_styles ) {
    	return array(
    		'style1' => 'Review style1',
    		'style2' => 'Review style2',
    		'style3' => 'Review style3',
    		'style4' => 'Review style4',
    		'style5' => 'Review style5',
    	);
    }
    

    Example function for the Review specific setting:

    add_filter( 'poka_review_template_style', 'poka_child_6374ba89b94a7' );
    function poka_child_6374ba89b94a7( $review_styles ) {
    	return array(
    		'default' => 'Default',
    		'style1'  => 'Review Style 1',
    		'style2'  => 'Review Style 2',
    		'style3'  => 'Review Style 3',
    		'style4'  => 'Review Style 4',
    		'style5'  => 'Review Style 5',
    	);
    }
    
    #17367

    HI!
    thank you for the follow up, really appreciate it.

    I might have an issue:

    – I upgraded pokatheme to 4.04
    – I left pokatheme_child unchanged (this is my active them)
    – I have added the code snippet:
    add_filter( ‘poka_general_review_style’, ‘poka_general_review_style_gsh’ );
    function poka_general_review_style_gsh( $review_styles ) {
    return array(
    ‘style1’ => ‘Review style1’,
    ‘style2’ => ‘Review style2’,
    ‘style3’ => ‘Review style3’,
    ‘style4’ => ‘Review style4’, // added fourth custom style
    );
    }
    – I have added a “affiliates-single-style4.php” file in folder child theme “\inc\templates\affiliates”
    – Now I can see the 4th style in the Customizer dropdown, but, whichever of the 4 available review style I select, it renders as the Review Style 1.

    Any clue wat I’m doing wrong here? A missing steps?

    thanks!

    #17368
    admin
    Keymaster

    Hi Jean!

    I created a new Review and, following step by step what you wrote, I see it’s showing up using the new custom style. So there must be some small detail we’re missing here.

    If you go to Dashboard > Reviews, find the Review you want and click on its “Edit”, what option did you choose under “Review Template Style”? It should be “Default”.

    #17369

    Hey!

    Ah! interesting…! Indeed, my review Template Style was not on Default but on Review Style 1, that’s why it kept overriding the general settings.

    All good now!

    thanks 🙂

    #17370
    admin
    Keymaster

    Perfect!

    For new Reviews, by default the “Default” option should be the active one, so it will always respect the Customizer setting.

    Feel free to reach out again for anything you may need!

    • This reply was modified 2 months, 1 week ago by admin.
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.