1

There is a content block that I wish to put on certain pages.

This content block needs to be managed in WordPress. I'm not sure where it should be situated in the admin. It's not really a custom post type, i.e. it doesn't have any sub posts. It's literally just a block that contains a heading, some text and some logos.

I have use of Advanced Custom Fields if this helps and I'm using WordPress with the JSON API.

2

if you're using ACF, create an options page and then add a field there. Then present that data in a side widget by echoing out the field.

once the field is created you can call it with this code:

<?php the_field('page_content', 'option'); ?>

I like to add it to a function

function rt_show_field() {
    $field = '';
    if (get_field('page_content', 'option')) {
        $field = get_field('page_content', 'option');
    }
  return $field;
}
add_shortcode( 'my-field', 'rt_show_field');

Then if you add that function to your functions.php

you can simply add this short code to a widget

[my-field]

or add the function

echo rt_show_field();

to a template page or whereever you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.