add partners

This commit is contained in:
Vasil Kolev 2014-10-14 18:24:01 +03:00 committed by Openfest
parent d5213d0e64
commit bcc2315a51
3 changed files with 53 additions and 11 deletions

View File

@ -6,7 +6,9 @@
</div>
<div class="col2 sponsors">
<?php echo do_shortcode( '[sponsors]' ); ?>
<?php echo do_shortcode( '[partners]' ); ?>
</div>
</section>
<div class="separator"></div>

View File

@ -19,6 +19,7 @@ register_nav_menus(
function register_shortcodes(){
add_shortcode('sh-latest-posts', 'sh_latest_posts');
add_shortcode('sponsors', 'sponsors_shortcode');
add_shortcode('partners', 'partners_shortcode');
add_shortcode('transport', 'transport_shortcode');
}
@ -74,6 +75,42 @@ function sponsors_shortcode() {
if ( $sponsors->have_posts() ) :
while ( $sponsors->have_posts() ) : $sponsors->the_post();
$custom = get_post_custom();
if (empty($custom['partner'])) {
if (empty ($custom['url'])) {
echo '<a href="'.$custom['url'][0].'" target=_blank alt="'.get_the_title().'">';
}
if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else {
get_the_title();
}
if (!empty ($custom['url'])) {
echo '</a>';
}
}
endwhile;
endif;
$result .= ob_get_contents();
ob_end_clean();
return $result;
}
# Create shortcode for partners
function partners_shortcode() {
$result= '<h3>'.pll__('Партньори').'</h3>';
$sponsors_args = array( 'post_type' => 'sponsors', 'orderby' => 'rand' );
$sponsors = new WP_Query( $sponsors_args );
ob_start();
if ( $sponsors->have_posts() ) :
while ( $sponsors->have_posts() ) : $sponsors->the_post();
$custom = get_post_custom();
if (!empty($custom['partner'])) {
if (!empty ($custom['url'])) {
echo '<a href="'.$custom['url'][0].'" target=_blank alt="'.get_the_title().'">';
}
@ -85,7 +122,7 @@ function sponsors_shortcode() {
if (!empty ($custom['url'])) {
echo '</a>';
}
}
endwhile;
endif;
@ -227,7 +264,7 @@ function transportation_posttype() {
}
function openfest_home_page() {
if (empty($wp)) {return true;} ;
if (empty($wp)) {return is_front_page();} ;
return !($wp->query_vars['pagename']=='home' || $wp->query_vars['pagename']=='home-2');
}
@ -282,6 +319,7 @@ if (function_exists("pll_register_string")) {
pll_register_string('venue','Интерпред, София, България');
pll_register_string('venue_w','Място');
pll_register_string('sponsors_w','Спонсори');
pll_register_string('partners_w','Партньори');
pll_register_string('time','1-ви и 2-ри ноември 2014 г.');
pll_register_string('publishedon','Публикувано на');
pll_register_string('by_w','От');

View File

@ -4,5 +4,7 @@
<div class="separator"></div>
<?php echo do_shortcode( '[sponsors]' ); ?>
<div class="separator"></div>
<?php echo do_shortcode( '[partners]' ); ?>
<div class="separator"></div>
<?php echo do_shortcode( '[transport]' ); ?>
</div>