Sidebar.php WordPress template for dynamic sidebars | PHP
This code can be added in to sidebar.php or any other theme file.
<?php if ( is_active_sidebar( 'sidebar_name' ) ) :
dynamic_sidebar( 'sidebar_name' );
endif; ?>
This code can be added in to sidebar.php or any other theme file.
<?php if ( is_active_sidebar( 'sidebar_name' ) ) :
dynamic_sidebar( 'sidebar_name' );
endif; ?>
<?php
$cityname = get_field('city_name');
$args = array(
'posts_per_page' => '100',
'post_type' => 'neighborhood',
'meta_key' => 'city_n',
'meta_value' => $cityname,
'order' => 'asc'
);
$cityquery = new WP_Query($args);
$i = 1;
while ( $cityquery->have_posts() ) : $cityquery-> the_post();?>
<?php
$this_page = get_post($id);
$parent_id = $this_page->post_parent;
if ($parent_id) {
$parent = get_page($parent_id);
echo '';
}
?>
$args = array(
'post_type' => 'page',
'post_parent' => $post->ID,
);
Tips by Elliott Richmond on how to secure your WP install with a few simple steps!
<?php echo substr(strip_tags($post->post_content), 0, 140);?>
<?php
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'sidebar 1',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'footer sidebar 1',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
}?>
$image = get_field('case_tile_image');
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
$exclude = get_cat_ID('News');
$q = 'cat=-'.$exclude; query_posts($q);
//paste this where the pagination must appear
global $wp_query;
$total = $wp_query->max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total > 1 ) {
// get the current page
if ( !$current_page = get_query_var('paged') )
$current_page = 1;
// structure of "format" depends on whether we're using pretty permalinks
if( get_option('permalink_structure') ) {
$format = '&paged=%#%';
} else {
$format = 'page/%#%/';
}
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => $format,
'current' => $current_page,
'total' => $total,
'mid_size' => 4,
'type' => 'list'
));
}
// CSS Code - add this to the style.css file
.navigation { list-style:none; font-size:12px; }
.navigation li{ display:inline; }
.navigation li a{ display:block; float:left; padding:4px 9px; margin-right:7px; border:1px solid #efefef; }
.navigation li span.current { display:block; float:left; padding:4px 9px; margin-right:7px; border:1px solid #efefef; background-color:#f5f5f5; }
.navigation li span.dots { display:block; float:left; padding:4px 9px; margin-right:7px; }