Skip to content

Instantly share code, notes, and snippets.

@prosantamazumder
Last active May 17, 2020 12:48
Show Gist options
  • Save prosantamazumder/580e2ddb7840eeb8e8ec2d6f953d8955 to your computer and use it in GitHub Desktop.
Save prosantamazumder/580e2ddb7840eeb8e8ec2d6f953d8955 to your computer and use it in GitHub Desktop.
NO NEED
wp-content\themes\veera\framework\classes\class-admin.php
-------------------------------------------------------
<li class="filter active" data-filter="all">Show All</li>
<?php
$topics = get_terms( array(
'hide_empty' => 0,
'taxonomy' => 'portfolio_cat',
'orderby' => 'id',
));
foreach($topics as $topic){
$link = get_term_link( $topic, 'portfolio_cat' );
$performperform = $topic->name;
$performname = $topic->slug;
echo '<li class="filter" data-filter=".'.$performname.'">'.$performperform.'</li>';
}
?>
<?php
if ( $posts->have_posts() ) :
while( $posts->have_posts() ) : $posts->the_post();
$thumbnails = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full');
$terms = wp_get_post_terms( get_the_ID(), 'portfolio_cat');
?>
<!-- Portfolios Single Item -->
<div class="project-items mix <?php foreach( $terms as $term ){
$performperform = $term->slug; echo ' '.$performperform; } ?> ">
<img src="<?php echo $thumbnails[0]; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />
<div class="project-content text-center">
<a class="popup" href="<?php echo $thumbnails[0]; ?>"><span>+</span></a>
<h3><?php the_title(); ?></h3>
<p>
<?php
$terms = get_the_terms( get_the_ID() , 'portfolio_cat' );
foreach ( $terms as $term ) {
echo $term->name . ' | ';
}
?>
</p>
</div>
</div>
<?php endwhile; wp_reset_postdata(); ?>
<?php else : //ECHO POST NOT FOUND ?>
<p>
<?php esc_html_e( 'Sorry, No Post matched your criteria. Please Add New Post Thank You..!' ); ?></p>
<?php endif; ?>
/* Portfolio P-IT */
if( !function_exists('portfolio_custom_post') ) :
//Example Custom post
function portfolio_custom_post_type() {
register_post_type( 'portfolio',
array(
'labels' => array(
'name' => __( 'Our Portfolios', 'naillash' ),
'singular_name' => __( 'Our Portfolio', 'naillash' ),
'add_new_item' => __( 'Add New Our Portfolio', 'naillash' ),
'edit_item' => __( 'Edit Our Portfolio', 'naillash' ),
'new_item' => __( 'Add New Our Portfolio', 'naillash' ),
'view_item' => __( 'View Our Portfolio', 'naillash' ),
'search_items' => __( 'Search Our Portfolio', 'naillash' ),
'not_found' => __( 'No Our Portfolio found' ),
'not_found_in_trash' => __( 'No Our Portfolio found in trash', 'naillash' ),
'all_items' => __( 'All Portfolio', 'naillash' ),
),
'public' => true,
'supports' => array( 'title', 'editor', 'thumbnail'),
'capability_type' => 'post',
'menu_position' => 15,
'menu_icon' => 'dashicons-format-gallery',
)
);
register_taxonomy('portfolio_cat', 'portfolio', array(
'labels' => array(
'name' => 'Category',
'add_new_item' => 'Add New Category',
'parent_item' => 'Parent Category',
),
'public' => true,
'hierarchical' => true
));
}
add_action( 'init', 'portfolio_custom_post_type' );
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment