• Resolved Sany

    (@sannny)


    Hello,

    I created two custom post statuses, one is public, one private. In WordPress, all works fine. The statuses are added to a custom post type.

    But I want to export my website to static HTML (with WinHTTrack). Only ‘published’ posts are exported. The posts with a custom status are missing.

    If I add the statuses to ‘post’ all posts are exported with my custom statuses. But not the posts of the custom post type.

    I register my custom statuses in following code:

    function custom_post_status()
    {
    	register_post_status('redaktion', array(
    		'label' => _x('Redigiert', 'snippet'),
    		'private' => true,
    		'exclude_from_search'=> false,
    		'show_in_admin_all_list' => true,
    		'show_in_admin_status_list' => true,
    		'label_count' => _n_noop( 'Redaktion <span class="count">(%s)</span>', 'Redigiert <span class="count">(%s)</span>')
    	));
    
    	register_post_status('testpublish', array(
    		'label'	=> _x('Testver?ffentlicht', 'snippet'),
    		'public' => true,
    		'exclude_from_search' => false,
    		'show_in_admin_all_list' => true,
    		'show_in_admin_status_list' => true,
    		'post_type_support' => true,
    		'label_count' => _n_noop( 'Testver?ffentlicht <span class="count">(%s)</span>', 'Testver?ffentlichte <span class="count">(%s)</span>')
    	));
    }
    add_action('init', 'custom_post_status', 1);

    The custom post type is registered in the next code snippet.

    public static function register()
    {
    	$post_type_args = array
    	(
    		'public'  => TRUE,
    		'show_ui' => TRUE,
    		'exclude_from_search' => TRUE,
    		'show_in_nav_menus' => FALSE,
    		'rewrite' => array('slug' => 'snippet', 'with_front' => FALSE),
    		'supports' => array('title', 'editor', 'author', 'revisions'),
    	);
    	register_post_type('snippet', $post_type_args);

    Hopefully, someone can help me.
    Thanks already.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m not convinced this is a WP issue. This does not mean I will not try to help you, just that you may be approaching the problem the wrong way. As I understand it, HTTrack is essentially a self limiting web spider. It starts on a particular page, and follows all links it encounters within its self imposed limits. On each of those pages from each link followed it follows all new links encountered within limits. And so on until nothing new can be found within its limits.

    So the reason certain posts are not mirrored is not the custom status, but because there were no links leading to them from other pages. These are orphan pages as far as HTTrack is concerned. To get to these pages, you either need to alter how HTTrack operates so it can start on pages with the necessary links, or add enough links on certain pages so HTTrack can find all the desired pages.

    Now, it still could be a WP issue if the links that should be generated from a particular query are not generated due to the way queries are run on custom post types or statuses. For queries to return all the desired links it may be necessary to alter the queries to incorporate custom post types and/or statuses. This is frequently done using the pre_get_posts action. Here one can add the necessary array arguments to the post_type and post_status query vars.

    There is a post type example in the above link. A nearly identical technique would be used for post_status as well.

Viewing 1 replies (of 1 total)
  • The topic ‘Export post types with custom status for static HTML’ is closed to new replies.