BLOGDIRECTORY_theme_functions();
}
public function wp_enqueue_scripts() {
$this->blogdirectory_css();
$this->blogdirectory_js();
}
/**
*BLOGDIRECTORY Theme need All Css add in Theme Function
*
*BLOGDIRECTORY version @since 1.0
*/
public function blogdirectory_css() {
// Main Style.css File
wp_enqueue_style( 'BLOGDIRECTORY-style', get_stylesheet_uri() );
wp_enqueue_style('BLOGDIRECTORY-bootstrap', get_template_directory_uri().'/css/bootstrap.min.css');
wp_enqueue_style('BLOGDIRECTORY-font', get_template_directory_uri().'/css/font-awesome.min.css');
wp_enqueue_style('BLOGDIRECTORY-main', get_template_directory_uri().'/css/style.css');
wp_enqueue_style('BLOGDIRECTORY-etline-icon', get_template_directory_uri().'/css/etline-icon.min');
}
/**
*BLOGDIRECTORY Theme need All Js add in Theme Function
*
*BLOGDIRECTORY version @since 1.0
*/
public function blogdirectory_js() {
wp_enqueue_script( 'BLOGDIRECTORY-jquery_003', get_template_directory_uri() . '/js/jquery_003.js', array('jquery' ), '', true );
wp_enqueue_script( 'BLOGDIRECTORY-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery' ), '', true );
wp_enqueue_script( 'BLOGDIRECTORY-slick', get_template_directory_uri() . '/js/slick.min.js', array('jquery' ), '', true );
}
/**
* Functions called during each page load, after the theme is initialized
* Perform basic setup, registration, and init actions for the theme
* @since 1.0.0
*/
public function after_setup_theme() {
//add textdomain
load_theme_textdomain('blogcafe-lite', get_template_directory() . '/languages');
// Register navigation menus
register_nav_menus (
array(
'primary'=>__( 'primary Menu', 'blogcafe-lite' ),
'secondary'=> __( 'Secondary Menu', 'blogcafe-lite' ),
)
);
// Enable some useful post formats for the blog
add_theme_support( 'post-formats', array( 'video', 'gallery', 'audio', 'quote', 'link' ) );
// Add automatic feed links in the header - for themecheck nagg
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'custom-background' );
add_theme_support( 'custom-header' );
// Enable featured image support
add_theme_support( 'post-thumbnails' );
// And HTML5 support
add_theme_support( 'html5' );
// Enable excerpts for pages.
add_post_type_support( 'page', 'excerpt' );
// Title tag
add_theme_support( 'title-tag' );
add_editor_style();
}
/**
* Register widget with WordPress.
*
* BLOGDIRECTORY version @since 1.0
*/
public function BLOGDIRECTORY_register_sidebars(){
register_sidebar(
array(
'name' => __('Blogdirectory main sidebar', 'blogcafe-lite'),
'id' => 'blogdirectory_main',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar(
array(
'name' => __('Blogdirectory footer 1', 'blogcafe-lite'),
'id' => 'blogdirectory_footer_1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar(
array(
'name' => __('Blogdirectory footer 2','blogcafe-lite'),
'id' => 'blogdirectory_footer_2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar(
array(
'name' => __('Blogdirectory footer 3', 'blogcafe-lite'),
'id' => 'blogdirectory_footer_3',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
}
private function BLOGDIRECTORY_theme_functions() {
require_once( BLOGDIRECTORY_FUNCTION_DIR .'themefunction/header_function.php' );
require_once( BLOGDIRECTORY_FUNCTION_DIR .'themefunction/footer_function.php' );
require_once( BLOGDIRECTORY_FUNCTION_DIR .'themefunction/home_slider_function.php' );
require_once( BLOGDIRECTORY_FUNCTION_DIR .'meta/post-meta/class.php');
require_once( BLOGDIRECTORY_FUNCTION_DIR .'themefunction/social_share_plugin.php');
require_once( BLOGDIRECTORY_FUNCTION_DIR .'inc/blogcafe-lite-help.php');
require_once( BLOGDIRECTORY_FUNCTION_DIR .'themefunction/theme-options.php' );
}
/**
* my site feed function
*
*https://wordpress.org/support/topic/custom-post-types
*/
public function blogdirectory_myfeed_request($qv) {
if (isset($qv['feed']) && !isset($qv['post_type']))
$qv['post_type'] = array('post', 'team', 'portfolio','blog', 'testimonial','page','sponsor');
return $qv;
}
/**
* Allows filtering of custom posts by taxonomy in the admin view
*
*http://wordpress.stackexchange.com/questions/578/adding-a-taxonomy-filter-to-admin-list-for-a-custom-post-type
*/
public function blogdirectory_custom_posts_tax_filters_admin() {
// only display these taxonomy filters on desired custom post_type listings
global $typenow;
if ($typenow == 'portfolio' ) {
// create an array of taxonomy slugs you want to filter by - if you want to retrieve all taxonomies, could use get_taxonomies() to build the list
$filters = array('portfolio_category');
foreach ($filters as $tax_slug) {
// retrieve the taxonomy object
$tax_obj = get_taxonomy($tax_slug);
$tax_name = $tax_obj->labels->name;
// retrieve array of term objects per taxonomy
$terms = get_terms($tax_slug);
// output html for taxonomy dropdown filter
echo "";
}
}
elseif ($typenow == 'team') {
// create an array of taxonomy slugs you want to filter by - if you want to retrieve all taxonomies, could use get_taxonomies() to build the list
$filters = array('team_category');
foreach ($filters as $tax_slug) {
// retrieve the taxonomy object
$tax_obj = get_taxonomy($tax_slug);
$tax_name = $tax_obj->labels->name;
// retrieve array of term objects per taxonomy
$terms = get_terms($tax_slug);
// output html for taxonomy dropdown filter
echo "";
}
}
}
}
$BLOGDIRECTORY_theme_setup = new BLOGDIRECTORY_Theme_Setup();
/* Limit Function */
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).' ...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`[[^]]*]`','',$excerpt);
return $excerpt;
}
if ( ! function_exists( 'blogdirectory_paging_nav' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*
* @since BLOGDIRECTORY 1.0
*/
function blogdirectory_paging_nav() {
global $wp_query, $wp_rewrite;
// Don't print empty markup if there's only one page.
if ( $wp_query->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
$format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
// Set up paginated links.
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $wp_query->max_num_pages,
'current' => $paged,
'mid_size' => 1,
'add_args' => array_map( 'urlencode', $query_args ),
'prev_text' => __( 'Previous', 'blogcafe-lite' ),
'next_text' => __( 'Next', 'blogcafe-lite' ),
) );
if ( $links ) :
?>
post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous )
return;
?>
max_num_pages;
} else {
$total = $wp_query->max_num_pages;
}
$big = 999999999; // need an unlikely integer
if( $total > 1 ) {
if( !$current_page = get_query_var('paged') )
$current_page = 1;
if( get_option('permalink_structure') ) {
$format = 'page/%#%/';
} else {
$format = '&paged=%#%';
}
echo paginate_links(array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => $format,
'current' => max( 1, get_query_var('paged') ),
'total' => $total,
'mid_size' => 3,
'type' => 'list',
'prev_text' => $prev_arrow,
'next_text' => $next_arrow,
) );
}
}
}
// Post Type Search Only
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
add_image_size( 'thumb-small', 358, 243, true );
add_image_size( 'large-small', 750, 500 , true );
function myplugin_add_meta_box() {
$screens = array( 'sponsor' );
foreach ( $screens as $screen ) {
add_meta_box(
'website',
'Sponsor Information',
'show_custom_meta_box',
$screen,
'normal',
'high'
);
}
}
add_action( 'add_meta_boxes', 'myplugin_add_meta_box' );
function show_custom_meta_box( $post ) {
wp_nonce_field( 'website', 'website_nonce' );
$value = get_post_meta( $post->ID, '_website', true );
echo ' ';
echo '';
}
function myplugin_save_meta_box_data( $post_id ) {
if ( ! isset( $_POST['website_nonce'] ) ) {
return;
}
if ( ! wp_verify_nonce( $_POST['website_nonce'], 'website' ) ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_id ) ) {
return;
}
} else {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
}
if ( ! isset( $_POST['website'] ) ) {
return;
}
$my_data = sanitize_text_field( $_POST['website'] );
update_post_meta( $post_id, '_website', $my_data );
}
add_action( 'save_post', 'myplugin_save_meta_box_data' );
//Creates a nicely formatted and more specific title element text
function wpdocs_filter_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() )
return $title;
$title .= get_bloginfo( 'name' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title = "$title $sep $site_description";
if ( $paged >= 2 || $page >= 2 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'blogcafe-lite' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'wpdocs_filter_wp_title', 10, 2 );
function xtreme_enqueue_comments_reply() {
if( get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
if ( ! function_exists( 'ribosome_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own ribosome_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Ribosome 1.0
*/
function ribosome_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
id="comment-">
', '' ); ?>
id="li-comment-">
',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$author = sprintf( '%3$s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'blogcafe-lite' ), get_the_author() ) ),
get_the_author()
);
// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
if ( $tag_list ) {
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'blogcafe-lite' );
} elseif ( $categories_list ) {
$utility_text = __( 'This entry was posted in %1$s on %3$s by %4$s.', 'blogcafe-lite' );
} else {
$utility_text = __( 'This entry was posted on %3$s by %4$s.', 'blogcafe-lite' );
}
printf(
$utility_text,
$categories_list,
$tag_list,
$date,
$author
);
}
endif;
// Menu Class
function change_submenu_class($menu) {
$menu = preg_replace('/ class="sub-menu"/','/ class="dropdown-menu" /',$menu);
return $menu;
}
add_filter('wp_nav_menu','change_submenu_class');