Skip to content

Instantly share code, notes, and snippets.

/*
Quick Tip! What happens when your post title does not fit on one line? It wraps to the second line. What if it’s only one word? And what if that word is “it” or some other shorty? Your title won’t look too nice, eh? Here’s a solution, somewhere inside the loop:
*/
$title = the_title( '<h2>', '</h2>', false );
if ( strlen( $title ) > 0 )
echo substr_replace( $title, '&nbsp;', strrpos( $title, ' ' ), 1 );
// USAGE
<?php the_title( $before, $after, $echo ); ?>
/* $before
(string) Text to place before the title. Defaults to ''.
$after
(string) Text to place after the title. Defaults to ''.
$echo
(Boolean) Display the title (true) or return it for use in PHP (false). Defaults to true.
*/
<?php
if(ICL_LANGUAGE_CODE=='en'){
echo 'content in english';
}
if(ICL_LANGUAGE_CODE=='es'){
echo 'content in spanish';
}
?>
1/ Go to WP Repository and search for WP Smush
2/ Install WP Smush to Your WP Site
3/ Go to WP Smush plugin installation folder
4/ Go to “lib” folder
5/ Open file “class-wp-smush.php” for editing
6/ Search for “if ( empty( $api_key ) )”
7/ This function returns false, so change to true.
//Display short blog title in WordPress
//There is a simple script you can use to implement a short blog title without modifying the base WordPresscode. Open up your functions.php file within your theme and add the following:
function short_title() {
$title = get_the_title();
$count = strlen($title);
if ($count >= 25) {
$title = substr($title, 0, 25);
/*
Add to functions.php:
*/
// Defines the length of the_excerpt
function my_excerpt_length($text){
return 30;
}
add_filter('excerpt_length', 'my_excerpt_length');
<?php if ( get_the_tags() ) :?>
<footer class="article-footer">
<p class="tags">
<?php the_tags('<span class="tags-title">' . __('Tags:', 'jointstheme') . '</span> ', ', ', ''); ?>
</p>
</footer> <!-- end article footer -->
<?php else : ?>
<!-- EMPTY -->
<?php endif; ?>
/* Add to header.php */
<script type="text/javascript" src="<?php bloginfo("template_url"); ?>/js/sidebar_tabs.js"></script>
/* Stored in inc or includes folder as tab-nav.php */
<div id="organic-tabs">
<ul id="tab-nav">
<li id="ex-tab1"><a rel="tab1" href="#" class="current">Featured</a></li>
<li id="ex-tab2"><a rel="tab2" href="#">Categories</a></li>
// FOR USE WITH WP-SNAP PLUGIN
// http://www.nateomedia.com/wares/downloads/wordpress/wp-snap/
<?php if (function_exists('wp_snap')) { echo "<div class='group'>" . wp_snap('cat=8&child=true&firstload=recent') . "</div>"; } ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="profile group">
/*
Theme Name:
Theme URI: http://
Description:
Version: 1.0
Author:
Author URI: http://
Tags:
*/