add profile spotlight block pattern, tweak user text template

This commit is contained in:
Evan Mullins 2022-11-03 13:55:15 -04:00
parent cce28c38fd
commit 32d6a9c7a5
4 changed files with 90 additions and 50 deletions

View file

@ -954,4 +954,14 @@ function wasmo_get_transient_keys_with_prefix( $prefix ) {
// Remove '_transient_' from the option name.
return substr( $key['option_name'], strlen( '_transient_' ) );
}, $keys );
}
}
// set up the block pattern category
// define theme specific block patterns in theme patterns folder
function wasmo_register_pattern_categories() {
register_block_pattern_category(
'wasmormon',
array( 'label' => __( 'wasmormon', 'wasmo' ) )
);
}
add_action( 'init', 'wasmo_register_pattern_categories' );

View file

@ -0,0 +1,62 @@
<?php
/**
* Title: Profile Spotlight
* Slug: wasmo/profile-spotlight
* Categories: featured, wasmormon
*/
?>
<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>Intro sentence</p>
<!-- /wp:paragraph -->
<!-- wp:gallery {"columns":2,"imageCrop":false,"linkTo":"none"} -->
<figure class="wp-block-gallery has-nested-images columns-2"><!-- wp:image {"id":1510,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="https://wasmormon.org/wp-content/uploads/sites/12/2022/11/wasmo-fbb-1-1024x1024.jpg" alt="" class="wp-image-1510"/></figure>
<!-- /wp:image -->
<!-- wp:image {"id":1511,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="https://wasmormon.org/wp-content/uploads/sites/12/2022/11/wasmo-fbb-2-1024x1024.jpg" alt="" class="wp-image-1511"/></figure>
<!-- /wp:image --><figcaption class="blocks-gallery-caption wp-element-caption">Caption. - <a href="https://wasmormon.org?randomprofile=1">Profile Link</a></figcaption></figure>
<!-- /wp:gallery -->
<!-- wp:quote -->
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
<p>"Quote"</p>
<!-- /wp:paragraph --><cite><a href="https://wasmormon.org?randomprofile=1">Profile Link</a></cite></blockquote>
<!-- /wp:quote -->
<!-- wp:paragraph -->
<p>Continue reading the full wasmormon profile at <a href="https://wasmormon.org?randomprofile=1">https://wasmormon.org?randomprofile=1</a></p>
<!-- /wp:paragraph -->
<!-- wp:separator -->
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<!-- /wp:separator -->
<!-- wp:group {"layout":{"type":"constrained"},"fontSize":"small"} -->
<div class="wp-block-group has-small-font-size"><!-- wp:paragraph {"fontSize":"small"} -->
<p class="has-small-font-size">Find on social media:</p>
<!-- /wp:paragraph -->
<!-- wp:list -->
<ul><!-- wp:list-item -->
<li><a href="#" rel="nofollow">instagram</a></li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="#" rel="nofollow">facebook</a></li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="#" rel="nofollow">reddit</a></li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></div>
<!-- /wp:group -->
<!-- wp:block {"ref":1513} /-->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>mormon faith crisis, quote, why i left, exit testimony, exit story, closing testimony, exmormon, profile spotlight, wasmormon profile, postmormon,</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

View file

@ -5,7 +5,7 @@
Author: Evan Mullins
Author URI: https://circlecube.com
Template: twentynineteen
Version: 1.10.1
Version: 1.10.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wasmo

View file

@ -16,44 +16,21 @@
<?php echo wp_kses_post( get_field( 'location', 'user_' . $userid ) ); ?>
<?php } ?>
<?php
$links = get_field( 'links', 'user_' . $userid );
if ( $links ) { ?>
<?php if ( $links['facebook'] ) { ?>
<?php echo esc_url( $links['facebook'] ); ?>
<?php } ?>
<?php if ( $links['instagram'] ) { ?>
<?php echo esc_url( $links['instagram'] ); ?>
<?php } ?>
<?php if ( $links['reddit'] ) { ?>
<?php echo esc_url( $links['reddit'] ); ?>
<?php } ?>
<?php if ( $links['twitter'] ) { ?>
<?php echo esc_url( $links['twitter'] ); ?>
<?php } ?>
<?php if ( $links['other'] ) { ?>
<?php echo esc_url( $links['other'] ); ?>
<?php } ?>
<?php } ?>
<?php if ( get_field( 'about_me', 'user_' . $userid ) ) { ?>
About me
<?php echo wp_strip_all_tags( get_field( 'about_me', 'user_' . $userid ) ); ?>
<?php } ?>
<?php
$shelf_items = get_field( 'my_shelf', 'user_' . $userid );
if ( $shelf_items ) {
?>
<?php $shelf_items = get_field( 'my_shelf', 'user_' . $userid ); ?>
<?php if ( $shelf_items ) { ?>
On my shelf
<?php foreach( $shelf_items as $term ): ?>
<?php echo $term->name; ?>,
<?php endforeach; ?>
<?php } ?>
<?php
$spectrum_terms = get_field( 'mormon_spectrum', 'user_' . $userid );
if ( $spectrum_terms ) { ?>
<?php $spectrum_terms = get_field( 'mormon_spectrum', 'user_' . $userid ); ?>
<?php if ( $spectrum_terms ) { ?>
On the Mormon Spectrum
<?php foreach( $spectrum_terms as $term ): ?>
<?php echo $term->name; ?>,
@ -65,28 +42,19 @@ Why I left
<?php echo wp_strip_all_tags( get_field( 'why_i_left', 'user_' . $userid ) ); ?>
<?php } ?>
<?php
//questions repeater
if( have_rows( 'questions', 'user_' . $userid ) ):
?>
<?php if( have_rows( 'questions', 'user_' . $userid ) ): ?>
Questions
<?php while ( have_rows( 'questions', 'user_' . $userid ) ) :
the_row();
$termtaxid = get_sub_field( 'question', 'users_' . $userid );
if ( $termtaxid ) :
$questionterm = get_term( $termtaxid, 'question' );
echo wp_kses_post( $questionterm->name ); ?>
<?php
echo wp_strip_all_tags( get_sub_field( 'answer', 'users_' . $userid ) ); ?>
<?php
// loop through the rows of data
while ( have_rows( 'questions', 'user_' . $userid ) ) :
the_row();
$termtaxid = get_sub_field( 'question', 'users_' . $userid );
if ( $termtaxid ) {
$questionterm = get_term( $termtaxid, 'question' );
?>
<?php echo wp_kses_post( $questionterm->name ); ?>
<?php echo wp_strip_all_tags( get_sub_field( 'answer', 'users_' . $userid ) ); ?>
<?php
}
endwhile;
else :
// no questions found
<?php
endif;
endwhile;
endif;
?>