• After checking for the “Hide content that’s not avalable for selected languages” one of my custom post_types (that has only title, thumbnail and custom fields) does not show in my page.
    Here’s the code:
    At functions.php:

    $args = array(
    		'public' => true,
    		'label'  => 'Banners',
    		'menu_position' => 5,
    		'supports' => array('title', 'thumbnail')
        );
        register_post_type( 'banner', $args );

    At index.php

    <?php
    	            	$args = array(
    	            		'post_type' => 'banner',
    	            		'posts_per_page' => 5,
    	            		'post_status' => 'publish'
    	            		);
    	            	$banner = new WP_Query($args);
    
    	            	//var_dump($banner);
    
    	            	if($banner->have_posts()):
    	            	?>
    	                <div class="col-sm-12 flexslider banner">
    	                    <ul class="slides">
    	                    	<?php while($banner->have_posts()): $banner->the_post();?>
    	                    		<?php $hover_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');?>
    	                    		<?php
    	                    		//echo get_field('tipo_link');
    	                    		$target = "_self";
    	                    		if(get_field('tipo_link') != 'false'){
    	                    			$tipo = get_field('tipo_link');
    	                    			$url = get_field("link_{$tipo}");
    	                    			if($tipo == 'externo'){
    	                    				$target = "_blank";
    	                    			}
    	                    		}else{
    	                    			$url = 'javascript:void(0)';
    	                    		}
    	                    		//echo $url;
    	                    		?>
    		                        <li><a href="<?php echo $url;?>" target="<?php echo $target;?>">
    		                        	<img src="<?php echo $hover_url[0];?>" alt="<?php the_title();?>">
    		                        	<div class="title-bg"><h3><?php the_title();?></h3></div>
    		                        </a></li>
    		                    <?php endwhile;?>
    	                    </ul>
    	                </div>
    	                <?php endif;wp_reset_postdata();?>

    https://wordpress.org/plugins/mqtranslate/

The topic ‘Custom Post Type not showing’ is closed to new replies.