<?php if ( in_category( 'shows' )): ?>
<?php $current_id = get_the_ID();
echo do_shortcode('[ajax_load_more post__not_in="'. $current_id .'" id="post-feed-ajax" loading_style="blue" container_type="ul" post_type="post" orderby="menu_order" posts_per_page="8" category="shows" button_label="Load more blog posts" button_loading_label="Loading posts..." scroll="false"]'); ?>
<?php elseif ( in_category( 'blog' )): ?>
<?php $current_id = get_the_ID();
echo do_shortcode('[ajax_load_more post__not_in="'. $current_id .'" id="post-feed-ajax" loading_style="blue" container_type="ul" post_type="post" orderby="menu_order" posts_per_page="4" category="blog" button_label="Load more blog posts" button_loading_label="Loading posts..." scroll="false"]'); ?>
<?php else: ?>
<?php endif; ?>
Category: WordPress
<?php
$ua = $_SERVER['HTTP_USER_AGENT'];
if((strpos($ua,'iPhone')!==false)||
(strpos($ua,'Android')!==false)) {
header("Location:/mobile/");
exit();
}
?>
<?php
function get_custom_cat_template($single_template) {
global $post;
if ( in_category( 'category-name' )) {
$single_template = dirname( __FILE__ ) . '/single-template.php';
}
return $single_template;
}
add_filter( "single_template", "get_custom_cat_template" ) ;
?>
Source: https://stanhub.com/create-wordpress-single-template-for-a-specific-category-or-custom-post-type/
// Add ACF Info to Product display page
add_action( 'woocommerce_after_single_product_summary', "ACF_product_content", 10 );
function ACF_product_content(){
echo '<h2> ACF Content </h2>';
if (function_exists('the_field')){
echo '<p>Woohoo, the_field function exists! </p>';
the_field('test_field');
}
}
//declaring menu property in functions.php
register_nav_menus(
array(
'main_nav' => 'main Navigation Menu'
)
);
//declaring widget property in HTML
<?php wp_nav_menu(array('menu' => 'Name of Menu')); ?>
//*"Name of Menu" is the name of the menu declared at "Menus" settings.
//declaring widget property in fuctions.php
register_sidebar(
array(
'name' => 'Sidebar Widgets',
'id' => 'sidebar-widgets',
'description' => 'Widgets for Sidebar',
'before_widget' => '<div class="XXXXX">',
'after_widget' => '</div>',
'before_title' => '<h2 class="XXXXXX">',
'after_title' => '</h2>'
)
);
//declaring widget property in HTML
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Name of Widgetized Area") ) : ?>
<?php endif;?>
// Customize the login page
function my_login_logo_one() {
?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/xxxxxx_logo.png);
padding-bottom: 36px;
width: 155px;
height: 126px;
background-size: 155px;
}
</style>
<?php
} add_action( 'login_enqueue_scripts', 'my_login_logo_one' );
Create an image field with the field name of “_thumbnail_id”, and ACF will just update the featured image for you.
Resources:
https://support.advancedcustomfields.com/forums/topic/set-featured-image-from-acf-image-field/
<ul>
<?php echo get_the_term_list( $post->ID, 'keywords', '<li>', ', ', '</li>' ) ?>
</ul>
<?php
$terms = get_the_terms( get_the_ID(), 'custom_post_type_slug' );
if ( !empty($terms) ) : if ( !is_wp_error($terms) ) :
?>
<?php foreach( $terms as $term ) : ?>
<?php echo $term->name; ?> 
<?php endforeach; ?>
<?php endif; endif; ?>
<?php
$wp_query = new WP_Query();
$param = array(
'posts_per_page' => '10',
'post_type' => 'vidablog',
'post_status' => 'publish',
'orderby' => 'post_date',
'order' => 'DESC',
'paged' => $paged
);
$wp_query->query($param);
if($wp_query->have_posts()): while($wp_query->have_posts()) : $wp_query->the_post();
?>
//You need to avoid special characters (accept alpha-numeric characters only)
<?php if(get_field('text_block')): ?>
<ul>
<?php while(has_sub_field('text_block')): ?>
<li><a href="<?php the_permalink() ?>#<?php echo preg_replace('/[^A-Za-z0-9]/', "", get_sub_field('paragrah_header')); ?>" class="scroll-anchor"><?php the_sub_field('paragrah_header'); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<h2 id="<?php echo preg_replace('/[^A-Za-z0-9]/', "", get_sub_field('paragrah_header')); ?>"><?php the_sub_field('paragrah_header'); ?></h2>
function wpb_add_google_fonts() {
wp_enqueue_style( 'wpb-google-fonts', 'https://fonts.googleapis.com/css2?family=Muli:ital,wght@0,300;0,400;0,700;1,300;1,400&display=swap', false );
}
add_action( 'wp_enqueue_scripts', 'wpb_add_google_fonts' );