Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Colums on Word Press

Featured Replies

Hi All,

 

I'm trying to create 4 small column boxes on my front page for a wordpress website. Each column box would contain an image with small amount of text, also with a button link to take you to a next page.

 

I know HTML and CSS and I know where i want these column boxes etc. I don't know how I could edit each of them.

 

Here is an example on what I'm looking for but they will be smaller. And above will be a bigger box which a slider. CLICK HERE

 

I hope what i said is understandable.

Edited by Vulcan

You can, for instance, use custom fields (or even some plugin like Advanced Custom Fields) as a text containers on the main page.

  • Author

 

Thank you Lev, But I have found a bit of it confusing :-/. I have found this website which is exactly what they want (the people im creating the site for). The four columns next to 'out projects' at the bottom http://static.livede...0895/index.html

Edited by Vulcan

  • Author

http://themeshaper.c...-theme-options/

 

Very easy to use and follow.

 

Thanks,

 

But im not sure what to do with this code where do i add it.

 

<?php
   $options = get_option('sample_theme_options');
   echo $options['sometext'];
?>

register_setting( 'theme_options_options', 'theme_options_sample', 'theme_options_validate' );

 

Also im using the _s theme for this website.

Read the instructions. It tells you where to put the code.

 

You put that first bit of code where you want your boxes to be.

brightonmike - I cant seem to get it working. Where to i create these boxes?

 

If you read the instructions, it walks you through step-by-step exactly what you need to do.

 

Or try Sash's method.

  • Author

I have read the instructions over and over again and I cant work out.

I'll try sash_oo7 link

  • Author

sash_oo7 I'm trying to add the widgets in to its own area. But its coming up with an error :-/.

  • Author

I followed the instructions it told be to copy this code in the functions.php file:

 

function burps_widgets_init() {
register_sidebar( array(
 'name' => __( 'Sidebar', 'burps' ),
 'id' => 'sidebar-1',
 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
 'after_widget' => '</aside>',
 'before_title' => '<h1 class="widget-title">',
 'after_title' => '</h1>',
) );

 

Then change the sidebar name around so i make it like this

 

 

function burps_widgets_init() {
register_project( array(
 'name' => __( 'Project', 'burps' ),
 'id' => 'project-1',
 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
 'after_widget' => '</aside>',
 'before_title' => '<h1 class="widget-title">',
 'after_title' => '</h1>',
) );

 

Once I added that extra bit on line 129 says that there is an error.

This is what's on that line:

 

// Load up our awesome theme options
require_once ( get_stylesheet_directory() . '/theme-options.php' );

why u added this code in functions file?

 

// Load up our awesome theme options
require_once ( get_stylesheet_directory() . '/theme-options.php' );

 

add this to ur functions.php

 

 

function nameofyourtheme_widgets_init() {
 register_sidebar(array(
    'name'=>'Anything, such as Widgets Left',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div></div>',
    'before_title' => '<div class="widget-title"><h3>',
    'after_title' => '</h3></div><div class="widget-content">',
   )) 
   register_sidebar(array(
    'name'=>'Widgets Middle',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div></div>',
    'before_title' => '<div class="widget-title"><h3>',
    'after_title' => '</h3></div><div class="widget-content">',
   )) 
   register_sidebar(array(
    'name'=>'Widgets Right',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div></div>',
    'before_title' => '<div class="widget-title"><h3>',
    'after_title' => '</h3></div><div class="widget-content">',
   ))
}

 

 

can also be

 

 

'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',

 

Those tags in the two existing sidebar setups are there for the sidebar widgets, you can leave them empty or add your own HTML tags. It's pretty self explanatory for what these tags are. before_title means before widget title. Many widgets such as the text widget don't need to have a title so there's also no need to wrap the title into some HTML tags.

 

 

Then put

 

PHP Code:

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(X) ) : endif; ?>

 

wherever you want to have that widget area in the template. Replace X with the number of the widget area. 1 and 2 are already used for the 2 sidebars. If you put another one into functions.php, that would be the third, so you would replace X with 3.

 

To have the widget area only on the front page you'd also wrap it into a conditional statement

 

 

<?php if ( is_front_page() ) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : endif; ?>
<?php } ?>

  • Author

