Skip to content

Commit

Permalink
Perfect, Perfect, Perfect
Browse files Browse the repository at this point in the history
  • Loading branch information
serkanalgur committed Aug 22, 2022
1 parent 8207501 commit cf9e1bd
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 102 deletions.
155 changes: 80 additions & 75 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
$color_code = get_term_meta( $termid, 'color_code', true );
?>
<div class="category-header" style="background:<?php echo $color_code; ?>">
<div class="container">
<span style="color:white" class="dashicons <?php echo get_term_meta( $termid, 'icon_slug', true ); ?>"></span>
<span class="category-header-title">
<?php
if ( is_category() ) {
single_cat_title();
} if ( is_tag() ) {
single_tag_title(); }
?>
</span>
<p style="">
<?php
if ( is_category() or is_tag() ) {
echo category_description(); }
?>
</p>
</div>
<div class="container">
<span style="color:white" class="dashicons <?php echo get_term_meta( $termid, 'icon_slug', true ); ?>"></span>
<span class="category-header-title">
<?php
if ( is_category() ) {
single_cat_title();
} if ( is_tag() ) {
single_tag_title(); }
?>
</span>
<p style="">
<?php
if ( is_category() or is_tag() ) {
echo category_description(); }
?>
</p>
</div>
</div>


Expand All @@ -37,55 +37,58 @@
</div>
<div class="col-md-9">

<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>

