add anchor link for each user answer and link to them from question tax
This commit is contained in:
parent
6cf828851e
commit
38dee18ffb
3 changed files with 33 additions and 5 deletions
27
style.css
27
style.css
|
@ -5,7 +5,7 @@
|
|||
Author: Evan Mullins
|
||||
Author URI: https://circlecube.com
|
||||
Template: twentynineteen
|
||||
Version: 1.13.4
|
||||
Version: 1.13.5
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Text Domain: wasmo
|
||||
|
@ -1195,6 +1195,7 @@ div.lwa-modal-overlay div.lwa-modal-popup {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
/* Home */
|
||||
.home .entry-content h4 {
|
||||
margin-top: 4rem;
|
||||
}
|
||||
|
@ -1360,6 +1361,13 @@ div.lwa-modal-overlay div.lwa-modal-popup {
|
|||
display: block;
|
||||
}
|
||||
|
||||
.entry .entry-content .question_anchor {
|
||||
font-size: 1rem;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
vertical-align: sub;
|
||||
}
|
||||
|
||||
.entry-description.has-regular-font-size {
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
|
@ -1442,4 +1450,21 @@ figure.wp-block-image.aligncenter {
|
|||
}
|
||||
figure.wp-block-image.aligncenter img {
|
||||
margin: 0 auto;
|
||||
}
|
||||
.entry .entry-content > *.aligncenter {
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
.entry .entry-content > *.aligncenter img {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* crop long links in lists */
|
||||
.entry-content ul li > a {
|
||||
word-wrap: break-word;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
display: inherit;
|
||||
}
|
|
@ -75,8 +75,9 @@ if ( false === ( $the_answers = get_transient( $transient_name ) ) ) {
|
|||
) {
|
||||
$username = esc_html( $user->nickname );
|
||||
$the_answers .= '<cite>';
|
||||
$the_answers .= '<a class="person person-' . esc_attr( $userid ) . '" href="' . get_author_posts_url( $userid ) . '">';
|
||||
$the_answers .= '<span class="directory-img">';
|
||||
$the_answers .= '<a class="person person-' . esc_attr( $userid ) . '" href="';
|
||||
$the_answers .= get_author_posts_url( $userid ) . '#' . esc_attr( $term->slug );
|
||||
$the_answers .= '"><span class="directory-img">';
|
||||
$the_answers .= wasmo_get_user_image( $userid );
|
||||
$the_answers .= '</span>';
|
||||
$the_answers .= '<span class="directory-name">' . $username . '</span>';
|
||||
|
|
|
@ -148,8 +148,11 @@ if( have_rows( 'questions', 'user_' . $userid ) ):
|
|||
$answer = get_sub_field( 'answer', 'users_' . $userid );
|
||||
if ( $termtaxid && $answer ) {
|
||||
$questionterm = get_term( $termtaxid, 'question' );
|
||||
$anchor = "Link to this answer of '" . wp_kses_post( $questionterm->name ) . "' by " . $curauth->display_name;
|
||||
$description = "See more answers about '" . wp_kses_post( $questionterm->name ) . "'";
|
||||
echo '<h4 class="question">';
|
||||
echo '<h4 class="question" id="' . esc_attr( $questionterm->slug ) . '">';
|
||||
echo '<a href="#' . esc_attr( $questionterm->slug ) . '" class="question_link_inline question_anchor" title="' . $anchor . '">';
|
||||
echo '<sup>#</sup><span class="screen-reader-text">' . $anchor . '</span></a> ';
|
||||
echo wp_kses_post( $questionterm->name );
|
||||
echo ' <a href="' . get_term_link( $termtaxid, 'question' ) . '" class="question_link_inline" title="' . $description . '">';
|
||||
echo wasmo_get_icon_svg( 'link', 20 );
|
||||
|
@ -176,7 +179,6 @@ if (
|
|||
<?php set_query_var( 'userid', $userid ); ?>
|
||||
<?php set_query_var( 'is_this_user', $is_this_user ); ?>
|
||||
<?php set_query_var( 'name', $curauth->user_login ); ?>
|
||||
<?php set_query_var( 'displayname', $curauth->user_login ); ?>
|
||||
<?php set_query_var( 'link', get_author_posts_url( $userid ) ); ?>
|
||||
<?php get_template_part( 'template-parts/content/content', 'user-spotlight' ); ?>
|
||||
<?php get_template_part( 'template-parts/content/content', 'user-posts' ); ?>
|
||||
|
|
Loading…
Reference in a new issue