That code was for the one that brightonmine gave and I couldn't get it to work. I have deleted it.

 

I have added that new functions into the functions.php and its coming up with another error. On line 91, 98 ,195

  • Author
<?php
/**
* BURPS functions and definitions
*
* @package BURPS
* @since BURPS 1.0
*/
/**
* Set the content width based on the theme's design and stylesheet.
*
* @since BURPS 1.0
*/
if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */
if ( ! function_exists( 'burps_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* @since BURPS 1.0
*/
function burps_setup() {
/**
 * Custom template tags for this theme.
 */
require( get_template_directory() . '/inc/template-tags.php' );
/**
 * Custom functions that act independently of the theme templates
 */
//require( get_template_directory() . '/inc/tweaks.php' );
/**
 * Custom Theme Options
 */
//require( get_template_directory() . '/inc/theme-options/theme-options.php' );
/**
 * Make theme available for translation
 * Translations can be filed in the /languages/ directory
 * If you're building a theme based on BURPS, use a find and replace
 * to change 'burps' to the name of your theme in all the template files
 */
load_theme_textdomain( 'burps', get_template_directory() . '/languages' );
/**
 * Add default posts and comments RSS feed links to head
 */
add_theme_support( 'automatic-feed-links' );
/**
 * Enable support for Post Thumbnails
 */
add_theme_support( 'post-thumbnails' );
/**
 * This theme uses wp_nav_menu() in one location.
 */
register_nav_menus( array(
 'primary' => __( 'Primary Menu', 'burps' ),
) );
/**
 * Add support for the Aside Post Formats
 */
add_theme_support( 'post-formats', array( 'aside', ) );
}
endif; // burps_setup
add_action( 'after_setup_theme', 'burps_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since BURPS 1.0
*/

function burps_widgets_init() {
 register_sidebar(array(
		    'name'=>'Anything, such as Widgets Left',
		    'before_widget' => '<div id="%1$s" class="widget %2$s">',
		    'after_widget' => '</div></div>',
		    'before_title' => '<div class="widget-title"><h3>',
		    'after_title' => '</h3></div><div class="widget-content">',
    ))
    register_sidebar(array(
		    'name'=>'Widgets Middle',
		    'before_widget' => '<div id="%1$s" class="widget %2$s">',
		    'after_widget' => '</div></div>',
		    'before_title' => '<div class="widget-title"><h3>',
		    'after_title' => '</h3></div><div class="widget-content">',
    ))
    register_sidebar(array(
		    'name'=>'Widgets Right',
		    'before_widget' => '<div id="%1$s" class="widget %2$s">',
		    'after_widget' => '</div></div>',
		    'before_title' => '<div class="widget-title"><h3>',
		    'after_title' => '</h3></div><div class="widget-content">',
    ))
}
add_action( 'widgets_init', 'burps_widgets_init' );
/**
* Enqueue scripts and styles
*/
function burps_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
 wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
 wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
}
add_action( 'wp_enqueue_scripts', 'burps_scripts' );
/**
* Implement the Custom Header feature
*/
//require( get_template_directory() . '/inc/custom-header.php' );

  • Author
<?php
   /**
 * Use this template file as the homepage
 *
 * Template Name: Homepage
 */
get_header(); ?>
<div id="content">
<div class="main-div">
<div class="main-div-1">
 <div class="main-div-2">
   <div class="main-div-3 padd">
	    <div class="container_24">
		   <div class="wrapper">


		    <?php
    $options = get_option('BURPS_theme_options');
    echo $options['sometext'];
?>


	  </div> <!-- wrapper -->	
   </div><!-- container_24 -->		 
   </div> <!-- main-div-3 -->  
  </div><!-- main-div-2 -->
</div><!-- main-div-1 -->
 </div><!-- main-div -->

 <?php if ( is_front_page() ) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : endif; ?>
<?php } ?>

<?php get_footer(); ?>

are u editing an existing theme?

 

i am not sure what extra code snippet u added ?

 

can u post original functions.php before edit?

 

and what error u getting?

 

its not easy to say like this

  • Author

I'm editing from _s theme.

 

Here is the functions.php before I edit.

 

<?php
/**
* burps functions and definitions
*
* @package burps
* @since burps 1.0
*/
/**
* Set the content width based on the theme's design and stylesheet.
*
* @since burps 1.0
*/
if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */
if ( ! function_exists( 'burps_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* @since burps 1.0
*/
function burps_setup() {
/**
 * Custom template tags for this theme.
 */
require( get_template_directory() . '/inc/template-tags.php' );
/**
 * Custom functions that act independently of the theme templates
 */
require( get_template_directory() . '/inc/extras.php' );
/**
 * Custom Theme Options
 */
//require( get_template_directory() . '/inc/theme-options/theme-options.php' );
/**
 * Make theme available for translation
 * Translations can be filed in the /languages/ directory
 * If you're building a theme based on burps, use a find and replace
 * to change 'burps' to the name of your theme in all the template files
 */
load_theme_textdomain( 'burps', get_template_directory() . '/languages' );
/**
 * Add default posts and comments RSS feed links to head
 */
add_theme_support( 'automatic-feed-links' );
/**
 * Enable support for Post Thumbnails
 */
add_theme_support( 'post-thumbnails' );
/**
 * This theme uses wp_nav_menu() in one location.
 */
register_nav_menus( array(
 'primary' => __( 'Primary Menu', 'burps' ),
) );
/**
 * Add support for the Aside Post Formats
 */
add_theme_support( 'post-formats', array( 'aside', ) );
}
endif; // burps_setup
add_action( 'after_setup_theme', 'burps_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since burps 1.0
*/
function burps_widgets_init() {
register_sidebar( array(
 'name' => __( 'Sidebar', 'burps' ),
 'id' => 'sidebar-1',
 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
 'after_widget' => '</aside>',
 'before_title' => '<h1 class="widget-title">',
 'after_title' => '</h1>',
) );
}
add_action( 'widgets_init', 'burps_widgets_init' );
/**
* Enqueue scripts and styles
*/
function burps_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
 wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
 wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
}
add_action( 'wp_enqueue_scripts', 'burps_scripts' );
/**
* Implement the Custom Header feature
*/
//require( get_template_directory() . '/inc/custom-header.php' );

 

The error on the website is: burps\wp-content\themes\burps\functions.php on line 91

and 98 and 105.

The error on the website is: burps\wp-content\themes\burps\functions.php on line 91

and 98 and 105.

 

 

So....what are lines 91, 98 and 105?

  • Author

91 register_sidebar(array(

 

98 register_sidebar(array(

 

105 }

 

When I add this code that sash_oo7 said

 

function nameofyourtheme_widgets_init() {
 register_sidebar(array(
		    'name'=>'Anything, such as Widgets Left',
		    'before_widget' => '<div id="%1$s" class="widget %2$s">',
		    'after_widget' => '</div></div>',
		    'before_title' => '<div class="widget-title"><h3>',
		    'after_title' => '</h3></div><div class="widget-content">',
    ))
    register_sidebar(array(
		    'name'=>'Widgets Middle',
		    'before_widget' => '<div id="%1$s" class="widget %2$s">',
		    'after_widget' => '</div></div>',
		    'before_title' => '<div class="widget-title"><h3>',
		    'after_title' => '</h3></div><div class="widget-content">',
    ))
    register_sidebar(array(
		    'name'=>'Widgets Right',
		    'before_widget' => '<div id="%1$s" class="widget %2$s">',
		    'after_widget' => '</div></div>',
		    'before_title' => '<div class="widget-title"><h3>',
		    'after_title' => '</h3></div><div class="widget-content">',
    ))
}

Edited by Vulcan

  • Author

Okay nothing shows an error on my website (local host) it shows burps\wp-content\themes\burps\functions.php on line 91

Your code is wrong. Try this.

 

Suggestion - Learn some PHP.

 

function nameofyourtheme_widgets_init() {
register_sidebar(array(
		 'name'=>'Anything, such as Widgets Left',
		 'before_widget' => '<div id="%1$s" class="widget %2$s">',
		 'after_widget' => '</div></div>',
		 'before_title' => '<div class="widget-title"><h3>',
		 'after_title' => '</h3></div><div class="widget-content">',
 ));
 register_sidebar(array(
		 'name'=>'Widgets Middle',
		 'before_widget' => '<div id="%1$s" class="widget %2$s">',
		 'after_widget' => '</div></div>',
		 'before_title' => '<div class="widget-title"><h3>',
		 'after_title' => '</h3></div><div class="widget-content">',
 ));
 register_sidebar(array(
		 'name'=>'Widgets Right',
		 'before_widget' => '<div id="%1$s" class="widget %2$s">',
		 'after_widget' => '</div></div>',
		 'before_title' => '<div class="widget-title"><h3>',
		 'after_title' => '</h3></div><div class="widget-content">',
 ));
}

Edited by brightonmike

  • Author

Thank you now this error is popping on the whole website

 

 

 

( ! ) Fatal error: Call to undefined function is_template_home() in C:\wamp\www\burps\wp-content\themes\burps\template-home.php on line 33

 

This is what's on the line:

 

<?php if ( is_template_home() ) { ?>

 

Yes I do need to learn PHP, but I dont know where to start. I mostly learn from other people e.g. video tutorials.

  • Author

Brilliant thank you very much for that.

 

I take it that this is where i add the css (id / classes) to make the boxes. Could you explain what each of these do. I'll need to add a third box.

 

'before_widget' => '<div id="%1$s" class="widget %2$s">',
					 'after_widget' => '</div></div>',
					 'before_title' => '<div class="widget-title"><h3>',
					 'after_title' => '</h3></div><div class="widget-content">',

to add another widget

 

just add one more

 

 

register_sidebar(array(
					 'name'=>'new widget',
					 'before_widget' => '<div id="%1$s" class="widget %2$s">',
					 'after_widget' => '</div></div>',
					 'before_title' => '<div class="widget-title"><h3>',
					 'after_title' => '</h3></div><div class="widget-content">',
	 ));

 

so full code will be

 

 

function nameofyourtheme_widgets_init() {
register_sidebar(array(
					 'name'=>'Anything, such as Widgets Left',
					 'before_widget' => '<div id="%1$s" class="widget %2$s">',
					 'after_widget' => '</div></div>',
					 'before_title' => '<div class="widget-title"><h3>',
					 'after_title' => '</h3></div><div class="widget-content">',
	 ));
	 register_sidebar(array(
					 'name'=>'Widgets Middle',
					 'before_widget' => '<div id="%1$s" class="widget %2$s">',
					 'after_widget' => '</div></div>',
					 'before_title' => '<div class="widget-title"><h3>',
					 'after_title' => '</h3></div><div class="widget-content">',
	 ));
	 register_sidebar(array(
					 'name'=>'Widgets Right',
					 'before_widget' => '<div id="%1$s" class="widget %2$s">',
					 'after_widget' => '</div></div>',
					 'before_title' => '<div class="widget-title"><h3>',
					 'after_title' => '</h3></div><div class="widget-content">',
	 ));
register_sidebar(array(
'name'=>'new widget',
					 'before_widget' => '<div id="%1$s" class="widget %2$s">',
					 'after_widget' => '</div></div>',
					 'before_title' => '<div class="widget-title"><h3>',
					 'after_title' => '</h3></div><div class="widget-content">',
	 ));
}

 

 

to style widget see here

 

or u can wrap widgets inside div like this

 

 

<div class="newwidget-style">
<?php if ( is_front_page() ) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : endif; ?>
<?php } ?>
</div>
<div class="newwidget-style">
<?php if ( is_front_page() ) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(4) ) : endif; ?>
<?php } ?>
</div>
<div class="newwidget-style">
<?php if ( is_front_page() ) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(5) ) : endif; ?>
<?php } ?>
</div>

Edited by sash_oo7

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.