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: customizer
- This topic has 8 replies, 2 voices, and was last updated 1 year, 5 months ago by admin.
-
AuthorPosts
-
August 19, 2022 at 8:37 pm #17219Jean-Sebastien GerardParticipant
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!
- This topic was modified 1 year, 8 months ago by Jean-Sebastien Gerard.
August 22, 2022 at 10:42 pm #17224Jean-Sebastien GerardParticipantLooks 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!
September 16, 2022 at 10:19 am #17253adminKeymasterHi 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.September 20, 2022 at 12:15 am #17256Jean-Sebastien GerardParticipantHI,
ok, got it, thanks for letting me know 🙂
November 16, 2022 at 3:39 pm #17345adminKeymasterHi 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', ); }
November 21, 2022 at 9:13 pm #17367Jean-Sebastien GerardParticipantHI!
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!
November 22, 2022 at 10:43 am #17368adminKeymasterHi 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”.
November 22, 2022 at 11:00 am #17369Jean-Sebastien GerardParticipantHey!
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 🙂
November 22, 2022 at 11:04 am #17370 -
AuthorPosts
- You must be logged in to reply to this topic.