Viewing 5 posts - 16 through 20 (of 20 total)
  • Posted in: Flexform
  • #209086
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    To help you further, I will need:

    1) Your WP login details
    2) The page or post you added the PHP to
    3) The code you are trying to add

    Thanks.

    #209092
    trs-gretar
    Member
    Post count: 14
    This reply has been marked as private.
    #209649
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    The PHP is working fine, it’s your actual query that is wrong. I have tested the PHP is working, you can see it outputs my text test.

    I would advise you strongly to not use query_posts, I would build the post query using WP Query. Ref: https://codex.wordpress.org/Class_Reference/WP_Query. The query will need to be reset after the while loop, wp_reset_postdata();.

    If you need help building the query using WP_Query, please use this as an example for future posts:

    // WP_Query arguments
    $args = array (
    	'post_type'              => array( 'post' ),
    	'post_status'            => array( 'future' ),
    );
    
    // The Query
    $custom_query = new WP_Query( $args );
    
    // The Loop
    if ( $custom_query->have_posts() ) {
    	while ( $custom_query->have_posts() ) {
    		$custom_query->the_post();
    		// do something
    	}
    } else {
    	// no posts found
    }
    
    // Restore original Post Data
    wp_reset_postdata();

    Thanks,
    David.

    #209714
    trs-gretar
    Member
    Post count: 14

    Thank you for this. I have fixed the code and it is working.

    Thanks again for your excellent support !

    #209854
    David Martin – Support
    Moderator
    Post count: 20834

    Great, no problem.

    Thanks,
    David.

Viewing 5 posts - 16 through 20 (of 20 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register