• Resolved strudwicke

    (@strudwicke)


    I am setting up a new site.
    The site has a one column no side bar template.
    I have made a few mods to the css and header.php, to relocate the menu, and alter text appearance. (Child theme)

    I would like to use a sidebar on one or two of my pages.
    I am a beginner at php, and google has not been my friend.
    Most google search results refer to using a copy of page.php edited to create a new template, but that doesn’t seem to be applicable with this theme.

    Where should I start, to create a new template. I am happy to experiment, so even a few tips would be better than nothing. Cheers

Viewing 4 replies - 1 through 4 (of 4 total)
  • sprytechies_kedar_jangir

    (@sprytechies_kedar_jangir)

    create custom template and include it in your newly created page.

    Thread Starter strudwicke

    (@strudwicke)

    Thanks for replying, but I realise that a new template is needed. If I could already just create a new template, I wouldn’t be seeking help.
    My query was asking how do I create a new template which uses one of the other layouts that are in the Pilcrow theme.
    Searching google has just suggested copying the page.php file to the child directory and editing, but there is nothing in the page.php file that determines the column layout.

    cheers

    sprytechies_kedar_jangir

    (@sprytechies_kedar_jangir)

    sidebar should be showed on the page, because sidebar showed from the sidebar.php file of the parent theme but it does not show up that means either you create the main template file called index.php file in you child theme where you didnot use the function get_sidebar(); then you did not activate the widget on the this sidebar area called primary whatever it is.what file you created in you child theme.

    I would like to use a sidebar on one or two of my pages.

    Because Pilcrow’s layouts are set using theme options – and not page templates – it’s not possible to simply copy an existing template file into your child theme.

    Sidebar.php is a bit special as it controls the layout, as you can see at the top of the file:

    /* If the current layout is no-sidebar, let's just get out of here.
     * If the current layout is a 3-column one with 2 sidebars on the right or left
     * Pilcrow enables a "Feature Widget Area" that should span both sidebar columns
     * and adds a containing div around the main sidebars for the content-sidebar-sidebar
     * and sidebar-sidebar-layouts so the layout holds together with a short content area and long featured widget area
     */
    $options = pilcrow_get_theme_options();
    
    if ( 'no-sidebar' == $options['theme_layout'] )
    	return;
    
    $feature_widget_area_layouts = array( 'content-sidebar-sidebar', 'sidebar-sidebar-content' );
    if ( in_array( $options['theme_layout'], $feature_widget_area_layouts ) ) :
    ?>

    What you can do to get around this is create your own custom template based on page.php.

    In your new template, call in a new sidebar that you’ll create instead of the default one. In your new sidebar, you’ll remove all the conditions referring to different layouts, creating a much simpler sidebar file.

    So instead of

    get_sidebar();

    You may have something like

    get_sidebar('custom');

    Name your new sidebar file sidebar-custom.php.

    Of course you can use whatever file names you like.

    I hope this helps point you in the right direction. Let me know how it goes.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding a custom template for just one page’ is closed to new replies.