Last active
October 1, 2019 09:12
-
-
Save asathoor/076b562710f455476e88e72384020804 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Bootstrap Three Widgets Pg | |
*/ | |
?> | |
<!DOCTYPE html> | |
<html <?php language_attributes(); ?>> | |
<head> | |
<meta charset="<?php bloginfo( 'charset' ); ?>" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<link rel="profile" href="https://gmpg.org/xfn/11" /> | |
<!-- below: we don't need these lines any more --> | |
<!-- title>Bootstrap Example</title --> | |
<!-- meta charset="utf-8" --> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- Bootstrap scripts, styles --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> | |
<!-- add this line in order to fetch the title field, styles etc .. --> | |
<?php wp_head(); ?> | |
</head> | |
<body> | |
<div class="jumbotron text-center"> | |
<h1>Three Widget Areas</h1> | |
<p>Resize this responsive page to see the effect!</p> | |
</div> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-sm-4"> | |
<h3>Widget Left</h3> | |
<?php dynamic_sidebar( 'fp-wid-a' ); // widget: left ?> | |
</div> | |
<div class="col-sm-4"> | |
<h3>Widget Center</h3> | |
<?php dynamic_sidebar( 'fp-wid-b' ); // widget: center ?> | |
</div> | |
<div class="col-sm-4"> | |
<h3>Widget Right</h3> | |
<?php dynamic_sidebar( 'fp-wid-r' ); // widget: right ?> | |
</div> | |
</div> | |
</div> | |
<!-- add this line in order to get the admin bar and place scripts in the footer --> | |
<?php wp_footer(); // make admin bar visible ?> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WIDGET AREA CODE | |
* Add the following code to functions.php | |
**/ | |
function petj_add_widgets() { | |
register_sidebar( | |
array( | |
'name' => 'Front-page: Left', | |
'id' => 'fp-wid-a', | |
'before_widget' => '<div class="fp-widget">', | |
'after_widget' => '</div>', | |
'before_title' => '<h2 class="fp-widget-h2">', | |
'after_title' => '</h2>', | |
) | |
); | |
register_sidebar( | |
array( | |
'name' => 'Front-page: Center', | |
'id' => 'fp-wid-b', | |
'before_widget' => '<div class="fp-widget">', | |
'after_widget' => '</div>', | |
'before_title' => '<h2 class="fp-widget-h2">', | |
'after_title' => '</h2>', | |
) | |
); | |
register_sidebar( | |
array( | |
'name' => 'Front-page: Right', | |
'id' => 'fp-wid-r', | |
'before_widget' => '<div class="fp-widget-right">', | |
'after_widget' => '</div>', | |
'before_title' => '<h2 class="fp-widget-h2">', | |
'after_title' => '</h2>', | |
) | |
); | |
} | |
add_action( 'widgets_init', 'petj_add_widgets' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment