开发者

WordPress page-columnist, change default page type

Hay, I need help setting the default column type used in page-columnist. It reverts to WordPress - Next Page (default), ho开发者_如何学编程wever i need it Ordinary Plain Page.

I look through the code and on line 456 we have an array of 'page_transitions'. the first item in the array is set to

'default'=> true

but changing the second item to 'default'=>true doesn't seem to do anything.

Any ideas?


Quick solution, seems that the "default" option doesn't do anything.

In your templates 'function.php' file add this code,

function page_Column_Change_Default(){
    $current_file_name = basename($_SERVER['REQUEST_URI'], ".php");
    if( $current_file_name == "post-new.php?post_type=page" ):
        wp_register_script('page_Column_Change_Default',
        get_bloginfo('template_directory') . '/js/page_Column_Change_Default.js');
        wp_enqueue_script('page_Column_Change_Default');
    endif;
}

add_action('admin_init', 'page_Column_Change_Default');

Then in your themes js/ folder, add a file called "page_Column_Change_Default.js" and it's content should be

jQuery(document).ready(function(){
    jQuery("input[value='cspc-trans-ordinary']").attr('checked', 'checked');
    jQuery("input[value='cspc-trans-wordpress']").removeAttr('checked');
});

Basically the first snippet gets the current URL and compares it the "add post" URL (post-new.php?post_type=page). This determines if we're on the "new post" page. If we are, it gets a javascript file and displays it in the proper place.

The second snippet (the javascript file), using jquery to deselect the first radio button, and select the second one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