Update content categorization and handle hierarchical documentation

Enhancements were implemented to support hierarchical documentation. Local CMS now respects parent ID and order attributes of content items, and content can be categories as 'blog' or 'documentation'. Changes were also made to the wordpress integration supporting these new categorizations. Introduced working with nested documentation pages.
This commit is contained in:
giancarlo
2024-04-03 21:06:54 +08:00
parent 3fd216ba6e
commit 53afd10f32
22 changed files with 350 additions and 156 deletions

View File

@@ -0,0 +1,4 @@
<?php
<footer>
</footer>

View File

@@ -0,0 +1,23 @@
<?php
function register_category_and_tag_with_pages(){
/*add categories and tags to pages*/
register_taxonomy_for_object_type('category', 'page');
register_taxonomy_for_object_type('post_tag', 'page');
}
add_action( 'init', 'register_category_and_tag_with_pages');
function register_pre_get_category_and_tag_with_pages( $query ) {
if ( is_admin() || ! $query->is_main_query() ) {
return;
}
/*view categories and tags archive pages */
if($query->is_category && $query->is_main_query()){
$query->set('post_type', array( 'post', 'page'));
}
if($query->is_tag && $query->is_main_query()){
$query->set('post_type', array( 'post', 'page'));
}
}
add_action( 'pre_get_posts', 'register_pre_get_category_and_tag_with_pages');

View File

@@ -0,0 +1,42 @@
<?php
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
if (have_posts()) :
/* Start the Loop */
while (have_posts()) : the_post();
?>
<div>
<a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?></h3></a>
</div>
<?php
endwhile;
/* End the Loop */
else :
// Nothing
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .wrap -->
<?php get_footer(); ?>
<?php wp_footer(); ?>
</body>
</html>