How to change the layout of single.php


Hi Folks,

It's the first time i play around with Beans and i like it! Thanx!

I have a question and i hope you can help me. I setup the child theme and now i want the change teh post layout. Normally i would change the single.php. How is this done with Beans?

Anyhelp would be great!

Grtz, Martijn



Hi Martijn 3001,

You are right about creating single.php. There are two ways to customize single.php:

A more advanced way, using the Beans API:

/*
 * Single.php
 */

function my_post_title() {
  echo 'something';
}

// Beans API functions:
beans_modify_action_callback( 'beans_post_title', 'my_post_title' );

beans_add_attribute( /* some parameters */ );
beans_remove_markup( /* some parameters */ );
// etc...

// At the end of the file.
beans_load_document();

Or the classic way, as you used before:

/*
 * Single.php
 */

// customizations.
function my_post_title() {
    echo 'something';
}

// document.
get_header();

 // Maybe call the pre-build functions from `tm-beans\lib\templates\fragments\`:
 beans_breadcrumb();
    my_post_title(); // custom title.
    beans_post_meta();
    beans_post_image();
    beans_post_content();
    // etc...;

    // the sidebars are hooked into `get_header()`, so, no need to call them here.

get_footer();

Hi Dee & Joseph,

Thank you very much for replying and helping me with examples! It helps me a lot while finding my way through the Beans Frameswork! Your help is greatly appreciated and helps me to go on.

I really like the advanced way using the Beans API.

Grtz, Martijn

Write a reply

Login or register to write a reply, it's free!