WordPress.org

Ready to get started?Download WordPress

Forums

Oxygen
[resolved] Custom page (8 posts)

  1. makapa
    Member
    Posted 1 year ago #

    Hello,

    I need your help creating a custom page template with just the left sidebar (the secondary menu & primary sidebar) and the content. Since it's a standalone custom page I won't be needing to make a child theme.

    Can you help me? A hint or some other materials to read would be helpful also.

    What I already did.
    Because I'm a beginner I started reading the codex section for making a custom page and then proceeded: I took the Full Width template page/php file included in the theme but when I edited the file and included a div area with the left sidebar it actually reverted to a default page - thus including the right sidebar as well. I tinkered with code to the best of my close-to-0 abilities but did not manage to make it work.

    Thanks

  2. mybdbis
    Member
    Posted 1 year ago #

    Still you need to create the Child Theme.

    http://codex.wordpress.org/Child_Themes

  3. makapa
    Member
    Posted 1 year ago #

    You're right.

    I'll put some hours tomorrow in it and make it work. I'll comeback to mark the topic as resolved after I'll solve it.

    Thanks

  4. makapa
    Member
    Posted 1 year ago #

    Hi,

    Still haven't solved it.

    What I did (maybe I missed something)
    1. Did a child theme
    2. Made the template page (situated in the child theme folder)
    3. Made a functions file in the child theme folder with a function that has a simple if: if page template = mine then disable right sidebar

    The function I used is an edited copy of the function from the parent theme that removes the sidebars if the template is a full width page.

    Any help is appreciated. 10x

  5. makapa
    Member
    Posted 1 year ago #

    Solved it. Forgot to add the filter in child's function.php

    Thanks mybdbis for the help.

  6. mybdbis
    Member
    Posted 1 year ago #

    Its you who actually solve the problem, and glad you make it.

    All the best!!

  7. makapa
    Member
    Posted 10 months ago #

    @gabrielsolomon7

    after I created the page template I added this function in my functions.php (file in the child theme)

    add_filter( 'sidebars_widgets', 'oxygen_disable_sidebar_right' );
    
    function oxygen_disable_sidebar_right( $sidebars_widgets ) {
    
    	global $wp_query;
    
    	    if ( is_page_template( 'page-template-produse.php') ) {
    		   	$sidebars_widgets['secondary'] = false;
    	    }
    
    	return $sidebars_widgets;
    }
    
    	add_action( 'sidebar_widgets', 'oxygen_disable_sidebar_right', 11 );
  8. gabrielsolomon7
    Member
    Posted 10 months ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic