So, I have a custom post type with custom metaboxes that uses a custom template. So far, things looks pretty good, but I'm having a few layout issues.
1. The first is with my title area. If my title is too long, the content wraps around the image. I'm not too sure I like how this looks. How would I force the title, description, share area to stay in its own division and not wrap around the image.
2. The second issue is that after I do my column classes, I am inserting the share links again, a related posts call, and then an adsense banner. In most browsers, the second share links reference doesn't seem to comply with the CSS. It is up at the top right beneath my first call to do the share links.
This is what I'm referring to:
http://www.themiddlevote.com/debate/test-debate-slug/
Also, I just realized the issue is different in different browsers. How do I force the same layout at all times?
PHP Code:
<?php
/*
Template Name: Single Debate
*/
//custom hooks below here...
//remove_action( 'genesis_after_header', 'genesis_do_subnav' );
// Remove the post info functiona
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
// Remove the post meta function
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
// Remove title
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
// The displayed banner is based on whether or not a certain article requires
add_action( 'genesis_before_post_title', 'tmv_add_debate_banner_top');
function tmv_add_debate_banner_top(){
?>
<div style="margin:0px 0px 15px 80px">
<p>
<?php
$banner_type = genesis_get_custom_field( '_tmv_advertising_banner_top' );
if ( $banner_type == 'auto')
echo "<img src='http://localhost:8888/wp-content/uploads/2012/02/adsense_display_728x90_en.jpg' height='90' width='728' />";
else
echo "<img src='http://localhost:8888/wp-content/uploads/2012/02/adsense_text_728x90_en.png' height='90' width='728' />";
?>
</p>
</div>
<?php
}
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
add_action( 'genesis_post_content', 'tmv_do_debate_content' );
function tmv_do_debate_content() {
global $post;
//setup thumbnail image args to be used with genesis_get_image();
$size = 'medium'; // Change this to whatever add_image_size you want
$default_attr = array(
'class' => "alignleft attachment-$size",
'alt' => $post->post_title,
'title' => $post->post_title,
);
// check if the post has a Post Thumbnail assigned to it.
if ( has_post_thumbnail() ) {
// echo '<div class="clear"></div>';
printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), genesis_get_image( array( 'size' => $size, 'attr' => $default_attr ) ) );
}
//else {}
echo genesis_do_post_title();
echo "<h6>" . genesis_get_custom_field( '_tmv_authorA_name' ) . " vs. " . genesis_get_custom_field( '_tmv_authorB_name' ) . "   -   " . the_date('', '', '', FALSE) . "</h6> ";
echo genesis_post_info();
echo do_shortcode('[social_share/]');
// Author A - left half 1
echo "<div class='one-half first'>";
echo "<h3>" . genesis_get_custom_field( '_tmv_authorA_responseTitle' ) . "</h3>";
echo "<h6> Written By: " . genesis_get_custom_field( '_tmv_authorA_name' ) . " - " . genesis_get_custom_field( '_tmv_authorA_occupation' ) . " - " . genesis_get_custom_field( '_tmv_authorA_political' ) . " - " . genesis_get_custom_field( '_tmv_authorA_location' ) . "</h6>";
echo "<p>" . genesis_get_custom_field( '_tmv_authorA_response' ). "</p>";
// Mid Debate Adsense Insertion - temp images need to be replaced wiht ADSENSE scripts!!!
?>
<div style="margin:0px 0px 0px 40px">
<p>
<img src="http://localhost:8888/wp-content/uploads/2012/02/adsense_text_336x280_en.png" height="280" width="336" />
</p>
</div>
<?php
echo "<h3>" . genesis_get_custom_field( '_tmv_authorA_rebuttalTitle' ) . "</h3>";
echo "<h6>" . genesis_get_custom_field( '_tmv_authorA_name' ) ."'s rebuttal of " . genesis_get_custom_field( '_tmv_authorB_name' ) . "'s “" . genesis_get_custom_field( '_tmv_authorB_responseTitle' ) . "”</h6>";
echo "<p>" . genesis_get_custom_field( '_tmv_authorA_rebuttal' ). "</p>";
/* Time for the author-box
echo "<div class='author-box'>";
echo "<strong> About " . genesis_get_custom_field( '_tmv_authorA_name' ) . "</strong>";
echo "<br>";
echo "<p>" . genesis_get_custom_field( '_tmv_authorA_bio' ) . "<br><br>";
echo "Learn more about " . genesis_get_custom_field( '_tmv_authorA_name' ) . " at <a href='http://" . genesis_get_custom_field( '_tmv_authorA_website' ) . "'>". genesis_get_custom_field( '_tmv_authorA_website' ) . "</a>";
echo " or <a href='http://www.twitter.com/" . genesis_get_custom_field( '_tmv_authorA_twitterID' ) . "'>follow</a>";
// need to conditionally build text in Author box based on gender
$authorA_gender = genesis_get_custom_field( '_tmv_authorA_gender' );
if ( $authorA_gender == 'female')
echo " her ";
elseif ( $authorA_gender == 'group')
echo " them ";
else
echo " him ";
echo "on Twitter - <a href='http://www.twitter.com/" . genesis_get_custom_field( '_tmv_authorA_twitterID' ) . "'>@". genesis_get_custom_field( '_tmv_authorA_twitterID' ) . "</a>.</p>";
echo "</div>";
// Time to build the references
if ( genesis_get_custom_field( '_tmv_authorA_reference1' ) != ''){
echo "<h6> References: </h6>";
echo "<ul>";
for ($i=1; $i<=5; $i++){
$ref_temp = '_tmv_authorA_reference'.$i;
if ( genesis_get_custom_field( $ref_temp ) != '')
echo "<li><a href='http://" . genesis_get_custom_field( $ref_temp ) ."'>" . genesis_get_custom_field( $ref_temp ) . "</a></li>";
}
echo "</ul>";
}
*/
echo "</div>";
// Author B - right half 1
echo "<div class='one-half'>";
echo "<h3>" . genesis_get_custom_field( '_tmv_authorB_responseTitle' ) . "</h3>";
echo "<h6> Written By: " . genesis_get_custom_field( '_tmv_authorB_name' ) . " - " . genesis_get_custom_field( '_tmv_authorB_occupation' ) . " - " . genesis_get_custom_field( '_tmv_authorB_political' ) . " - " . genesis_get_custom_field( '_tmv_authorB_location' ) . "</h6>";
echo "<p>" . genesis_get_custom_field( '_tmv_authorB_response' ). "</p>";
// Mid Debate Adsense Insertion - temp images need to be replaced wiht ADSENSE scripts!!!
?>
<div style="margin:0px 0px 0px 40px">
<p>
<img src="http://localhost:8888/wp-content/uploads/2012/02/adsense_336x280_en.jpg" height="280" width="336" />
</p>
</div>
<?php
echo "<h3>" . genesis_get_custom_field( '_tmv_authorB_rebuttalTitle' ) . "</h3>";
echo "<h6>" . genesis_get_custom_field( '_tmv_authorB_name' ) ."'s rebuttal of " . genesis_get_custom_field( '_tmv_authorA_name' ) . "'s “" . genesis_get_custom_field( '_tmv_authorA_responseTitle' ) . "”</h6>";
echo "<p>" . genesis_get_custom_field( '_tmv_authorB_rebuttal' ). "</p>";
/* Time for the author-box
echo "<div class='author-box'>";
echo "<strong> About " . genesis_get_custom_field( '_tmv_authorB_name' ) . "</strong>";
echo "<br>";
echo "<p>" . genesis_get_custom_field( '_tmv_authorB_bio' ) . "<br><br>";
echo "Learn more about " . genesis_get_custom_field( '_tmv_authorB_name' ) . " at <a href='http://" . genesis_get_custom_field( '_tmv_authorB_website' ) . "'>". genesis_get_custom_field( '_tmv_authorB_website' ) . "</a>";
echo " or <a href='http://www.twitter.com/" . genesis_get_custom_field( '_tmv_authorB_twitterID' ) . "'>follow</a>";
// need to conditionally build text in Author box based on gender
$authorB_gender = genesis_get_custom_field( '_tmv_authorB_gender' );
if ( $authorB_gender == 'female')
echo " her ";
elseif ( $authorB_gender == 'group')
echo " them ";
else
echo " him ";
echo "on Twitter - <a href='http://www.twitter.com/" . genesis_get_custom_field( '_tmv_authorB_twitterID' ) . "'>@". genesis_get_custom_field( '_tmv_authorB_twitterID' ) . "</a>.</p>";
echo "</div>";
// Time to build the references
if ( genesis_get_custom_field( '_tmv_authorB_reference1' ) != ''){
echo "<h6> References: </h6>";
echo "<ul>";
for ($i=1; $i<=5; $i++){
$ref_temp = '_tmv_authorB_reference'.$i;
if ( genesis_get_custom_field( $ref_temp ) != '')
echo "<li><a href='http://" . genesis_get_custom_field( $ref_temp ) ."'>" . genesis_get_custom_field( $ref_temp ) . "</a></li>";
}
echo "</ul>";
} */
echo "</div>";
// Author A - left half 2
echo "<div class='one-half first'>";
// Time for the author-box
echo "<div class='author-box'>";
echo "<strong> About " . genesis_get_custom_field( '_tmv_authorA_name' ) . "</strong>";
echo "<br>";
echo "<p>" . genesis_get_custom_field( '_tmv_authorA_bio' ) . "<br><br>";
echo "Learn more about " . genesis_get_custom_field( '_tmv_authorA_name' ) . " at <a href='http://" . genesis_get_custom_field( '_tmv_authorA_website' ) . "'>". genesis_get_custom_field( '_tmv_authorA_website' ) . "</a>";
echo " or <a href='http://www.twitter.com/" . genesis_get_custom_field( '_tmv_authorA_twitterID' ) . "'>follow</a>";
// need to conditionally build text in Author box based on gender
$authorA_gender = genesis_get_custom_field( '_tmv_authorA_gender' );
if ( $authorA_gender == 'female')
echo " her ";
elseif ( $authorA_gender == 'group')
echo " them ";
else
echo " him ";
echo "on Twitter - <a href='http://www.twitter.com/" . genesis_get_custom_field( '_tmv_authorA_twitterID' ) . "'>@". genesis_get_custom_field( '_tmv_authorA_twitterID' ) . "</a>.</p>";
echo "</div>";
// Time to build the references
if ( genesis_get_custom_field( '_tmv_authorA_reference1' ) != ''){
echo "<h6> References: </h6>";
echo "<ul>";
for ($i=1; $i<=5; $i++){
$ref_temp = '_tmv_authorA_reference'.$i;
if ( genesis_get_custom_field( $ref_temp ) != '')
echo "<li><a href='http://" . genesis_get_custom_field( $ref_temp ) ."'>" . genesis_get_custom_field( $ref_temp ) . "</a></li>";
}
echo "</ul>";
}
echo "</div>";
// Author B - right half 2
echo "<div class='one-half'>";
// Time for the author-box
echo "<div class='author-box'>";
echo "<strong> About " . genesis_get_custom_field( '_tmv_authorB_name' ) . "</strong>";
echo "<br>";
echo "<p>" . genesis_get_custom_field( '_tmv_authorB_bio' ) . "<br><br>";
echo "Learn more about " . genesis_get_custom_field( '_tmv_authorB_name' ) . " at <a href='http://" . genesis_get_custom_field( '_tmv_authorB_website' ) . "'>". genesis_get_custom_field( '_tmv_authorB_website' ) . "</a>";
echo " or <a href='http://www.twitter.com/" . genesis_get_custom_field( '_tmv_authorB_twitterID' ) . "'>follow</a>";
// need to conditionally build text in Author box based on gender
$authorB_gender = genesis_get_custom_field( '_tmv_authorB_gender' );
if ( $authorB_gender == 'female')
echo " her ";
elseif ( $authorB_gender == 'group')
echo " them ";
else
echo " him ";
echo "on Twitter - <a href='http://www.twitter.com/" . genesis_get_custom_field( '_tmv_authorB_twitterID' ) . "'>@". genesis_get_custom_field( '_tmv_authorB_twitterID' ) . "</a>.</p>";
echo "</div>";
// Time to build the references
if ( genesis_get_custom_field( '_tmv_authorB_reference1' ) != ''){
echo "<h6> References: </h6>";
echo "<ul>";
for ($i=1; $i<=5; $i++){
$ref_temp = '_tmv_authorB_reference'.$i;
if ( genesis_get_custom_field( $ref_temp ) != '')
echo "<li><a href='http://" . genesis_get_custom_field( $ref_temp ) ."'>" . genesis_get_custom_field( $ref_temp ) . "</a></li>";
}
echo "</ul>";
}
echo "</div>";
// share links at bottom of post
//echo "<div style='margin:0px 0px 15px 0px'>";
echo do_shortcode('[social_share]');
//echo do_shortcode("[poll id='1']");
//echo "</div>";
// Call Thumbnails plug-in
get_related_posts_thumbnails();
// Full adsense banner on bottom of debate
?>
<div style="margin:15px 0px 0px 80px">
<p>
<img src="http://localhost:8888/wp-content/uploads/2012/02/adsense_text_728x90_en.png" height="90" width="728" />
</p>
</div>
<?php
}
genesis();
?>