November 21, 201214 yr 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 November 21, 201214 yr by Vulcan
November 21, 201214 yr You can, for instance, use custom fields (or even some plugin like Advanced Custom Fields) as a text containers on the main page.
November 22, 201214 yr http://codex.wordpress.org/Custom_Fields http://wp.smashingmagazine.com/2010/04/29/extend-wordpress-with-custom-fields/ http://www.advancedcustomfields.com/ Hope that will help
November 22, 201214 yr Author http://codex.wordpre...g/Custom_Fields http://wp.smashingma...-custom-fields/ http://www.advancedcustomfields.com/ Hope that will help 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 November 22, 201214 yr by Vulcan
November 23, 201214 yr http://themeshaper.com/2010/06/03/sample-theme-options/ Very easy to use and follow.
November 23, 201214 yr 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.
November 23, 201214 yr 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.
November 28, 201214 yr Author brightonmike - I cant seem to get it working. Where to i create these boxes?
November 28, 201214 yr u can try this text widget adding widgets in wp pages Edited November 28, 201214 yr by sash_oo7
November 28, 201214 yr 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.
November 29, 201214 yr Author I have read the instructions over and over again and I cant work out. I'll try sash_oo7 link
November 30, 201214 yr Author sash_oo7 I'm trying to add the widgets in to its own area. But its coming up with an error :-/.
December 2, 201214 yr 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' );
December 2, 201214 yr 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 } ?>
December 2, 201214 yr 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
December 2, 201214 yr 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' );
December 3, 201214 yr where u pasted this code? <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(X) ) : endif; ?>
December 3, 201214 yr 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(); ?>
December 3, 201214 yr <?php if ( is_template_home() ) { ?> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : endif; ?> <?php } ?>
December 3, 201214 yr 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
December 3, 201214 yr 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.
December 3, 201214 yr 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?
December 3, 201214 yr 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 December 3, 201214 yr by Vulcan
December 3, 201214 yr Author Okay nothing shows an error on my website (local host) it shows burps\wp-content\themes\burps\functions.php on line 91
December 3, 201214 yr 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 December 3, 201214 yr by brightonmike
December 3, 201214 yr 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.
December 3, 201214 yr <?php if ( is_page('template-home') ) { ?> if name of your home page is template-home.php
December 3, 201214 yr 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">',
December 3, 201214 yr 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 December 3, 201214 yr by sash_oo7
Create an account or sign in to comment