• Resolved champdor

    (@champdor)


    I have a simple Pod for downloadable resources. I worked months to perfect to archive.php.

    After go live today no CPTs are retrieved in the loop on the live site. The posts are there in the admin (2 x 210), they are listed on dev site. Archive.php is loaded because the search&filter is on the top of the page.

    I did:
    – reset permalinks,
    – search & replaced old domain with the new (also replaced GUID URLs—I know, I know).

    Dev site: https://r0g3rs.posdev.hu/en/resources/
    Live site: https://rogersalapitvany.hu/en/resources/

    Can you help me what could I do to make them appear?

    Regards,
    Champdor

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @champdor

    Please share more information, for example the code you use for the loop.

    search & replaced old domain with the new (also replaced GUID URLs—I know, I know).

    GUID should never be used anyway ;).

    My first guess is that you might use some hardcoded parts only available on your dev site.

    Cheers, Jory

    Thread Starter champdor

    (@champdor)

    I don’t think that I use hard coded parts. But code is below. The main problem seems to be that WP somehow does not recognize that the CPT has posts.

    
    <main id="main" class="site-main">
    
    	<?php
    	$currlang = apply_filters( 'wpml_current_language', NULL );
    	if ( $currlang === 'en' ){
    		echo do_shortcode( '[searchandfilter id="802"]' ) . '<div id="filter-toggle-wrap"><a id="filter-toggle-button" href="#">Filters <i class="fas fa-angle-down"></i></a></div>';
    	} else {
    		echo do_shortcode( '[searchandfilter id="79"]' ) . '<div id="filter-toggle-wrap"><a id="filter-toggle-button" href="#">Sz?r?k <i class="fas fa-angle-down"></i></a></div>'; } ?>
    
    	<?php if ( have_posts() ) : // WE DON'T HAVE POSTS? ?>
    
    		<div class="sza_wrapper">
    
    		<?php if ( function_exists( 'wp_pagenavi' ) )
    			wp_pagenavi();
    		else
    			get_template_part( 'includes/navigation', 'index' ); ?>
    
    		<?php
    		while ( have_posts() ) : the_post();
    
    			$tags = get_the_terms( get_the_ID(), 'post_tag' );
    			$output_tags ='';
    			foreach ( $tags as $tag){
    				if ( $currlang === 'en' ){
    					$output_tags .= '<a class="sza_tag" href="/en/resources/?_sft_post_tag=' . $tag->slug . '">' . $tag->name . '</a>';
    				} else {
    					$output_tags .= '<a class="sza_tag" href="/hu/szakmai-anyagok/?_sft_post_tag=' . $tag->slug . '">' . $tag->name . '</a>';
    				}
    			}
    			
    			$orig_ID = apply_filters( 'wpml_object_id', $post->ID, 'szakmai_anyagok', FALSE, 'hu' );
    			
    			global $wpdb;
    			$results = $wpdb->get_results("SELECT m2.meta_value FROM ral_postmeta m1 JOIN ral_postmeta m2 ON m2.post_id = m1.meta_value and m2.meta_key = '_wp_attached_file' WHERE m1.post_id = " . (int)$orig_ID . " and m1.meta_key = 'dfile'"); // Hack to get the dfile field value
    			$file_link = '/wp-content/uploads/' . $results[0]->meta_value;
    			?>
    
    			<article class="sza_loop-item">
    				<div class="sza_icon">
    					<a href="<?php echo $file_link; ?>" target="_blank"><img src="/wp-content/uploads/2020/03/sza_pdf.svg"></a>
    				</div>
    				<div class="sza_content">
    					<?php if ( $post->authors ) {
    						echo __( 'Authors: ', 'rogerstheme' ) . get_post_meta( get_the_ID(), 'authors', true ) . '<br>';
    							} ?>
    					<span class="sza_post-title"><?php echo '<a href="' . $file_link . '"'; ?> target="_blank"><?php the_title() ?></a></span><span class="sza_lang-icon"><img height="16px" width="16px" src=<?php echo '"/wp-content/themes/rogerstheme/flags/' . esc_html( get_post_meta( get_the_ID(), 'language', true ) ) . '.svg"'; ?> alt=""></span><br><?php echo get_the_date( 'Y' ); ?> |<?php echo $output_tags; ?>
    				</div>
    			</article>
    		<?php endwhile;
    
    		if ( function_exists( 'wp_pagenavi' ) )
    			wp_pagenavi();
    		else
    			get_template_part( 'includes/navigation', 'index' ); ?>
    
    		</div><!-- .sza_wrapper -->
    
    	<?php else : ?>
    
    		<?php echo '<div class="sza_wrapper"><p class="sza_error">' . __( 'There are no documents that match your filter criteria.', 'rogerstheme' ) . '</p></div>'; ?>
    
    	<?php endif; ?>
    
    </main><!-- #main -->
    

    Any insights?

    Best regards
    Champdor

    Plugin Author Jory Hogeveen

    (@keraweb)

    Well if there aren’t posts found then you should check the query.
    You could use Query Monitor to find the main query and search for an issue there.
    https://www.ads-software.com/plugins/query-monitor/

    Cheers, Jory

    Thread Starter champdor

    (@champdor)

    Dear Jory,

    Thank you for the directions. I installed Query Monitor but it’s a bit beyond my capabilities.

    However:
    – I checked the page both on dev site and live site and the queries and number of queries seem to be identical.
    – No PHP errors, only notices regarding Search&Filter both sites.
    – I found the WP_Query that calls the CPTs. I ran the db query in phpMySQL that is called by it and it gave back all the posts on the live host as well.
    – I see of course many queries of WPML since it is quite a heavy plugin. I tried to disable WPML just to narrow down things but broke the page.
    – I tried to turn off my custom archive-szakmai_anyagok.php and use a previous archive.php but no joy.
    – I disabled Search&Filter Pro widget since it can alter the query but still no result.

    It drives me crazy.

    Any idea?

    regards,
    Champdor

    Thread Starter champdor

    (@champdor)

    No, that was not the right db query. The real one does not give result in phpMySQL neither. Single posts are displayed “correctly” although not used.

    I think there will be some WPML issue. Researching further.

    Champdor

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @champdor

    Could you share the SQL?
    It indeed sounds like a WPML or other plugin compatibility issue.
    Let me know!

    Cheers, Jory

    • This reply was modified 4 years, 6 months ago by Jory Hogeveen.
    Thread Starter champdor

    (@champdor)

    @keraweb
    I’m already in dicussion with WPML support. In the meantime I discovered that upon editing and updating the post it appears on the frontend.

    I only want to know if there is a quicker way than to open all the 210 posts one by one and update them.

    WPML support said that Pods plugin is not on their compatibility list ??

    Cheers,
    Champdor

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @champdor

    Correct, WPML doesn’t officially support Pods, they provided us with compatibility support a few years back and that code might get outdated.

    However, I think this might be a combination of plugins that causes the bug.
    Can you reproduce if you have only Pods enabled?

    Cheers, Jory

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘No CPTs listed after publishing site (go live)’ is closed to new replies.