Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter festsoft

    (@festsoft)

    I included posts_per_page=10 and get the following behaviour:
    The 14 published jobs are displayed as 10 and 4 as expected IF the number of published ‘posts’ is 6 or more, but for 4 or 5 published ‘posts’ the 14 ‘jobs’ are displayed as 10 and ‘Not found’.
    The Settings>Reading max blog pages was set to 5.
    In pseudo code it seems that my observations are represented by

    no_of_job_pages = 1+int(14/10) = 2
    no_of_'post'_pages = 1+int(no_of_published_posts/max_blog_pages)
    if(no_of_'post'_pages>=no_of_job_pages)
    then job_posts_pagination_works
    else last_page_of_jobs = 404_Not_found

    I tested that by increasing max_blog_pages to 6 and result was consistent.

    This is the output of print_r($alm_query)

    WP_Query Object
    (
        [query_vars] => Array
            (
                [post_type] => Array
                    (
                        [0] => job
                    )
    
                [paged] => 1
                [posts_per_page] => 10
                [error] =>
                [m] =>
                [p] => 0
                [post_parent] =>
                [subpost] =>
                [subpost_id] =>
                [attachment] =>
                [attachment_id] => 0
                [name] =>
                [static] =>
                [pagename] =>
                [page_id] => 0
                [second] =>
                [minute] =>
                [hour] =>
                [day] => 0
                [monthnum] => 0
                [year] => 0
                [w] => 0
                [category_name] =>
                [tag] =>
                [cat] =>
                [tag_id] =>
                [author] =>
                [author_name] =>
                [feed] =>
                [tb] =>
                [comments_popup] =>
                [meta_key] =>
                [meta_value] =>
                [preview] =>
                [s] =>
                [sentence] =>
                [fields] =>
                [menu_order] =>
                [category__in] => Array
                    (
                    )
    
                [category__not_in] => Array
                    (
                    )
    
                [category__and] => Array
                    (
                    )
    
                [post__in] => Array
                    (
                    )
    
                [post__not_in] => Array
                    (
                    )
    
                [tag__in] => Array
                    (
                    )
    
                [tag__not_in] => Array
                    (
                    )
    
                [tag__and] => Array
                    (
                    )
    
                [tag_slug__in] => Array
                    (
                    )
    
                [tag_slug__and] => Array
                    (
                    )
    
                [post_parent__in] => Array
                    (
                    )
    
                [post_parent__not_in] => Array
                    (
                    )
    
                [author__in] => Array
                    (
                    )
    
                [author__not_in] => Array
                    (
                    )
    
                [ignore_sticky_posts] =>
                [suppress_filters] =>
                [cache_results] => 1
                [update_post_term_cache] => 1
                [update_post_meta_cache] => 1
                [nopaging] =>
                [comments_per_page] => 50
                [no_found_rows] =>
                [order] => DESC
            )
    
        [tax_query] => WP_Tax_Query Object
            (
                [queries] => Array
                    (
                    )
    
                [relation] => AND
            )
    
        [meta_query] => WP_Meta_Query Object
            (
                [queries] => Array
                    (
                    )
    
                [relation] =>
            )
    
        [date_query] =>
        [post_count] => 10
        [current_post] => -1
        [in_the_loop] =>
        [comment_count] => 0
        [current_comment] => -1
        [found_posts] => 14
        [max_num_pages] => 2
        [max_num_comment_pages] => 0
        [is_single] =>
        [is_preview] =>
        [is_page] =>
        [is_archive] =>
        [is_date] =>
        [is_year] =>
        [is_month] =>
        [is_day] =>
        [is_time] =>
        [is_author] =>
        [is_category] =>
        [is_tag] =>
        [is_tax] =>
        [is_search] =>
        [is_feed] =>
        [is_comment_feed] =>
        [is_trackback] =>
        [is_home] => 1
        [is_404] =>
        [is_comments_popup] =>
        [is_paged] =>
        [is_admin] =>
        [is_attachment] =>
        [is_singular] =>
        [is_robots] =>
        [is_posts_page] =>
        [is_post_type_archive] =>
        [query_vars_hash] => d610dd622800e9450b4322d2c1f2a8ed
        [query_vars_changed] =>
        [thumbnails_cached] =>
        [stopwords:WP_Query:private] =>
        [query] => Array
            (
                [post_type] => Array
                    (
                        [0] => job
                    )
    
                [paged] => 1
                [posts_per_page] => 10
            )
    
        [request] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'job' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10
        [posts] => Array
            (
                [0] => WP_Post Object
                    (
                        [ID] => 280
                        [post_author] => 3
                        [post_date] => 2014-03-30 06:57:02
                        [post_date_gmt] => 2014-03-30 06:57:02
                        [post_content] =>
                        [post_title] => Another Job
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => open
                        [post_password] =>
                        [post_name] => another-job
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-03-31 11:00:54
                        [post_modified_gmt] => 2014-03-31 11:00:54
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=280
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [1] => WP_Post Object
                    (
                        [ID] => 255
                        [post_author] => 3
                        [post_date] => 2014-03-24 17:01:31
                        [post_date_gmt] => 2014-03-24 17:01:31
                        [post_content] =>
                        [post_title] => TEST Job #30
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => closed
                        [post_password] =>
                        [post_name] => test-job-30
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-03-31 11:00:54
                        [post_modified_gmt] => 2014-03-31 11:00:54
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=255
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [2] => WP_Post Object
                    (
                        [ID] => 254
                        [post_author] => 3
                        [post_date] => 2014-03-24 17:00:54
                        [post_date_gmt] => 2014-03-24 17:00:54
                        [post_content] =>
                        [post_title] => Test Job #29
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => closed
                        [post_password] =>
                        [post_name] => test-job-29
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-03-31 11:00:54
                        [post_modified_gmt] => 2014-03-31 11:00:54
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=254
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [3] => WP_Post Object
                    (
                        [ID] => 253
                        [post_author] => 3
                        [post_date] => 2014-03-24 16:58:57
                        [post_date_gmt] => 2014-03-24 16:58:57
                        [post_content] => Pagination test
                        [post_title] => Test Job #27
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => closed
                        [post_password] =>
                        [post_name] => test-job-27
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-03-31 11:00:54
                        [post_modified_gmt] => 2014-03-31 11:00:54
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=253
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [4] => WP_Post Object
                    (
                        [ID] => 252
                        [post_author] => 3
                        [post_date] => 2014-03-24 16:56:28
                        [post_date_gmt] => 2014-03-24 16:56:28
                        [post_content] => Testing pagination
                        [post_title] => Test Job #26
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => closed
                        [post_password] =>
                        [post_name] => test-job-26
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-03-31 11:00:54
                        [post_modified_gmt] => 2014-03-31 11:00:54
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=252
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [5] => WP_Post Object
                    (
                        [ID] => 239
                        [post_author] => 3
                        [post_date] => 2014-03-22 20:46:51
                        [post_date_gmt] => 2014-03-22 20:46:51
                        [post_content] => Urgently needed
                        [post_title] => Pagination expert
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => open
                        [post_password] =>
                        [post_name] => pagination-expert
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-03-31 11:00:54
                        [post_modified_gmt] => 2014-03-31 11:00:54
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=239
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [6] => WP_Post Object
                    (
                        [ID] => 235
                        [post_author] => 1
                        [post_date] => 2014-03-09 02:50:02
                        [post_date_gmt] => 2014-03-09 02:50:02
                        [post_content] => Just adding some more jobs
                        [post_title] => Test job #25
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => open
                        [post_password] =>
                        [post_name] => test-job-25
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-03-31 11:00:54
                        [post_modified_gmt] => 2014-03-31 11:00:54
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=235
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [7] => WP_Post Object
                    (
                        [ID] => 234
                        [post_author] => 1
                        [post_date] => 2014-03-09 02:49:11
                        [post_date_gmt] => 2014-03-09 02:49:11
                        [post_content] => Just adding some more jobs
                        [post_title] => Test job #24
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => open
                        [post_password] =>
                        [post_name] => test-job-24
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-04-01 10:23:38
                        [post_modified_gmt] => 2014-04-01 10:23:38
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=234
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [8] => WP_Post Object
                    (
                        [ID] => 233
                        [post_author] => 1
                        [post_date] => 2014-03-09 02:48:46
                        [post_date_gmt] => 2014-03-09 02:48:46
                        [post_content] => Just adding some more jobs
                        [post_title] => Test job #23
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => open
                        [post_password] =>
                        [post_name] => test-job-23
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-04-01 10:23:38
                        [post_modified_gmt] => 2014-04-01 10:23:38
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=233
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [9] => WP_Post Object
                    (
                        [ID] => 232
                        [post_author] => 1
                        [post_date] => 2014-03-09 02:48:01
                        [post_date_gmt] => 2014-03-09 02:48:01
                        [post_content] => Just adding some more jobs
                        [post_title] => Test job #22
                        [post_excerpt] =>
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => open
                        [post_password] =>
                        [post_name] => test-job-22
                        [to_ping] =>
                        [pinged] =>
                        [post_modified] => 2014-04-01 10:23:38
                        [post_modified_gmt] => 2014-04-01 10:23:38
                        [post_content_filtered] =>
                        [post_parent] => 0
                        [guid] => http://localhost/alm/?post_type=job&p=232
                        [menu_order] => 0
                        [post_type] => job
                        [post_mime_type] =>
                        [comment_count] => 0
                        [filter] => raw
                    )
    
            )
    
        [post] => WP_Post Object
            (
                [ID] => 280
                [post_author] => 3
                [post_date] => 2014-03-30 06:57:02
                [post_date_gmt] => 2014-03-30 06:57:02
                [post_content] =>
                [post_title] => Another Job
                [post_excerpt] =>
                [post_status] => publish
                [comment_status] => open
                [ping_status] => open
                [post_password] =>
                [post_name] => another-job
                [to_ping] =>
                [pinged] =>
                [post_modified] => 2014-03-31 11:00:54
                [post_modified_gmt] => 2014-03-31 11:00:54
                [post_content_filtered] =>
                [post_parent] => 0
                [guid] => http://localhost/alm/?post_type=job&p=280
                [menu_order] => 0
                [post_type] => job
                [post_mime_type] =>
                [comment_count] => 0
                [filter] => raw
            )
    )

    Thread Starter festsoft

    (@festsoft)

    The code below is modified from the theme template by my attempts to debug. The problem is the same whether or on the SUBMENU section is there.

    <?php
    /*
    	Template Name: Jobs
    */
    //Modified for custom query with WP pagination
    get_header();
    ?>
    		<div id="content">
    <!-- SUBMENU CODE START -->
    			<div class="up_taxbar">
    <h3>&nbsp; &nbsp; FILTER JOB TYPES </h3>
    			</div>
    			<div class="taxbar">
    <?php
    $taxonomy     = 'job_type';
    $orderby      = 'name';
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = '';
    
    $args = array(
      'taxonomy'     => $taxonomy,
      'orderby'      => $orderby,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title
    );
    ?>
    <ul>
    <li><a href="http://www.acasalamunca.ro/?cat=0">ALL</a></li>
    <?php wp_list_categories( $args ); ?>
    </ul>
    			</div>
    
    			<div class="up_taxbar">
    <h3>&nbsp; &nbsp; LATEST JOBS</h3>
    			</div>
    <!-- SUBMENU CODE ENDS --> 
    
    <?php $count = 0; ?>
    
    <?php
    //Recommended
    if(get_query_var('paged')) {
        $paged = get_query_var('paged');
    } elseif(get_query_var('page')) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    $alm_args = array(
        'post_type' => array('job'),
        'paged' =>  $paged,
    );
    
    $alm_query = new WP_Query($alm_args);
    
    if ($alm_query->have_posts()) :          
    
        while ($alm_query->have_posts()) :
            $alm_query->the_post();
    ?>
    			<div class="box clearfix <?php if (++$count % 2 == 0) { echo "altbox"; } ?>" id="post-<?php the_ID(); ?>">
    				<div class="btitle">
    					<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    						<?php echo short_title('...', 7);  ?></a></h2>
        				<p><?php $comdes=get_post_meta($post->ID, 'wtf_comdescript', true); echo $comdes; ?></p>
    					<?php echo alm_job_type_tag($post->ID); //See plugins/alm_bidcontrol/alm_bidcontrol.php ?>
    				</div>
    				<div class="jlocation"> <?php $loc=get_post_meta($post->ID, 'wtf_comlocate', true); echo $loc; ?></div>
    				<div class="jpostime"><?php echo alm_format_bid_duedate($post->ID); ?></div>
    			</div>
    <?php
        endwhile;
    ?>
    			<div class="clear"></div>            
    
    <?php //wp_pagenavi(array('query'=>$alm_query)); ?>
    <div id="navigation" class="clearfix" style="width:300px;">
        <p>MONITOR: Page = <?php echo $paged; ?> Max number of pages = <?php echo $alm_query->max_num_pages; ?></p>
            <div style="float:left;"><?php next_posts_link('&laquo; Next page', $alm_query->max_num_pages) ?></div>
            <div style="float:right;"><?php previous_posts_link('Previous page &raquo;') ?></div>
            <div class="clear"></div>
    
    </div>
    
    <?php
    else :
    ?>
    			<h1 class="title">No Data</h1>
    			<p>Sorry, but there is no data for this page.</p>
    <?php
    endif;
    wp_reset_postdata();
    ?>
    		</div> <!-- content -->
    <?php
    get_sidebar();
    get_footer();
    ?>

    Further to my query, I have now tried the WP next_posts_link() and previous_posts_link() pagination, and the issue is still present – so it is not an issue with wp-pagenavi.

    I am also having pagination problem with WP 3.8.1 and wp-pagenavi 2.85.
    I am not a WP expert but have spent days on this. I have established that pagination works OK when post-type=post but when I use the custom post-type=’job’ (from the theme in use) then the number of pages is fewer than real total and some ‘jobs’ are not shown, or more pages than real total and the excess pages give a 404. The curious thing is that the behaviour depends on how many conventional ‘posts’ have been published – if there are more ‘posts’ than ‘jobs’, then ‘jobs’ paginates correctly.
    I am using the same code code below for both cases, just changing ‘post-type’ to ‘job’ or ‘post’.
    Any help would be very much appreciated!!
    Code:

    <?php
    if(get_query_var('paged')) {
        $paged = get_query_var('paged');
    } elseif(get_query_var('page')) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    $alm_args = array(
        'post_type' => array('job'), //'job' is a custom post in the theme
        'paged' =>  $paged,
    );
    $alm_query = new WP_Query($alm_args);
    if ($alm_query->have_posts()) :
        while ($alm_query->have_posts()) :
            $alm_query->the_post();
    ?>
    
    OUTPUT CONTENT HERE
    
    <?php
        endwhile;
        wp_pagenavi(array('query'=>$alm_query));
        wp_reset_postdata();
    
    ?>
    
    ETC

    Thread Starter festsoft

    (@festsoft)

    Thanks Evan, and thanks to esmi I now understand how to begin to interpret the mysterious ‘headers already sent’ messages!

    Thread Starter festsoft

    (@festsoft)

    It was on line 8811 of wordpress-svg-icons-plugin.php

    <?php
    
    }
    ?>
    
    <?php     //This is line 8811
    
    function wp_svg_icons_upload_custom_pack_callback() {
    
    ?>

    By deleting ?>…<?php the problem seems to be resolved. Activation now goes to the page full of icons…

    Thanks to both…

    Thread Starter festsoft

    (@festsoft)

    Code extract from wp-includes/pluggable.php
    The line 896 is the header(…) fn 5 lines from the end
    (Thanks for looking at this so promptly. My version is 2.3)

    if ( !function_exists('wp_redirect') ) :
    /**
     * Redirects to another page.
     *
     * @since 1.5.1
     * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
     *
     * @param string $location The path to redirect to.
     * @param int $status Status code to use.
     * @return bool False if $location is not provided, true otherwise.
     */
    function wp_redirect($location, $status = 302) {
    	global $is_IIS;
    
    	/**
    	 * Filter the redirect location.
    	 *
    	 * @since 2.1.0
    	 *
    	 * @param string $location The path to redirect to.
    	 * @param int    $status   Status code to use.
    	 */
    	$location = apply_filters( 'wp_redirect', $location, $status );
    
    	/**
    	 * Filter the redirect status code.
    	 *
    	 * @since 2.3.0
    	 *
    	 * @param int    $status   Status code to use.
    	 * @param string $location The path to redirect to.
    	 */
    	$status = apply_filters( 'wp_redirect_status', $status, $location );
    
    	if ( ! $location )
    		return false;
    
    	$location = wp_sanitize_redirect($location);
    
    	if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
    		status_header($status); // This causes problems on IIS and some FastCGI setups
    
    	header("Location: $location", true, $status);
    
    	return true;
    }
    endif;
    Thread Starter festsoft

    (@festsoft)

    PS: Sorry if confusing – slashes are removed from the displayed table but not from the MySQL database table wp_usermeta.

    Thread Starter festsoft

    (@festsoft)

    Thanks, it is partially fixed. Slashes are removed from the table, but it would be good to remove them from the database insertion code. A UMM custom meta-data field in wp_usermeta table is eg O\’Reilly whereas in the same table the WP ‘last_name’ field is correctly O’Reilly.

    Thread Starter festsoft

    (@festsoft)

    Yes, I know about stripslashes, but it is complicated for me to edit UMM to apply that fix to the User Meta Manager table. And I do not have to use stripslashes when accessing wp-user values. So is this a bug in UMM?

Viewing 10 replies - 1 through 10 (of 10 total)