Skip to content

Instantly share code, notes, and snippets.

@Ksasa78
Created February 6, 2020 11:19
Show Gist options
  • Save Ksasa78/005e2aa5852bf7d29acb72f0cf02b33d to your computer and use it in GitHub Desktop.
Save Ksasa78/005e2aa5852bf7d29acb72f0cf02b33d to your computer and use it in GitHub Desktop.
<?
$main_img_wppath = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full')[0];
$portfolio_cats = get_the_term_list( $post->ID, 'portfolio_category', '', ', ');
// declaring all possible custom fields (usually only some of them are populated in the portfolio page)
$portfolioPostIcon = get_post_meta($post->ID, 'portfolioPostIcon', true);
$customers = get_post_meta($post->ID, 'customers', true);
$relnotes = get_post_meta($post->ID, 'relnotes', true);
$appstore = get_post_meta($post->ID, 'appstore', true);
$googleplay = get_post_meta($post->ID, 'googleplay', true);
$website = get_post_meta($post->ID, 'website', true);
$youtube = get_post_meta($post->ID, 'youtube', true);
$facebook = get_post_meta($post->ID, 'facebook', true);
$features = json_decode(get_post_meta($post->ID, 'features', true));
?>
<div class="fullwidth">
<div class="title-art" style="background-image:url('<?= $main_img_wppath ?>');">
<div class="cbox">
<div class="colm100 colt100 colw100">
<div class="breadcrumbs">
<a href="/">Home</a>
<i class="icon-angle-right"></i>
<a href="/portfolio/">Portfolio</a>
<i class="icon-angle-right"></i>
<?= $portfolio_cats ?>
</div>
<h1 class="blog-post-title" itemprop="headline"><? the_title(); ?></h1>
</div>
</div>
</div>
</div>
<div class="fullwidth">
<div class="cbox portfolio-post">
<? if ($portfolioPostIcon !== '') {?>
<div class="hide320 colt20 colw20">
<img src="<?= get_bloginfo('template_directory'); ?>/img/portfolio-icons/<?= $post->post_name; ?>.png" alt="<? the_title(); ?>" class="portfolio-post-icon">
</div>
<div class="colm100 colt50 colw60">
<? } else { ?>
<div class="colm100 colt70 colw80">
<? } ?>
<div itemscope itemtype="https://schema.org/CreativeWork">
<div itemprop="text">
<?
$content_markup = '';
$blocks = parse_blocks( get_the_content() );
foreach ( $blocks as $block ) {
if ( 'core/gallery' === $block['blockName'] ) {
continue;
} else {
$content_markup .= render_block( $block );
}
}
// Remove wpautop filter so we do not get paragraphs for two line breaks in the content.
$priority = has_filter( 'the_content', 'wpautop' );
if ( false !== $priority ) {
remove_filter( 'the_content', 'wpautop', $priority );
}
echo apply_filters( 'the_content', $content_markup );
if ( false !== $priority ) {
add_filter( 'the_content', 'wpautop', $priority );
}
?>
</div>
<hr>
</div>
</div>
<div class="colm100 colt30 colw20">
<h3><i class="icon-calendar-empty"></i><? the_date('F Y'); ?></h3>
<? if ($customers !== '') {?>
<p><i class="icon-user"></i>Customer:</p>
<div class="space nh20"></div>
<p><?= $customers ?></p>
<? } ?>
<? if ($appstore !== '') {?>
<a class="prt-btn" target="_blank" href="<?= $appstore ?>" rel="noopener"><i class="icon-apple"></i>App Store</a>
<? } ?>
<? if ($googleplay !== '') {?>
<a class="prt-btn" target="_blank" href="<?= $googleplay ?>" rel="noopener"><i class="icon-googleplay"></i>Google Play</a>
<? } ?>
<? if ($website !== '') {?>
<a class="prt-btn" target="_blank" href="<?= $website ?>" rel="noopener"><i class="icon-link-ext"></i>Website</a>
<? } ?>
<? if ($youtube !== '') {?>
<a class="prt-btn" target="_blank" href="<?= $youtube ?>" rel="noopener"><i class="icon-youtube-play"></i>YouTube</a>
<? } ?>
<? if ($facebook !== '') {?>
<a class="prt-btn" target="_blank" href="<?= $facebook ?>" rel="noopener"><i class="icon-facebook-official"></i>Facebook</a>
<? } ?>
<? if ($relnotes !== '') {?>
<hr>
<p class="relnotes"><?= $relnotes ?></p>
<? } ?>
</div>
<div class="clear"></div>
</div>
</div>
<? if ($features !== '') {?>
<div class="fullwidth inverted">
<div class="cbox feature-icons">
<div class="colm100 colt33 colw33">
<? foreach($features as $feature) { ?>
<i class="icon-<?= $feature->icon1; ?>"></i>
<h5><?= $feature->title1; ?></h5>
<p><?= $feature->desc1; ?></p>
<? } ?>
</div>
<div class="colm100 colt33 colw33">
<? foreach($features as $feature) { ?>
<i class="icon-<?= $feature->icon2; ?>"></i>
<h5><?= $feature->title2; ?></h5>
<p><?= $feature->desc2; ?></p>
<? } ?>
</div>
<div class="colm100 colt33 colw33">
<? foreach($features as $feature) { ?>
<i class="icon-<?= $feature->icon3; ?>"></i>
<h5><?= $feature->title3; ?></h5>
<p><?= $feature->desc3; ?></p>
<? } ?>
</div>
<div class="clear"></div>
</div>
</div>
<? } ?>
<? if ( 'core/gallery' === $block['blockName'] ) { ?>
<div class="fullwidth img-gallery">
<div class="cbox portfolio-post">
<div class="colm100 colt100 colw100">
<h3><i class="icon-picture"></i>Gallery</h3>
<div class="space h40"></div>
<?
foreach ( $blocks as $block ) {
if ( 'core/gallery' === $block['blockName'] ) {
echo do_shortcode( $block['innerHTML'] );
break;
}
}
?>
</div>
</div>
</div>
<? } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment