exists(); return $result; } /** * Print the menu which is located in the main navigation. * * @since 0.6 */ function affvc_the_main_menu() { $main_menu = Menu_Helper::get_main_menu(); $main_menu->render(); } /** * Check the absence of the menu which is located in the footer plinth. * * @since 0.6 * @return bool */ function affvc_has_footer_plinth_menu() { $menu = Menu_Helper::get_footer_plinth_menu(); $exists = $menu->exists(); return $exists; } /** * Print the menu which is located in the footer plinth. * * @since 0.6 */ function affvc_the_footer_plinth_menu() { $main_menu = Menu_Helper::get_footer_plinth_menu(); $main_menu->render(); } /** * Check the absence of the first menu which is located in the footer content. * * @since 0.6 * @return bool */ function affvc_has_footer_content_first_menu() { $menu = Menu_Helper::get_footer_content_first_menu(); $exists = $menu->exists(); return $exists; } /** * Print the first menu which is located in the footer content. * * @since 0.6 */ function affvc_the_footer_content_first_menu() { $main_menu = Menu_Helper::get_footer_content_first_menu(); $main_menu->render(); } /** * Check the absence of the second menu which is located in the footer content. * * @since 0.6 * @return bool */ function affvc_has_footer_content_second_menu() { $menu = Menu_Helper::get_footer_content_second_menu(); $exists = $menu->exists(); return $exists; } /** * Print the second menu which is located in the footer content. * * @since 0.6 */ function affvc_the_footer_content_second_menu() { $main_menu = Menu_Helper::get_footer_content_second_menu(); $main_menu->render(); } /** * Check if there is a default logo. * * @since 0.2 * @return bool */ function affvc_has_logo() { return !empty(affvc_get_logo()); } /** * Get the default logo. * * @since 0.2 * @return string */ function affvc_get_logo() { $logo = get_theme_mod('affvc-information-logo'); return $logo; } /** * Check if there is a retina logo. * * @since 0.2 * @return bool */ function affvc_has_retina_logo() { return !empty(affvc_get_retina_logo()); } /** * Get the retina logo. * * @since 0.2 * @return string */ function affvc_get_retina_logo() { $retina_logo = get_theme_mod('affvc-information-logo-retina'); return $retina_logo; } /** * List the comments with bootstrap components. * This function is just a wrapper for wp_list_comments. * * @see https://codex.wordpress.org/_function__reference/wp_list_comments * @since 0.3.4 * @param array $args */ function affvc_list_comments($args = array()) { $args = wp_parse_args($args, array( 'style' => 'ul', 'max_depth' => 1, 'short_ping' => true, 'avatar_size' => '64', 'walker' => new Bootstrap_Comment_Walker(), )); wp_list_comments($args); } /** * Check if the post has the current post type * * @since 0.4.2 * @param $type * @return bool */ function affvc_is_post_type($type) { global $wp_query; if($type == get_post_type($wp_query->post->id)) { return true; } return false; } /** * Check if the website has a copyright text. * * @since 0.6 * @return bool */ function affvc_has_copyright() { return !empty(affvc_get_copyright()); } /** * Get the copyright text of the website. * * @since 0.6 * @return string */ function affvc_get_copyright() { $copyright = get_theme_mod('affvc-information-copyright-text'); $default = 'Copyright © ' . date('Y'); return !empty($copyright) ? $copyright : $default; } /** * Print the copyright text of the website. * * @since 0.6 */ function affvc_the_copyright() { echo affvc_get_copyright(); } /** * Check if the breadcrumbs are enabled. * This function uses the Yoast SEO breadcrumbs. Please install the related plugin: * https://de.wordpress.org/plugins/wordpress-seo/ * * @since 0.6 * @return bool */ function affvc_has_breadcrumbs() { if(!function_exists('yoast_breadcrumb')) { return false; } $internalLinks = get_option('wpseo_internallinks', null); if(!isset($internalLinks['breadcrumbs-enable']) || $internalLinks['breadcrumbs-enable'] == false) { return false; } return true; } /** * Print the breadcrumbs. * This function uses the Yoast SEO breadcrumbs. Please install the related plugin: * https://de.wordpress.org/plugins/wordpress-seo/ * * @since 0.6 */ function affvc_the_breadcrumbs() { if(affvc_has_breadcrumbs()) { yoast_breadcrumb(''); } } /** * Check if the footer content is hidden. * * @since 0.8 * @return bool */ function affvc_is_footer_content_hidden() { $hidden = get_theme_mod('affvc-footer-content-hidden'); return !empty($hidden) && $hidden == 1; } /** * Check if there is an existing Facebook link. * * @since 0.6 * @return bool */ function affvc_has_facebook_link() { return !empty(affvc_get_facebook_link()); } /** * Get the Facebook link. * * @since 0.6 * @return null|string */ function affvc_get_facebook_link() { $facebook_link = get_theme_mod('affvc-footer-plinth-facebook-link'); if(empty($facebook_link)) { return null; } return $facebook_link; } /** * Print the Facebook link. * * @since 0.6 */ function affvc_the_facebook_link() { $link = affvc_get_facebook_link(); $link = !empty($link) ? $link : '#'; echo $link; } /** * Check if there is an existing Twitter link. * * @since 0.6 * @return bool */ function affvc_has_twitter_link() { return !empty(affvc_get_twitter_link()); } /** * Get the Twitter link. * * @since 0.6 * @return null|string */ function affvc_get_twitter_link() { $twitter_link = get_theme_mod('affvc-footer-plinth-twitter-link'); if(empty($twitter_link)) { return null; } return $twitter_link; } /** * Print the Twitter link. * * @since 0.6 */ function affvc_the_twitter_link() { $link = affvc_get_twitter_link(); $link = !empty($link) ? $link : '#'; echo $link; } /** * Check if there is an existing Google Plus link. * * @since 0.6 * @return bool */ function affvc_has_google_plus_link() { return !empty(affvc_get_google_plus_link()); } /** * Get the Google Plus link. * * @since 0.6 * @return null|string */ function affvc_get_google_plus_link() { $google_plus_link = get_theme_mod('affvc-footer-plinth-google-plus-link'); if(empty($google_plus_link)) { return null; } return $google_plus_link; } /** * Print the Google Plus link. * * @since 0.6 */ function affvc_the_google_plus_link() { $link = affvc_get_google_plus_link(); $link = !empty($link) ? $link : '#'; echo $link; } /** * Check if there is an existing Pinterest link. * * @since 0.6 * @return bool */ function affvc_has_pinterest_link() { return !empty(affvc_get_pinterest_link()); } /** * Get the Pinterest link. * * @since 0.6 * @return null|string */ function affvc_get_pinterest_link() { $pinterest_link = get_theme_mod('affvc-footer-plinth-pinterest-link'); if(empty($pinterest_link)) { return null; } return $pinterest_link; } /** * Print the Pinterest link. * * @since 0.6 */ function affvc_the_pinterest_link() { $link = affvc_get_pinterest_link(); $link = !empty($link) ? $link : '#'; echo $link; } /** * Check if there is an existing Reddit link. * * @since 0.6 * @return bool */ function affvc_has_reddit_link() { return !empty(affvc_get_reddit_link()); } /** * Get the Reddit link. * * @since 0.6 * @return null|string */ function affvc_get_reddit_link() { $reddit_link = get_theme_mod('affvc-footer-plinth-reddit-link'); if(empty($reddit_link)) { return null; } return $reddit_link; } /** * Print the Reddit link. * * @since 0.6 */ function affvc_the_reddit_link() { $link = affvc_get_reddit_link(); $link = !empty($link) ? $link : '#'; echo $link; } /** * Get the query for the latest products. * * @since 0.6 * @param int $number * @return WP_Query */ function affvc_get_latest_products_query($number = 3) { $query = aff_get_products_query(array( 'posts_per_page' => $number, 'order_by' => 'date', 'order' => 'DESC' )); return $query; } /** * Get the query for the best rated products. * * @since 0.6 * @param int $number * @return WP_Query */ function affvc_get_best_rated_products_query($number = 3) { $query = aff_get_products_query(array( 'posts_per_page' => $number, 'meta_key' => Carbon_Product_Repository::REVIEW_RATING, 'order_by' => 'meta_value', 'order' => 'DESC' )); return $query; } /** * Get the sidebar position of the whole website. * * @since 0.7 * @return string */ function affvc_get_sidebar_position() { $position = get_theme_mod('affvc-content-main-sidebar-position'); $position = !empty($position) ? $position : 'right'; return $position; } /** * Check if the sidebar of the whole website is on the left side. * * @since 0.7 * @return bool */ function affvc_is_sidebar_position_left() { $position = affvc_get_sidebar_position(); return $position === 'left'; } /** * Check if the sidebar of the whole website is on the right side. * * @since 0.7 * @return bool */ function affvc_is_sidebar_position_right() { $position = affvc_get_sidebar_position(); return $position === 'right'; } /** * Check if the current user can edit posts. * * @since 0.7 * @return bool */ function affvc_can_edit_post() { if(!is_user_logged_in()) { return false; } $current_user = wp_get_current_user(); $allowed_roles = array('editor', 'administrator', 'author'); return !empty(array_intersect($allowed_roles, $current_user->roles)); } /** * Check if the buy button is hidden. * * @since 0.6.2 * @return bool */ function affvc_is_buy_button_hidden() { $hidden = get_theme_mod('affvc-content-button-buy-hidden'); return !empty($hidden) && $hidden == 1; } /** * Check if the test review button is hidden. * * @since 0.6.2 * @return bool */ function affvc_is_test_review_button_hidden() { $hidden = get_theme_mod('affvc-content-button-review-hidden'); return !empty($hidden) && $hidden == 1; } /** * Get the buy button text. * * @since 0.7.3 * @param null|array $shop * @return string */ function affvc_get_buy_button_text($shop = null) { $text = get_theme_mod('affvc-content-button-buy-text'); if(empty($text)) { return __('Buy now at %s', 'affilivice'); } if(isset($shop['name']) && strpos($text, '%s') !== false) { $text = sprintf($text, $shop['name']); } return $text; } /** * Print the buy button text. * * @since 0.7.3 * @param null|array $shop */ function affvc_the_buy_button_text($shop = null) { echo affvc_get_buy_button_text($shop); } /** * Get the not available button text. * * @since 0.7.3 * @param null|array $shop * @return string */ function affvc_get_not_available_button_text($shop = null) { $text = get_theme_mod('affvc-content-button-not-available-text'); if(empty($text)) { return __('Unfortunately not available.', 'affilivice'); } if(isset($shop['name']) && strpos($text, '%s') !== false) { $text = sprintf($text, $shop['name']); } return $text; } /** * Print the not available button text. * * @since 0.7.3 * @param null|array $shop */ function affvc_the_not_available_button_text($shop = null) { echo affvc_get_not_available_button_text($shop); } /** * Get the test review button text. * * @since 0.7.3 * @return string */ function affvc_get_test_review_button_text() { $text = get_theme_mod('affvc-content-button-review-text'); if(empty($text)) { return __('To the test review', 'affilivice'); } return $text; } /** * Print the not text review button text. * * @since 0.7.3 */ function affvc_the_test_review_button_text() { echo affvc_get_test_review_button_text(); } /** * Check if the taxonomy title is hidden. * * @since 0.8 * @return bool */ function affvc_is_taxonomy_title_hidden() { $hidden = get_theme_mod('affvc-content-taxonomy-title-hidden'); return !empty($hidden) && $hidden == 1; } /** * Check if the taxonomy description is hidden. * * @since 0.8 * @return bool */ function affvc_is_taxonomy_description_hidden() { $hidden = get_theme_mod('affvc-content-taxonomy-description-hidden'); return !empty($hidden) && $hidden == 1; } /** * Display buttons to link the posts or pages. * * @since 0.8 * @param array $args */ function affvc_link_pages($args = array()) { $args = wp_parse_args($args, array( 'before' => '