Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions wp-content/plugins/vf-wp/vf-containers.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ public function after_setup_theme() {
'render_callback' => $callback
)
));
} else {
error_log("Error: No valid post found for plugin with key {$key}");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions wp-content/themes/vf-wp-groups/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
if( ! defined( 'ABSPATH' ) ) exit;

/* Adds scripts */
add_action( 'wp_enqueue_scripts', 'add_scripts' );
function add_scripts() {
add_action( 'wp_enqueue_scripts', 'include_scripts' );
function include_scripts() {
wp_enqueue_script('jplist', get_theme_file_uri( '/scripts/jplist.min.js'));
}

Expand Down
47 changes: 23 additions & 24 deletions wp-content/themes/vf-wp/blocks/vfwp-section-header/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$heading = get_field('heading');
$sub_heading = get_field('sub_heading');
$link = get_field('link');
$link_url = is_array($link) && isset($link['url']) ? $link['url'] : '';
$text = get_field('text');
$anchor = get_field('anchor');

Expand All @@ -20,7 +21,7 @@

// Function to output a banner message in the Gutenberg editor only
$admin_banner = function($message, $modifier = 'info') use ($is_preview) {
if ( ! $is_preview) {
if (! $is_preview) {
return; }
?>
<div class="vf-banner vf-banner--alert vf-banner--<?php echo $modifier; ?>">
Expand All @@ -43,31 +44,29 @@

?>
<div class="vf-section-header | vf-u-margin__bottom--400">
<h2 class="vf-section-header__heading"
<?php
if ($anchor) {
echo 'id="' . $anchor .'"';
} ?>
>
<?php
if ($type === 'is_a_link' || $type === 'has_sub-heading_and_link' || $type === 'has_sub-heading_link_text' || $type === 'has_link_text') { ?>
<a class="vf-section-header__heading vf-section-header__heading--is-link"
<?php if ($anchor) { echo 'id="' . $anchor .'"';} ?>
href="<?php echo esc_url($link['url']); ?>"><?php echo esc_html($heading); ?><svg aria-hidden="true" class="vf-section-header__icon | vf-icon vf-icon-arrow--inline-end" width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z" fill="" fill-rule="nonzero"></path></svg></a>
<?php }
else {
echo $heading; } ?>
</h2>
<h2 class="vf-section-header__heading"
<?php
if ($anchor) {
echo 'id="' . $anchor .'"';
} ?>
>
<?php
if ($type === 'is_a_link' || $type === 'has_sub-heading_and_link' || $type === 'has_sub-heading_link_text' || $type === 'has_link_text') { ?>
<a class="vf-section-header__heading vf-section-header__heading--is-link"
<?php if ($anchor) { echo 'id="' . $anchor .'"';} ?>
href="<?php echo esc_url($link_url); ?>"><?php echo esc_html($heading); ?><svg aria-hidden="true" class="vf-section-header__icon | vf-icon vf-icon-arrow--inline-end" width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z" fill="" fill-rule="nonzero"></path></svg></a>
<?php }
else {
echo esc_html($heading); } ?>
</h2>
<?php

if ($type === 'has_sub-heading' || $type === 'has_sub-heading_and_link' || $type === 'has_sub-heading_link_text') { ?>
<p class="vf-section-header__subheading"><?php echo esc_html($sub_heading); ?></p>
if ($type === 'has_sub-heading' || $type === 'has_sub-heading_and_link' || $type === 'has_sub-heading_link_text') { ?>
<p class="vf-section-header__subheading"><?php echo esc_html($sub_heading); ?></p>

<?php }
if ($type === 'has_text' || $type === 'has_sub-heading_link_text' || $type === 'has_link_text') { ?>
<p class="vf-section-header__text"><?php echo esc_html($text); ?></p>
<?php } ?>
<?php }
if ($type === 'has_text' || $type === 'has_sub-heading_link_text' || $type === 'has_link_text') { ?>
<p class="vf-section-header__text"><?php echo esc_html($text); ?></p>
<?php } ?>

</div>


43 changes: 18 additions & 25 deletions wp-content/themes/vf-wp/blocks/vfwp-summary/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
$title = trim($title);

$link = get_field('link');
$link_target = isset($link['target']) ? $link['target'] : '_self';
$link_target = is_array($link) && isset($link['target']) ? $link['target'] : '_self';
$text = get_field('text', false, false);
$text = wpautop($text);
$text = str_replace('<p>', '<p class="vf-summary__text">', $text);

$image = get_field('image');
if ( ! is_array($image)) {
if (!is_array($image)) {
$image = null;
} else {
$image = wp_get_attachment_image($image['ID'], 'medium', false, array(
Expand All @@ -33,10 +33,9 @@
}
$date = get_field('date');


// Function to output a banner message in the Gutenberg editor only
$admin_banner = function($message, $modifier = 'info') use ($is_preview) {
if ( ! $is_preview) {
if (! $is_preview) {
return;
}
?>
Expand All @@ -54,12 +53,8 @@
?>

<?php
if ( $type === 'custom' ) {
if (
! $image
&& vf_html_empty($title)
&& vf_html_empty($text)
) {
if ($type === 'custom') {
if (! $image && vf_html_empty($title) && vf_html_empty($text)) {
$admin_banner(__('Please enter custom content for this summary.', 'vfwp'));
return;
}
Expand All @@ -72,7 +67,7 @@
?>
<h3 class="vf-summary__title">
<?php if ($link) { ?>
<a href="<?php echo esc_url($link['url']); ?>" class="vf-summary__link" target="<?php echo esc_attr( $link_target ); ?>">
<a href="<?php echo esc_url($link['url']); ?>" class="vf-summary__link" target="<?php echo esc_attr($link_target); ?>">
<?php } ?>

<?php echo esc_html($title); ?>
Expand All @@ -88,7 +83,7 @@
return;
}

if ( $type === 'post' ) {
if ($type === 'post') {
?>
<article class="vf-summary vf-summary--news">
<span class="vf-summary__date">
Expand All @@ -110,7 +105,7 @@
<?php
}

if ( $type === 'event' ) {
if ($type === 'event') {
$event_style = get_field('event_style');
if (empty($event_style)) {
$event_style = 'default';
Expand Down Expand Up @@ -144,10 +139,10 @@ class="vf-summary vf-summary--event | vf-summary--is-link vf-summary--easy vf-su
<?php if (! empty($text)) { ?>
<?php echo $text; ?>
<?php } ?>
<?php if ( ! empty($event_type)) { ?>
<?php if (! empty($event_type)) { ?>
<p class="vf-summary__text"><?php echo $event_type; ?></p>
<?php } ?>
<?php if ( ! empty($location)) { ?>
<?php if (! empty($location)) { ?>
<p class="vf-summary__location"><?php echo $location; ?></p>
<?php } ?>
<?php if ($event_style === 'alternate') { ?>
Expand All @@ -164,7 +159,7 @@ class="vf-summary vf-summary--event | vf-summary--is-link vf-summary--easy vf-su
<?php
}

if ( $type === 'publication' ) {
if ($type === 'publication') {

$publication_title = get_field('publication_title');
$publication_link = get_field('publication_link');
Expand All @@ -173,24 +168,22 @@ class="vf-summary vf-summary--event | vf-summary--is-link vf-summary--easy vf-su
$source = get_field('source');
$doi = get_field('doi');

if (

vf_html_empty($title)
&& vf_html_empty($source)
&& vf_html_empty($authors)
) {
if (vf_html_empty($title) && vf_html_empty($source) && vf_html_empty($authors)) {
$admin_banner(__('Please enter custom content for this publication.', 'vfwp'));
return;
}

$publication_link_url = is_array($publication_link) && isset($publication_link['url']) ? $publication_link['url'] : '';
?>
<article class="vf-summary vf-summary--publication">
<h3 class="vf-summary__title">
<a href="<?php echo esc_url($publication_link['url']); ?>" class="vf-summary__link">
<a href="<?php echo esc_url($publication_link_url); ?>" class="vf-summary__link">
<?php echo $publication_title; ?>
</a>
</a>
</h3>
<p class="vf-summary__author">
<?php echo $authors; ?> </p>
<?php echo $authors; ?>
</p>
<p class="vf-summary__source">
<?php echo $source; ?>
<span class="vf-summary__date"><?php echo $year; ?></span>
Expand Down
9 changes: 7 additions & 2 deletions wp-content/themes/vf-wp/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ function remove_margin_wp_toolbar() {

function swiftype_metadata_description() {
$text = '';
$strippedText = ''; // Initialize the variable

// If text is empty use the Content Hub description
if (class_exists('VF_Cache')) {
// Get the global taxonomy term
Expand All @@ -153,15 +155,18 @@ function swiftype_metadata_description() {
'source' => 'contenthub',
), $url);
$text = VF_Cache::fetch($url);
$text = strstr($text, '<p>',);
$text = strstr($text, '<p>');
$text = strstr($text, '</p>', true);
$text = str_replace('<p>','', $text);
$strippedText = strip_tags($text);
} }
}
}

return $strippedText;
}



// allow only certain WP Gutenberg blocks
add_filter( 'allowed_block_types_all', 'allowed_block_types' );

Expand Down