Home Forums General Issues how to load custom single.php based on field type?


how to load custom single.php based on field type?

  • Hi I have a blog where the categories are news, events and inspiration. These categories are selected using radio buttons on acf. I want to load news on single-news.php while events on single-events.php and inspiration on single-inspiration.php

    is it possible to use the acf fields to do this?
    I have came across this code with wordpress default categories to load custom single.php s

      $post = $wp_query->post;
      if (in_category('1')) {
      } elseif (in_category('2')) {
      } else {

    what can be used instead of the ‘in_category’ while using acf?

    thanks guys.

  • Hi,
    you could use the following plugin
    to display on ACF a radio button with your 3 catégories, the post will get attached to the selectedi categorie, that way your code will still work.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.