<a href="<?php the_permalink(); ?>" class="forum-post-index">
<span class="forum-post-index-comment-count">
<span class="dashicons dashicons-welcome-comments"></span><?php echo get_comments_number( $post->ID ); ?>
</span>
<span class="forum-post-index-category">
<?php
$categories = get_the_terms( $post->ID, 'category' );
$i = 1;
foreach ( $categories as $c ) {
$termid = $c->term_id;
$color_code = get_term_meta( $termid, 'color_code', true );
echo '<span style="background:' . $color_code . '">' . $c->name . '</span>';
if ( ++$i > 3 ) {
break;
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>

<a href="<?php the_permalink(); ?>" class="forum-post-index">
<span class="forum-post-index-comment-count">
<span
class="dashicons dashicons-welcome-comments"></span><?php echo get_comments_number( $post->ID ); ?>
</span>
<span class="forum-post-index-category">
<?php
$categories = get_the_terms( $post->ID, 'category' );
$i = 1;
foreach ( $categories as $c ) {
$termid = $c->term_id;
$color_code = get_term_meta( $termid, 'color_code', true );
echo '<span style="background:' . $color_code . '">' . $c->name . '</span>';
if ( ++$i > 3 ) {
break;
}
}
}
?>
</span>
<div class="forum-post-index-avatar"><?php echo get_avatar( get_the_author_meta( 'ID' ), 50 ); ?></div>
<div href="<?php the_permalink(); ?>" class="forum-post-index-title"><?php the_title(); ?> </div>
<span class="forum-post-index-author"><b><?php the_author(); ?></b>
<?php
$t = get_the_time( 'U' );
echo human_time_diff( $t, current_time( 'U' ) ) . __( ' ago', 'siforum' );
?>

</span>
</a>
?>
</span>
<div class="forum-post-index-avatar"><?php echo get_avatar( get_the_author_meta( 'ID' ), 50 ); ?></div>
<div href="<?php the_permalink(); ?>" class="forum-post-index-title"><?php the_title(); ?> </div>
<span class="forum-post-index-author"><b><?php the_author(); ?></b>
<?php
endwhile; else :
?>
<p><?php esc_html_e( 'No posts here.' ); ?></p><?php endif; ?>
$t = get_the_time( 'U' );
//phpcs:disable
echo human_time_diff( $t, current_time( 'U' ) ) . __( ' ago', 'siforum' );
//phpcs:enable
?>

</span>
</a>
<?php
endwhile; else :
?>
<p><?php esc_html_e( 'No posts here.' ); ?></p><?php endif; ?>




<?php
global $wp_query;
<?php
global $wp_query;

if ( $wp_query->max_num_pages > 1 ) {
echo '<div class="load_more_posts">' . __( 'Load More', 'siforum' ) . '</div>';
}
?>
if ( $wp_query->max_num_pages > 1 ) {
echo '<div class="load_more_posts">' . __( 'Load More', 'siforum' ) . '</div>';
}
?>



Expand All @@ -95,30 +98,32 @@
</div>


<script>
jQuery(function($){
$('.load_more_posts').click(function(){
<script>
jQuery(function($) {
$('.load_more_posts').click(function() {

var button = $(this),
data = {
'action': 'loadmore',
'query': misha_loadmore_params.posts,
'page' : misha_loadmore_params.current_page
};
'action': 'loadmore',
'query': misha_loadmore_params.posts,
'page': misha_loadmore_params.current_page
};

$.ajax({
url : misha_loadmore_params.ajaxurl,
data : data,
type : 'POST',
beforeSend : function ( xhr ) {
url: misha_loadmore_params.ajaxurl,
data: data,
type: 'POST',
beforeSend: function(xhr) {
button.text('<?php _e( 'Loading...', 'siforum' ); ?>...');
},
success : function( data ){
if( data ) {
button.text( '<?php _e( 'Load More', 'siforum' ); ?>' ).prev().before(data);
success: function(data) {
if (data) {
button.text('<?php _e( 'Load More', 'siforum' ); ?>').prev().before(
data);
misha_loadmore_params.current_page++;

if ( misha_loadmore_params.current_page == misha_loadmore_params.max_page )
if (misha_loadmore_params.current_page == misha_loadmore_params
.max_page)
button.remove();
} else {
button.remove();
Expand All @@ -127,7 +132,7 @@
});
});
});
</script>
</script>



Expand Down
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function wcr_category_fields( $term ) {
<input type="text" size="40" value="<?php echo esc_attr( $icon_slug ); ?>" id="term_fields[icon_slug]"
name="term_fields[icon_slug]"><br />
<span class="description"><?php _e( 'Dash Icon Slug-Name' ); ?> -
https://developer.wordpress.org/resource/dashicons/</span>
https://developer.wordpress.org/resource/dashicons/ (If you enabled fontawesome. use fontawesome icon names. <code>fa-regular fa-person</code> like.)</span>
</td>
</tr>
<tr class="form-field">
Expand Down
69 changes: 43 additions & 26 deletions sidecategories.php
Original file line number Diff line number Diff line change
@@ -1,37 +1,54 @@


<div class="search-and-find">
<form action="<?php bloginfo('url'); ?>" method="get">
<input type="text" name="s" id="search" value="<?php the_search_query(); ?>"
class="input-search" placeholder="<?php _e( 'Search and Enter...','siforum' ); ?>" />
</form>
</div>
<div class="search-and-find">
<form action="<?php bloginfo( 'url' ); ?>" method="get">
<input type="text" name="s" id="search" value="<?php the_search_query(); ?>" class="input-search"
placeholder="<?php _e( 'Search and Enter...', 'siforum' ); ?>" />
</form>
</div>



<ul class="cat-list">

<ul class="cat-list">

<li class="cat-list-home">
<a href="<?php bloginfo('url'); ?>">
<span style="color:white" class="dashicons dashicons-admin-comments"></span><?php _e( 'All Discussions','siforum' ); ?>
</a>
</li>

<li class="cat-list-home">
<a href="<?php bloginfo( 'url' ); ?>">
<span style="color:white"
class="dashicons dashicons-admin-comments"></span><?php _e( 'All Discussions', 'siforum' ); ?>
</a>
</li>


<?php $taxonomies = get_terms( array( 'taxonomy' => 'category', 'hide_empty' => false, 'exlude' => array(19,19) ) );
foreach( $taxonomies as $c ) { ?>

<li>
<a href="<?php echo get_term_link( $c ); ?>">
<span style="color:<?php echo get_term_meta($c->term_id, 'color_code', true); ?>" class="dashicons <?php echo get_term_meta($c->term_id, 'icon_slug', true); ?>"></span><?php echo $c->name; ?>
</a>
</li>

<?php } ?>
<?php
$taxonomies = get_terms(
array(
'taxonomy' => 'category',
'hide_empty' => false,
'exlude' => array(
19,
19,
),
)
);
foreach ( $taxonomies as $c ) {
?>

<li>
<a href="<?php echo get_term_link( $c ); ?>">
<?php
$dash = 'dashicons';
$fontawesome = get_theme_mod( 'siforum_fontawesome_select' );
if ( ! empty( $fontawesome ) && 'yes' === $fontawesome ) {
$dash = '';
}
?>
<span style="color:<?php echo get_term_meta( $c->term_id, 'color_code', true ); ?>"
class="<?php echo $dash; ?> <?php echo get_term_meta( $c->term_id, 'icon_slug', true ); ?>"></span><?php echo $c->name; ?>
</a>
</li>

<?php } ?>

</ul>



</ul>

0 comments on commit cf9e1bd

Please sign in to comment.