Skip to content

Instantly share code, notes, and snippets.

View ashleycam3ron's full-sized avatar

Ashley N Cameron ashleycam3ron

View GitHub Profile
@ashleycam3ron
ashleycam3ron / software-notes
Last active March 3, 2020 00:31
Get software notes for firmware updates equal to user's products
<?php // Software notes
if( have_rows('products', $userID) ): ?>
<?php while( have_rows('products', $userID) ): the_row();
$product = get_sub_field('product'); //get repeater post object
if ($product):
//print_r($product);
@ashleycam3ron
ashleycam3ron / firmware-archive.php
Last active March 4, 2020 19:08
Need to check if a user is logged in, then whether their products (in an ACF repeater) are in the loop of firmware posts (on this archive). The firmware CPT has an ACF relationship field to its products.
<?php if ( is_user_logged_in() ) { ?>
<h1>Firmware Updates</h1>
<?php $current_user = wp_get_current_user(); ?>
<h3 style="margin-bottom: 6px;">Welcome, <?php echo $current_user->user_firstname; ?>!</h3>
<p>Your registered product software and updates are listed below.<br/>
Need to register another product on your account? Please fill out a <a data-fancybox href="#updateaccount">request form</a>.</p>
<?php // Software notes