';
if ('page' != get_option('show_on_front')) {
if (is_front_page())
$class = 'class="current_page_item home-icon"';
else
$class = 'class="home-icon"';
echo '
';
}
wp_list_pages('title_li=');
echo '';
}
add_filter( 'wp_nav_menu_items', 'effect_home_link', 10, 2 );
function effect_home_link($items, $args) {
if (is_front_page())
$class = 'class="current_page_item home-icon"';
else
$class = 'class="home-icon"';
$homeMenuItem =
'' .
$args->before .
'' .
$args->link_before . '' . $args->link_after .
'' .
$args->after .
'';
$items = $homeMenuItem . $items;
return $items;
}
//function to call first uploaded image in functions file
function effect_main_image() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment
&post_mime_type=image&order=desc');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;
$num = $keys[$j];
$image=wp_get_attachment_image($num, 'large', true);
$imagepieces = explode('"', $image);
$imagepath = $imagepieces[1];
$main=wp_get_attachment_url($num);
$template=get_template_directory();
$the_title=get_the_title();
print "";
endif;
}
function effect_post_meta_data() {
printf( __( '%2$s %4$s', 'effect' ),
'meta-prep meta-prep-author posted',
sprintf( '%3$s',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_html( get_the_date() )
),
'byline',
sprintf( '%3$s',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'View all posts by %s', 'effect' ), get_the_author() ),
esc_attr( get_the_author() )
)
);
}
/* Enable support for post-thumbnails ********************************************/
// If we want to ensure that we only call this function if
// the user is working with WP 2.9 or higher,
// let's instead make sure that the function exists first
function effect_theme_setup() {
add_theme_support( 'post-thumbnails' );
add_image_size( 'defaultthumb', 300, 200, true);
add_image_size( 'popularpost', 75, 75 , true );
add_image_size( 'latestpost', 150, 150 , true );
load_theme_textdomain('effect', get_template_directory() . '/languages');
add_editor_style();
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'effect_custom_background_args', array(
'default-color' => '',
'default-image' => get_template_directory_uri() . '/images/bg.png',
) ) );
add_theme_support('automatic-feed-links');
register_nav_menus(
array(
'effect-navigation' => __('Navigation', 'effect'),
'primary' => __('Primary', 'effect'),
)
);
global $content_width;
if ( ! isset( $content_width ) ) {
$content_width = 770;
}
//woocommerce plugin support
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'effect_theme_setup' );
/* Excerpt ********************************************/
function effect_excerptlength_teaser($length) {
return 10;
}
function effect_excerptlength_index($length) {
return 22;
}
function effect_excerptmore($more) {
return '...';
}
function effect_excerpt($length_callback='', $more_callback='') {
global $post;
add_filter('excerpt_length', $length_callback);
add_filter('excerpt_more', $more_callback);
$output = get_the_excerpt();
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = ''.$output.'';
echo $output;
}
/* Widgets ********************************************/
function effect_widgets_init() {
register_sidebar(array(
'name' => __( 'Sidebar Right', 'effect' ),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => __( 'Bottom Menu 1', 'effect' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => __( 'Bottom Menu 2', 'effect' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => __( 'Bottom Menu 4', 'effect' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
}
add_action('widgets_init', 'effect_widgets_init');
//---------------------------- [ Pagenavi Function ] ------------------------------//
function effect_pagenavi() {
global $wp_query;
$big = 123456789;
$page_format = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'type' => 'array'
) );
if( is_array($page_format) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '';
echo ''. $paged . ' of ' . $wp_query->max_num_pages .'';
foreach ( $page_format as $page ) {
echo "$page";
}
echo '
';
}
}
/**
* Creates a nicely formatted and more specific title element text
* for output in head of document, based on current view.
*
* @since effect 1.6
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string Filtered title.
*/
function effect_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() )
return $title;
// Add the site name.
$title .= get_bloginfo( 'name' );
// Add the site description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title = "$title $sep $site_description";
// Add a page number if necessary.
if ( $paged >= 2 || $page >= 2 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'effect' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'effect_wp_title', 10, 2 );
//Require Plugins
require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'effect_register_required_plugins' );
function effect_register_required_plugins() {
/**
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
array(
'name' => 'Regenerate Thumbnails',
'slug' => 'regenerate-thumbnails',
'required' => false,
),
);
$config = array(
'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to pre-packaged plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'tgmpa' ),
'menu_title' => __( 'Install Plugins', 'tgmpa' ),
'installing' => __( 'Installing Plugin: %s', 'tgmpa' ), // %s = plugin name.
'oops' => __( 'Something went wrong with the plugin API.', 'tgmpa' ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'tgmpa' ), // %1$s = plugin name(s).
'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'tgmpa' ), // %1$s = plugin name(s).
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'tgmpa' ), // %1$s = plugin name(s).
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'tgmpa' ), // %1$s = plugin name(s).
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'tgmpa' ), // %1$s = plugin name(s).
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'tgmpa' ), // %1$s = plugin name(s).
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'tgmpa' ), // %1$s = plugin name(s).
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'tgmpa' ), // %1$s = plugin name(s).
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'tgmpa' ),
'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'tgmpa' ),
'return' => __( 'Return to Required Plugins Installer', 'tgmpa' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'tgmpa' ),
'complete' => __( 'All plugins installed and activated successfully. %s', 'tgmpa' ), // %s = dashboard link.
'nag_type' => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
)
);
tgmpa( $plugins, $config );
}
?>