Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get current post category id wordpress

global $wp_query;
$postcat = get_the_category( $wp_query->post->ID );
Comment

get category post in wordpress

echo '<p>'. get_the_category( $id )[0]->name .'</p>';
Comment

get_post by category in wordpress

<?php

                            $args = array('posts_per_page' => 10, 'offset' => 0, 'category' => 11);

                            $myposts = get_posts($args);
                            $count=1;
                            foreach ($myposts as $post) : setup_postdata($post); ?>
                                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-6 col-xl-6">
                                    <div class="portfolio-list" data-aos="fade-up">
                                        <div class="portfolio-image">
                                            <h6>Case Study - <?php echo $count ?></h6>
                                            <div class="portfolio-detail-image">
                                                <img src="<?php the_post_thumbnail_url() ?>" class="img-fluid" alt="Olam Solutions">
                                            </div>
                                        </div>
                                        <div class="portfolio-content" data-aos="fade-up">
                                            <h3><a href="<?php the_permalink();  ?>"><?php the_title(); ?></a></h3>
                                            <p>Website Design & Development</p>
                                            <a href="<?php the_permalink();  ?>" class="view-case-btn">View Case <span class="icon-right-arrow"></span></a>
                                        </div>
                                    </div>
                                </div>
                            <?php
                            $count= $count+1;
                            endforeach;
                            wp_reset_postdata();

                            ?>
Comment

get category of current post wordpress

$active_categories = get_the_category();
Comment

PREVIOUS NEXT
Code Example
Php :: laravel capsule schema datatime CURRENT_TIMESTAMP 
Php :: php if short form 
Php :: upload images php mysql 
Php :: update php version wamp windows 
Php :: random string value laravel 
Php :: php explode end 
Php :: php header x forwarder for 
Php :: return with success message laravel 
Php :: switch php versions 
Php :: ziparchive php example 
Php :: rawbetween in laravel 
Php :: file_get_content 
Php :: add brackets to string php 
Php :: throw 403 laravel 
Php :: php call constant in class 
Php :: {{count laravel 
Php :: get taxonomy name in taxonomy page wordpress dev 
Php :: ?? Null Coalescing Operator PHP 
Php :: laravel observer get old value 
Php :: laravel validation string type 
Php :: symfony messenger transport 
Php :: aws sdk php 
Php :: woocommerce return to shop custom url 
Php :: laravel Form::hidden 
Php :: laravel use controller function in another controller 
Php :: create weekly calendar in php 
Php :: laravel 8 with jetstream 
Php :: check current user role 
Php :: php get user county 
Php :: carbon if date is today 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =