for posts and comments. */ add_theme_support('automatic-feed-links'); /* * Supporting title tag via add_theme_support (since WordPress 4.1) */ add_theme_support('title-tag'); /* * This theme supports a variety of post formats. */ add_theme_support('post-formats', array('aside', 'gallery', 'image', 'video', 'quote', 'audio', 'link', 'status',)); /* * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'primary' => __('Primary Menu', 'artwork-lite') )); /* * This theme uses its own gallery styles. */ add_filter('use_default_gallery_style', '__return_false'); /* * Add theme support post thumbnails. */ if (function_exists('add_theme_support')) { add_theme_support('post-thumbnails'); set_post_thumbnail_size(770, 578, true); } add_image_size('thumb-large', 1600, 900, true); add_image_size('thumb-large-blog', 1170, 543, true); add_image_size('thumb-medium', 960, 640, true); } add_action('after_setup_theme', 'theme_setup'); /** * Artwork page menu. * * Show pages of site. * * @since Artwork 1.0 */ function theme_wp_page_menu() { echo ''; } /** * Artwork page top menu. * * Show pages of site. * * @since Artwork 1.0 */ function theme_wp_page_short_menu() { echo''; } /* Return the Google font stylesheet URL, if available. * * The use of Open Sans by default is localized. * * @since 1.0.0 * @access public * @return void */ function theme_load_google_fonts() { wp_register_style('Roboto', 'https://fonts.googleapis.com/css?family=Roboto:400,300,700,300italic&subset=latin,cyrillic'); wp_enqueue_style('Roboto'); } add_action('wp_print_styles', 'theme_load_google_fonts'); /** * Enqueue scripts and styles for the front end. */ function theme_scripts_styles() { /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if (is_singular() && comments_open() && get_option('thread_comments')) wp_enqueue_script('comment-reply'); /* * Scripts for template masonry blog */ wp_enqueue_script('jquery.infinitescroll', get_template_directory_uri() . '/js/jquery.infinitescroll.min.js', array('jquery'), '2.1.0', true); wp_enqueue_script('superfish.min', get_template_directory_uri() . '/js/superfish.min.js', array('jquery'), '1.7.5', true); wp_enqueue_script('jquery-labelauty', get_template_directory_uri() . '/js/jquery-labelauty.min.js', array('jquery',), '1.1', true); wp_enqueue_script('artwork-script', get_template_directory_uri() . '/js/artwork.min.js', array('jquery', 'superfish.min', 'jquery-labelauty', 'jquery.infinitescroll'), '1.0', true); $translation_array = array( 'url' => get_template_directory_uri() ); wp_localize_script('artwork-script', 'template_directory_uri', $translation_array); /* * Loads Artwork Styles */ wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array('bootstrap'), '4.3.0', 'all'); wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.5', 'all'); wp_enqueue_style('main', get_template_directory_uri() . '/css/artwork-style.min.css', array('bootstrap', 'font-awesome'), '1.0', 'all'); if (is_plugin_active('motopress-content-editor/motopress-content-editor.php') || is_plugin_active('motopress-content-editor-lite/motopress-content-editor.php')) { wp_enqueue_style('artwork-ames-motopress', get_template_directory_uri() . '/css/artwork-motopress.min.css', array('bootstrap', 'font-awesome', 'main'), '1.0', 'all'); } if (is_plugin_active('woocommerce/woocommerce.php')) { wp_enqueue_style('artwork-woocommerce', get_template_directory_uri() . '/css/artwork-woocommerce.min.css', array('bootstrap', 'font-awesome', 'main'), '1.0', 'all'); } if (is_plugin_active('bbpress/bbpress.php')) { wp_enqueue_style('artwork-bbpress', get_template_directory_uri() . '/css/artwork-bbpress.min.css', array('bootstrap', 'font-awesome', 'main'), '1.0', 'all'); } if (is_rtl()) { wp_enqueue_style('artwork-rtl', get_template_directory_uri() . '/css/artwork-rtl.min.css', array('bootstrap', 'font-awesome', 'main'), '1.0', 'all'); } /* * Loads our main stylesheet. */ wp_enqueue_style('artwork-style', get_stylesheet_uri(), array(), '1.0'); } add_action('wp_enqueue_scripts', 'theme_scripts_styles'); /** * Add favicon */ add_action('wp_head', 'theme_favicon', 4); /** * Title Tag backwards compatibility for older versions * */ if (!function_exists('_wp_render_title_tag')) { function theme_slug_render_title() { ?> max_num_pages > 1) : ?> __('Main Widget Area', 'artwork-lite'), 'id' => 'sidebar-1', 'description' => __('Appears on posts and pages in the sidebar.', 'artwork-lite'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'theme_widgets_init'); /* * Post comments */ function theme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; extract($args, EXTR_SKIP); if ('div' == $args['style']) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } ?> < id="comment-">
%s', get_comment_author_link()); ?> comment_approved == '0') : ?>
at %2$s', 'artwork-lite'), get_comment_date('F j, Y'), get_comment_time()); ?>
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
', esc_url(get_day_link($archive_year, $archive_month, $archive_day)), esc_attr(get_the_time()), esc_attr(get_the_date('c')), esc_html(get_the_date())); } else { printf('', esc_attr(get_the_date('c')), esc_html(get_the_date())); } } /* * Get list term */ function theme_get_term_list($term_list) { foreach ($term_list as $term) { echo '' . $term->name . ''; if ($term != end($term_list)) : echo ", "; endif; } } /* * Post Category */ function theme_post_category($post) { if (get_theme_mod('theme_show_categories', '1') === '1' || get_theme_mod('theme_show_categories')): if (strcmp(get_post_type($post), 'post') === 0) : ?> , ', 'multiple', $post->ID); ?> / ID, $postTypeSlugName, array("fields" => "all")); ?> / term_id) . '" title="' . sprintf(__("View all posts in %s", 'artwork-lite'), $category[0]->name) . '" ' . ' class="category-wrapper">' . $category[0]->name . ' '; } } /* * Post Tag */ function theme_post_tag($post) { if (get_theme_mod('theme_show_tags', '1') === '1' || get_theme_mod('theme_show_tags')): if (strcmp(get_post_type($post), 'post') === 0) : the_tags('/ ' . __('Tagged with', 'artwork-lite') . ' ', ', ', ''); else: $postTypeSlug = theme_get_post_type_slug(); $postTypeSlugName = 'post_tag_' . $postTypeSlug; $term_list = wp_get_post_terms($post->ID, $postTypeSlugName, array("fields" => "all")); if (!empty($term_list)) : ?> / post_content)); $embeds = get_media_embedded_in_content($content); if (!empty($embeds)) { return '
' . $embeds[0] . '
'; } else { return false; } } function theme_get_content_theme($contentLength) { ?> (.*?)<\/(script|style)>/is', '', $content); if (strlen($content) > $contentLength) { $content = extension_loaded('mbstring') ? mb_substr($content, 0, $contentLength) . '...' : substr($content, 0, $contentLength) . '...'; } echo $content; ?> /i', $post->post_content, $matches); if (!empty($matches[1])) { $first_img = $matches[1][0]; if (empty($first_img)) { $first_img = ""; } } return $first_img; } add_filter('wp_audio_shortcode', 'theme_audio_short_fix', 10, 5); function theme_audio_short_fix($html, $atts, $audio, $post_id, $library) { $html = str_replace('visibility: hidden;', '', $html); return $html; } require get_template_directory() . '/inc/theme/tgm-init.php'; /* * Activate theme */ require get_template_directory() . '/classes/theme/class-theme-install.php'; /* * Theme Wizared */ add_action('after_switch_theme', 'theme_artwork_activation'); function theme_artwork_activation() { $isThemeActivation = apply_filters('theme_activation', true); if ($isThemeActivation) { wp_redirect(esc_url(home_url('/wp-admin/admin.php?page=theme-setup'))); } } function theme_posttype_name_sanitize_text($txt) { $txt = strip_tags($txt, ''); $txt = preg_replace("/[^a-zA-Z0-9-]+/", "", $txt); $txt = substr(strtolower($txt), 0, 19); return wp_kses_post(force_balance_tags($txt)); } /* * Get post type slug * * @return string */ function theme_get_post_type_slug() { $theme_post_type_slug = theme_posttype_name_sanitize_text(get_option('theme_post_type_slug')); if (empty($theme_post_type_slug)) { $theme_post_type_slug = "works"; } return $theme_post_type_slug; } function theme_get_first_link() { if (!preg_match('/]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches)) { return false; } return esc_url_raw($matches[1]); }