- This topic has 4 replies, 3 voices, and was last updated 7 years, 6 months ago by .
- The topic ‘How and where to change genesis file : "featured-post-widget.php" ?’ is closed to new replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
Tagged: featured posts widget
Hi and thanks a lot for this very helpfull forum,
I'd like to change something in the genesis file featured-post-widget.php.
(I just want to add my custom posts)
But how can I change it without breaking the original one ?
I tried to make a copy (custom-widget-feature.php) for my child-theme, but when I include it into my functions.php with the instruction :
require_once( GENESIS_WIDGETS_DIR . '/lib/custom-widget-feature.php' ); I get a mistake...
Thanks for your help.
Copying the widget is the right thing to do. You don't ever want to change a file delivered with the Genesis Framework because when Genesis gets updated you'll lose all of your customizations.
You didn't mention the error, but I'll bet it has something to do with duplicate declarations or something along those lines. When you copy a widget, you need to change a few things before you can use it. You need to make sure you've changed the class name in the new widget. Change class Genesis_Featured_Post extends WP_Widget to class Custom_Widget_Feature extends WP_Widget. There may be other things that need to be renamed, but without seeing the errors, I can't tell you.
Always so reagent, thank you !!
Difficult to identify the error (php error at first, and now blank page with the Custom_Widget_Feature)
I fear It becames too hard for me to create a custom widget, and above all, I'm not sure anymore that a widget is the best way to do what I want.
Thanks again for your help and sorry for the trouble
Oh yeahhh, a second musketeer !
Great, I will carefully follow your guide.
Thanks a lot
© 2023 WPEngine, Inc.