Community Forums › Forums › Archived Forums › Design Tips and Tricks › Infinity Pro: Adding custom page with widgets ?
Tagged: custom page, Infinity Pro, widgets
- This topic has 10 replies, 2 voices, and was last updated 8 years ago by
Boblebad.
-
AuthorPosts
-
February 23, 2017 at 2:38 pm #201852
Boblebad
ParticipantHi
Regarding adding a custom page and widgets, do i just add the code for the widgets in the price-page.php(my custom page), functions.php, output.php and customize.php or do i make new files of the last two ?
And regarding the last two output.php and customize.php, if i get it right, then i'll have to make new variables to take care of the images for the Price Page ?
I of course need to alter the CSS where i would like it to be different than the one used on the Front Page.
Is there anything else i need to do besides registering the widgets in
Price Page:function soulmeeting_price_page_widgets() { echo '<h2 class="screen-reader-text">' . __( 'Main Content', 'infinity-pro' ) . '</h2>'; genesis_widget_area( 'price-page-1', array( 'before' => '<div id="price-page-1" class="price-page-1"><div class="image-section widget-area fadeup-effect"><div class="wrap">', 'after' => '</div></div></div>', ) ); }
functions.php:
// Register Price Page widget areas. genesis_register_sidebar( array( 'id' => 'price-page-1', 'name' => __( 'Price Page 1', 'infinity-pro' ), 'description' => __( 'This is the price page 1 section.', 'infinity-pro' ), ) );
And also, if i'm getting this right, i can just reuse the code from the other widgets, i just need to change their names accordingly ?
All the best
CarstenFebruary 26, 2017 at 9:55 am #201998Victor Font
ModeratorRegister the new widget areas in functions.php. Add the code to display them in your new template. Yes, you can reuse code and rename functions accordingly so there's no conflict.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 26, 2017 at 10:05 am #201999Boblebad
ParticipantThank you for your answer Victor 🙂
I tried it and have it working, but am stuck on getting the background images showing. Everything seams right, but they are not showing up ?
February 26, 2017 at 11:38 am #202002Victor Font
ModeratorOutput.php only displays the background images on the front page. If you want the background images on another page, you have to change the following conditional to include the new page:
if ( is_front_page() ) { $css .= ( ! empty( $section ) && ! empty( $background ) ) ? sprintf( '.front-page-%s { %s }', $section, $background ) : ''; }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 26, 2017 at 12:29 pm #202019Boblebad
ParticipantThank you again Victor 🙂
By that, do you mean that i can add another line in the file or do i have to create another file for my custom page ?
February 26, 2017 at 12:39 pm #202020Boblebad
ParticipantI found out that i tried editing that file before, but i forgot an instance in it. But it gives me an "Call to undefined function is_price_page()"
I tried changing it to price-page, but that didn't help. I also have changed ".price-page-%s".
February 26, 2017 at 2:27 pm #202025Victor Font
ModeratorUnless you created a function called is_price_page(), there's not such thing. You need to use a WordPress conditional: https://codex.wordpress.org/Conditional_Tags.
Try is_page() with the page number parameter.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 27, 2017 at 1:42 am #202056Boblebad
ParticipantIs "front page" a standard out of the box WordPress function ?
Be course i can only find something like it in front-page.php: "function infinity_front_page_genesis_meta()"
February 27, 2017 at 5:11 am #202066Victor Font
ModeratorLet me refer you again to the codex. It answers your question about WordPress out of the box conditionals. https://codex.wordpress.org/Conditional_Tags.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 27, 2017 at 12:48 pm #202108Boblebad
ParticipantWell, in some way it works, but it doesn't.
I just changed the code from front to price page. The interesting part is that i have only assigned an image to the first widget. That does not show. But in widget two and three, where there's no image assigned, images shows up.
How does that happen ?
February 27, 2017 at 1:30 pm #202109Boblebad
ParticipantIs it possible to split this between the two pages ?:
$images = apply_filters( 'infinity_images', array( '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ) );
Or is it not the problem. The images are just taken from 1 and up, that's the two images used on the price page.
If i understand the theme correctly, then there can only be one output.php and also only one customize.php.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.