Skip to content

Commit

Permalink
Added link to browse open-source bots when browsing by language.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbohacek committed Sep 20, 2021
1 parent 3464b07 commit 680d429
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );

if ( get_query_var( 'taxonomy' ) === 'programing_language' ) {
$page_title = "Bots made with " . $term->name;
if ( !empty( $_GET['opensource'] ) ){
$page_title = "Open-source bots made with " . $term->name;
} else {
$page_title = "Bots made with " . $term->name;
}
} else {
$page_title = "Posts tagged #" . $term->name;
}
Expand All @@ -95,6 +99,18 @@
if ( !empty( $term->description ) ){
echo wpautop( $term->description );
}

if ( get_query_var( 'taxonomy' ) === 'programing_language' ) {
$page_title = "Bots made with " . $term->name;
?>
<ul class="btn-list">
<?php
if ( !empty( $_GET['opensource'] ) ){ ?>
<li><a class="btn" href="<?php echo get_term_link( $term ); ?>">Browse all <?php echo $term->name; ?> bots</a></li>
<?php } else { ?>
<li><a class="btn" href="<?php echo get_term_link( $term ); ?>?opensource=true">Browse open-source <?php echo $term->name; ?> bots</a></li>
<?php }
}
}
elseif ( $wp_query->query['post_type'] == 'bot' ) {

Expand Down Expand Up @@ -187,7 +203,7 @@ function tag_links( $tag ){

if ( in_array( 'opensource', $tags ) ) { ?>
<ul class="btn-list">
<li><a class="btn" href="/bot/?opensource=true">Browse opensource bots</a></li>
<li><a class="btn" href="/bot/?opensource=true">Browse open-source bots</a></li>
<?php
echo $glitch_link;
echo $narrow_opensource_link;
Expand Down
2 changes: 1 addition & 1 deletion tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<h1><?php echo "All posts tagged " . implode( ' ', $tag_links ); ?></h1>
<?php if ( in_array( 'opensource', $tags ) ){ ?>
<ul class="btn-list">
<li><a class="btn" href="/bot/?opensource=true/">Browse opensource bots</a></li>
<li><a class="btn" href="/bot/?opensource=true/">Browse open-source bots</a></li>
</ul>
<?php } elseif ( in_array( 'twitterbot', $tags ) ) { ?>
<ul class="btn-list">
Expand Down

0 comments on commit 680d429

Please sign in to comment.