<?php
$terms = get_the_terms( get_the_ID(), 'bake-lovers-categories' );
if ($terms) {
foreach($terms as $term) {
echo '<span class="tag">'.$term->name . ' '.'</span>';
}
}
?>
<?php
$aust1 = types_render_field("available-in-australia", array("option"=>0));
if ($aust1) {
echo 'woolies';
}
$aust2 = types_render_field("available-in-australia", array("option"=>1));
if ($aust2) {
echo 'coles';
}
$aust3 = types_render_field("available-in-australia", array("option"=>2));
if ($aust3) {
echo 'other';
}
?>
This is happening because the parent theme is calling in styles.css using enque.
Disable it by adding the following into the child themes functions file:
/* -- Removes the parent theme stylesheet,
to stop it being called twioce (Foundation CSS was being called after style.css)
-- */
function PREFIX_remove_scripts() {
wp_dequeue_style( 'screen' );
wp_deregister_style( 'screen' );
wp_dequeue_script( 'site' );
wp_deregister_script( 'site' );
// Now register your styles and scripts here
}
add_action( 'wp_enqueue_scripts', 'PREFIX_remove_scripts', 20 );
/* -- Removes the parent theme stylesheet END -- */
As a freelancer there hasn't been too much need for me to use Git - But all that's about to change. I'm jumping into the deep end, and documentaing my journey. here we go:
Here's an excellent overview of what we will be doing. It includes links to two developers solutions:
https://premium.wpmudev.org/blog/git-for-wordpress-development/
The first solution detailed in the above blog post is quick linked here:
https://premium.wpmudev.org/blog/improve-wordpress-development-workflow-local-server/
It suggests using Wordpress Desktop server to create a local environment. I'm already used to using wamp and mamp - but in order to follow the instructions in the blog post I decided to give Desktop Server a shot.
I was successfull in creating a new local wordpress environment, although importing an existing website into Desktop Server has proved to be a pain. The frontend and backend are displaying PHP warnings, and the wordpress login isn't displaying at all.
<?php
$counter = 0;
$Accordion_heading_1 = get_field('Accordion_heading_1');
?>
<section id="accordion-1" class="accordion">
<div class="container">
<?php if ($Accordion_heading_1) { ?>
<h2><?php echo $Accordion_heading_1; ?></h2>
<?php } ?>
<div class="accordion" id="accordionexample">
<?php
// check if the repeater field has rows of data
if (have_rows('tab_1')):
// loop through the rows of data
while (have_rows('tab_1')) : the_row(); ?>
<?php
$counter++;
?>
<div class="card">
<div class="card-header" id="heading<?php echo '-' . $counter; ?>">
<h2 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse<?php echo '-' . $counter; ?>" aria-expanded="true"
aria-controls="collapse<?php echo '-' . $counter; ?>">
<?php the_sub_field('question'); ?>
</button>
</h2>
</div>
<div id="collapse<?php echo '-' . $counter; ?>" class="collapse"
aria-labelledby="heading<?php echo '-' . $counter; ?>" data-parent="#accordionexample">
<div class="card-body">
<?php the_sub_field('answer'); ?>
</div>
</div>
</div>
<?php endwhile;
else :
// no rows found
endif;
?>
</div>
</div>
</section>
See the Pen Dynamic bootstrap 4 carousel using wordpress advanced custom fields by shannon briggs (@shandb) on CodePen.
Uses:
Use the following snippet to display the URL of a custom post types taxonomy term. Just replace the word position with the name of the taxonomy.
<?php
$terms = wp_get_post_terms($post->ID, 'position');
foreach ($terms as $term) {
echo get_term_link($term);
}
?>
To display the results of a Toolset Types checkbox field, use the following in your PHP template:
$checkbox_value = types_render_field( "my_checkbox_field", array( "separator" => ", " ) );
echo $checkbox_value;
Taking it a step further, we can create conditionals based on values collected. In the following example I have four values:
$blacktown = types_render_field( "localities", array( "option" => "0" ) );
$carlingford = types_render_field( "localities", array( "option" => "1" ) );
$emerton = types_render_field( "localities", array( "option" => "2" ) );
$penrith = types_render_field( "localities", array( "option" => "3" ) );
if ($blacktown) {
// do something
};
if ($carlingford) {
// do something
};
if ($emerton) {
// do something
};
if ($penrith) {
// do something
};