This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function insert_from_api() { | |
if(isset($_GET['input'])) { | |
// API URL | |
$url = ''; | |
// Create a new cURL resource |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function field_with_ipsum_fallback( $text ) { | |
if ( ! empty( $text ) ) { | |
echo $text; | |
} else { | |
echo 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pellentesque risus vel venenatis faucibus. Nam id pharetra nisl. Nullam viverra eu nisi vel placerat. Donec faucibus blandit dictum'; | |
} | |
} | |
function heading_with_ipsum_fallback( $heading ) { | |
if ( ! empty( $heading ) ) { | |
echo $heading; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Modules; | |
use Timber; | |
### Example usage | |
// $args = [ | |
// 'text_block' => get_sub_field('text_block'), | |
// ]; | |
// $new_module = new TextBlock($args); | |
// $new_module->render(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $toggle = jQuery('.accordion-toggle'), | |
$accordionText = jQuery('.accordion-descriptionText'); | |
$toggle.on('change', function() { | |
jQuery(this).parent().find( $accordionText ).toggleClass('active'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( function_exists( 'acf_add_options_page' ) ) { | |
/** | |
* Example: Single 'Theme Settings' page, with children | |
* | |
* These only create the pages, which must be then populated via custom ACF fields. | |
* This setup creates a 'parent' ACF config page and sub-pages. | |
*/ | |
acf_add_options_page( | |
array( | |
'page_title' => 'Theme General Settings', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # Live-specific configs | |
if ( in_array( $_ENV['PANTHEON_ENVIRONMENT'], array( 'live' ) ) ) { ?> | |
<script> | |
(function(i, s, o, g, r, a, m) { | |
i['GoogleAnalyticsObject'] = r; | |
i[r] = i[r] || function() { | |
(i[r].q = i[r].q || []).push(arguments) | |
}, i[r].l = 1 * new Date(); | |
a = s.createElement(o), | |
m = s.getElementsByTagName(o)[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add ACF Content Blocks preview images. | |
jQuery(document).ready(function ($) { | |
if (typeof acf !== 'undefined') { | |
acf.addAction('load', () => { | |
$('.tmpl-popup').each((_, popup) => { | |
const regex = /data-layout="(.+?)".*?>/g; | |
const replace = `$&<img src="${taoti_admin_js.acfPreviewUrl}$1.jpg">`; | |
const result = $(popup).html().replace(regex, replace); | |
$(popup).html(result); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$photoBannerId = get_post_thumbnail_id(); | |
$photoBannerUrlBase = wp_get_attachment_image_src($photoBannerId, 'listing')[0]; | |
$photoBannerUrlBaseSmall = wp_get_attachment_image_src($photoBannerId, 'listing-small')[0]; | |
if ($photoBannerId) { ?> | |
<picture> | |
<source media="(max-width: 1023px)" srcset="<?= esc_attr($photoBannerUrlBase) ?>"> | |
<source media="(min-width: 1024px)" srcset="<?= esc_attr($photoBannerUrlBaseSmall) ?>"> | |
<source srcset="<?= esc_attr($photoBannerUrlBaseSmall) ?>"> | |
<img src="<?= esc_attr($photoBannerUrlBaseSmall) ?>" alt="Photo of <?php the_title(); ?>"> |
OlderNewer