i try to get posts via query wordpress
i need to fetch the posts thats's in spacfic taxonamy
تصميم تطبيقات
<?php
get_query_var('taxonomy');
$taxonomy = 'eposd_category';
$terms = get_terms($taxonomy); // Get all terms of a taxonomy
if ( $terms && !is_wp_error( $terms ) ) :
?>
<?php foreach ( $terms as $term ) { ?>
<div class="col-sm-3">
<div class="item">
<div class="load">
<?php echo z_taxonomy_image($lug term->term_s); ?>
<div class="load-icon text-center">
<i class="fa fa-play"></i>
</div>
</div>
<div class="item-content">
<h2><?php echo $term->name; ?></h2>
</div>
</div>
</div>
<?php } ?>
<?php endif;?>
تصميم العاب
Related
I use ACF repeater in my wordpress website.
Each repeater display in a col-md-6.
I would like to display the last in a col-md-12.
<div class="container">
<?php if ( have_rows( 'salon' ) ) : ?>
<div class="row">
<?php while ( have_rows( 'salon' ) ) : the_row(); ?>
<div class="col-md-6">
<div class="card">
<div class="card-body">
<h2 class="card-title">Card title</h2>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
</div>
Try this example with your code it's working for me.
<?php if( have_rows('services_repeater', $services) ): ?>
<?php $rowCount = count( get_field('services_repeater', $services) ); //GET THE COUNT ?>
<?php $i = 1; ?>
<?php while( have_rows('services_repeater', $services) ): the_row(); ?>
<?php // vars
$service = get_sub_field('service');
$description = get_sub_field('description');
?>
<span class="hint--bottom" data-hint="<?php echo $description; ?>"><?php echo $service; ?></span>
<?php if($i < $rowCount): ?>
<div id="separator"> / </div>
<?php endif; ?>
<?php $i++; ?>
<?php endwhile; ?>
<?php endif; ?>
I'm really a beginner for creating and displaying custom tax on WordPress.
I created a custom Genre taxonomy and I'm displaying this with this:
<?php $terms = get_the_terms( get_the_ID(), 'movie_genre' ); if( $terms ): ?>
<!-- Movie Genre -->
<div class="slideout-heading">
<div class="d-inline-block">
<h5><?php esc_html_e( 'Genre'); ?></h5>
</div>
</div>
<div class="row">
<div class="carousel mb-3 w-100" data-flickity='{ "pageDots": false, "imagesLoaded": true, "prevNextButtons": true, "cellAlign": "left", "contain": true, "groupCells": true }'>
<?php foreach( $terms as $term ): ?>
<?php
$attachment_id = get_field('taxonomy_image', $term);
$size = "wp-img-square-profile"; // (thumbnail, medium, large, full or custom size)
$genreimage = wp_get_attachment_image_src( $attachment_id, $size );
?>
<div class="col-3 py-3">
<div class="mb-2">
<a href="<?php echo get_term_link( $term ); ?>">
<?php if( $attachment_id ) {
echo '<img class="img-fluid border-class shadow-sm" src="'. $genreimage[0] .'" />';
} else {
wp_default_img_placeholder();
}
?>
</a>
</div>
<div class="author-list-name px-1">
<?php echo esc_attr ($term->name); ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
How could I display Genres Parent & Child together another and other? I can display selected parent and child for the custom taxonomy but could not relate with a parent it's just showing one by one not related with the parent but I would like to relate the group Parent-Child :)
-Action
best actor
best music
-Adventure
best music
output
Custom_Movie_Genre_Taxonomy
Thanks a lot for your help!
I have made the visual composer addon to meet one of the requirement. However I have found that it always come above the other vc elements.
I have tried to add the class as per vc composer other elements
public function sim_product($attr)
{
?>
<div class="vc_column-inner"><div class="wpb_wrapper">
<div class="wpb_text_column wpb_content_element ">
<div class="wpb_wrapper">
<div class="more-project-list">
<?php
$select = $attr['sim_product_id'];
$query = new WP_Query( array( 'post_type' => 'products','post__in' => explode(",",$select) ));
if ( $query->have_posts() ) { ?>
<?php while ( $query->have_posts() )
{ $query->the_post(); ?>
<div class="single-blk" style='background-color: <?php echo the_field('colour');?>'>
<div class="title">
<?php the_title();?>
</div>
<figure>
<?php if (has_post_thumbnail( $query->ID ) )
{
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $query->ID ), 'single-post-thumbnail' ); ?>
<img src="<?php echo $image[0]; ?>" alt="">
<?php }?>
</figure>
<div class="category">
<?php
$terms = wp_get_post_terms( $query->post->ID, array( 'Product_category') );
foreach ( $terms as $term ) { echo $term->name;}
?>
</div>
</div>
<?php }}?>
</div>
</div></div></div></div>
<?php
}
It isnt coming where I have placed it it always come on top
I create custom post type "portfolio" and create custom meta box with value key "_portfolio_name_value_key". but when I try to retrieve the saved value in frontend it did not show.
i used this code:
<?php get_post_meta( $post->ID, '_portfolio_name_value_key' ); ?> in single-portfolio.php page,
however title, featured image, custom taxonomy and content had no problem displaying.
Here is full code I used:
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post(); ?>
<div class=row>
<div class="col-xs-12 col-md-8 col-sm-8">
<div class="owl-carousel owl-theme project-detail-carousel"id=project_detail>
<div class=project-detail-item><img alt=p-detail src="<?php the_post_thumbnail(''); ?>"></div>
</div>
</div>
<div class="col-xs-12 col-sm-4 col-md-4">
<div class=project-detail-1>
<h2><?php the_title(); ?></h2>
<ul>
<li><span>Client:</span><?php get_post_meta( $post->ID, '_portfolio_name_value_key' ); ?>
<li><span>Category:</span> <?php the_terms( $post->ID, 'field' ); ?>
<li><span>Status:</span> <?php get_post_meta( $post->ID, '_portfolio_status_value_key' ); ?>
<li><span>Tags:</span> <?php the_terms( $post->ID, 'ptag' ); ?>
<li><span>Date:</span> <?php get_post_meta( $post->ID, '_portfolio_date_value_key' ); ?>
</ul>
</div>
</div>
</div>
<div class="row mt-50">
<div class=col-md-12>
<div class=project-detail-1-info>
<h3>A little About This Project</h3>
<div class=text-content>
<?php the_content(); ?>
</div>
</div>
</div>
</div>
<?php
endwhile;
endif;
?>
As it seems you are using a loop. In the loop, you should use get_the_ID() function.
From:
<?php get_post_meta( $post->ID, '_portfolio_name_value_key' ); ?>
To:
<?php get_post_meta(get_the_ID(), '_portfolio_name_value_key' ); ?>
Try This:-
<?php
$wpb_all_query = new WP_Query(array('post_type'=>'post', 'post_status'=>'publish', 'posts_per_page'=>-1));
if ( $wpb_all_query->have_posts() ) { ?>
<div class=row>
<div class="col-xs-12 col-md-8 col-sm-8">
<div class="owl-carousel owl-theme project-detail-carousel"id=project_detail>
<div class=project-detail-item><img alt=p-detail src="<?php the_post_thumbnail(''); ?>"></div>
</div>
</div>
<div class="col-xs-12 col-sm-4 col-md-4">
<div class=project-detail-1>
<h2><?php the_title(); ?></h2>
<ul>
<li><span>Client:</span><?php get_post_meta( get_the_ID(), '_portfolio_name_value_key', true ); ?>
<li><span>Category:</span> <?php the_terms( get_the_ID(), 'field' ,true ); ?>
<li><span>Status:</span> <?php get_post_meta( get_the_ID(), '_portfolio_status_value_key' ,true ); ?>
<li><span>Tags:</span> <?php the_terms( get_the_ID(), 'ptag' ,true ); ?>
<li><span>Date:</span> <?php get_post_meta( get_the_ID(), '_portfolio_date_value_key' ,true ); ?>
</ul>
</div>
</div>
</div>
<div class="row mt-50">
<div class=col-md-12>
<div class=project-detail-1-info>
<h3>A little About This Project</h3>
<div class=text-content>
<?php the_content(); ?>
</div>
</div>
</div>
</div>
<?php wp_reset_postdata(); }?>
<ul>
<li>Office Painting – the Easy Way</li>
<li>12 Questions to Ask – <i>Before</i> You Hire a Painter</li>
<li>Price, Service & Sketchy Dudes</li>
<li>Top 3 Must-Haves When Hiring A Paint Contractor</li>
<li>Top 5 Uninsured Contractor What-if’s</li>
</ul>
get_post_meta() returns a value instead of echo it.
So you need to echo it like this:
<?php echo get_post_meta( get_the_ID(), '_portfolio_date_value_key' ,true ); ?>
I want to implement pagination on custom post type of a custom taxonomy.
but it is not showing the pagination links only shows on default posts but not working. When I click on next link it redirect me to the index page.
Any help.(New to Wordpress)
Code
<?php $term = get_queried_object();
$taxonomy = get_taxonomy($term->taxonomy);
?>
<div class="panel-heading"><h4><?php echo 'محصولات : '.$term->name;?></h4></div>
<div class="panel-body">
<?php
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$args = array('post_type'=>'my_product', 'taxonomy'=>$taxonomy->name,
'posts_per_page'=> 1,
'term'=>$term->slug, 'paged'=>$paged);
$query = new WP_Query($args);
if ($query->have_posts()) {
while ($query->have_posts()): $query->the_post(); ?>
<div class="thumbnail">
<?php if (has_post_thumbnail()) {
the_post_thumbnail('featured');
} ?>
<div class="caption caption-content">
<h3><?php the_title(); ?></h3>
<p class="text-muted">
<!-- <strong>نویسنده:</strong> <?php //the_author();?> -->
تاریخ: <?php the_date(); ?></p>
<p> <?php the_excerpt(); ?> </p>
<div>
<p class="price-box">
<i class="fa fa-circle"> </i>قیمت:
<?php if (the_field('price') == '') {
// echo "00.00";
} else {
the_field('price');
} ?>
</p>
</div>
</div>
<hr>
</div>
<?php endwhile;
}
else {
echo '<h3>هیچ موردی درین بخش یافت نشد.</h3>';
}
?>
<!-- pagination here -->
<p> <?php
if (function_exists("custom_pagination")):
custom_pagination($custom_query->max_num_pages,"",$paged);
endif;
?>
<?php wp_reset_postdata(); ?>
</p>
</div>