Balajil's Blog

Just another WordPress.com weblog

css hack for safari


@media screen and (-webkit-min-device-pixel-ratio:0) {
ul#menu-top_menu li#menu-item-887 a{ padding: 0 25px 0 25px!important;}
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
ul#menu-top_menu li a{font-family:’RobotoMedium’; font-size:16px; color:#ffffff; text-decoration:none; line-height:43px; padding:0 24px 0 24px; text-transform:uppercase; height:43px; display:block}
}

No Comments »

show ur page title if you see the parent page


<pre>
<?php
if($post->post_parent) {
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
} else {
wp_title(”);
}
?>
</pre>


				
No Comments »

if home page show some and other page some something another matter



    // This is a homepage 
    
 
     

No Comments »

simply jquery tab


// <pre>
<script type="text/javascript">
    $(document).ready(function(){
    $('#tabs div').hide(); // Hide all divs
    $('#tabs div:first').show(); // Show the first div
    $('#tabs ul li:first').addClass('active'); // Set the class for active state
    $('#tabs ul li a').click(function(){ // When link is clicked
    $('#tabs ul li').removeClass('active'); // Remove active class from links
    $(this).parent().addClass('active'); //Set parent of clicked link class to active
    var currentTab = $(this).attr('href'); // Set currentTab to value of href attribute
    $('#tabs div').hide(); // Hide all divs
    $(currentTab).show(); // Show div with id equal to variable currentTab
    return false;
    });
    });
    </script>
</pre>
No Comments »

Display sub pages of wordpress if there have sub page


<?php
global $wp_query;
if( empty($wp_query->post->post_parent) )
{
$parent = $wp_query->post->ID;
}
else
{
$parent = $wp_query->post->post_parent;
} ?>

<?php if(wp_list_pages(“title_li=&child_of=$parent&echo=0″ )): ?>
<div id=”submenu”>
<ul>
<?php wp_list_pages(“title_li=&child_of=$parent” ); ?>
</ul>
</div>
<?php endif; ?>
</pre>

No Comments »

how to call the single post content in pages by id


<pre>
<?php
$postslist = get_posts(‘include=820′);
if(count($postslist) > 0) :
foreach ($postslist as $post) :
setup_postdata($post);
the_content(); ?>
<?php endforeach; ?>
<?php else : ?>
<?php endif; ?>
</pre>

No Comments »

how to add the post date in wordpress


 <pre><?php the_time('l, F jS, Y')&nbsp;?> </pre>

http://codex.wordpress.org/Formatting_Date_and_Time

No Comments »

how to call image in middle and center of outer div


Put the properties in css display inline-block and vertical alignment middle.

ul.logos li img{ display:inline-block; vertical-align:middle}

No Comments »

how to call the custom post type in condition


<?php if ( ‘languages’ == get_post_type() ) {?>
<?php query_posts(“post_type=languages&posts_per_page=-1″);
while ( have_posts() ) : the_post();
?>
<li><a href=”<?php the_permalink(); ?>” title=”<?php printf( esc_attr__( ‘Permalink to %s’, ‘twentyten’ ), the_title_attribute( ‘echo=0′ ) ); ?>” rel=”bookmark”>
<?php the_title(); ?>
</a></li>
<?php endwhile; ?>
</ul>
<?php wp_reset_query();?>

<?php

} elseif ( ‘book’ == get_post_type() ) {?>

<?php
}
?>

No Comments »

how to show the single post on home page or other pages


<?php
$postslist = get_posts(‘include=1′);
if(count($postslist) > 0) :
foreach ($postslist as $post) :
setup_postdata($post);
the_content(); ?>
<?php endforeach; ?>
<?php else : ?>
<?php endif; ?>

No Comments »

Follow

Get every new post delivered to your Inbox.