Code to pull in a PHP file named after the category ID

<?php foreach((get_the_category()) as $category) { if( file_exists( ‘/path/to/file/to/include/’ . $category->cat_ID . ‘.php’ ) ) include( ‘/path/to/file/to/include/’ . $category->cat_ID . ‘.php’ ); } ?> That should do the trick. If the file doesn’t exist, it just skips it. This can be expensive to do if you have a large amount of categories to loop through, though. … Read more

WordPress Shortcode wrap around div

If by template file you mean a php file in the themes folder, you can call do_shortcode to have the shortcode processor do its magic on your div. EDIT: not entirely sure I understand what you want, but you could try this: <div id=”subscription”> <?php do_shortcode(‘[subscribe]’.call_php_function().'[/subscribe]’);?> </div>

What should I put on my index.php?

index.php is shown whenever wordpress doesn’t find an appropriate page template. Generally people use it as the template for their site’s blog. If you are absolutely sure that it will never be reached, you can leave it empty. Just make sure you have that file present, otherwise the theme will not work As a personal … Read more

How to Increment ID value within ACF Repeater Field Loop

Try using a “counter” variable for the loop maybe? <?php if ( get_field(‘ingredients-list’) ) { echo ‘<ul class=”ingredientsList”>’; $count=0; while ( has_sub_field(‘ingredients-list’) ) { echo ‘<li class=”ingredient” itemprop=”ingredients”> <label for=”check-‘. $count .'”> <input type=”checkbox” class=”check” id=”check-‘. $count .'”> ‘; if ( get_sub_field(‘quantity’) ) echo ‘<span class=”quantity”>’ . get_sub_field(‘quantity’) . ‘</span> ‘; if ( get_sub_field(‘measurement’) ) … Read more

Link to blog index from template

if you are referring to the ‘posts page’ as set under dashboard – settings – reading: <?php if( get_option( ‘page_for_posts’ ) ) { echo get_permalink( get_option( ‘page_for_posts’ ) ); } else { echo home_url(); } ?>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)