WordPress.org

Ready to get started?Download WordPress

Forums

Multiple content blocks
[resolved] Issue displaying Content Block (4 posts)

  1. winnard
    Member
    Posted 9 months ago #

    Hi,

    I love this plugin, use it on nearly all my projects.

    I have run across an issue I am having with it though, which hopefully somebody can shed some light on.

    I have placed the template tag for this plugin in my header.php template file. Basically I am using it to display a custom message over an image in the header.

    This works beautifully on every page apart from the blog page. In settings -> reading -- I have static home page set to a page template, and I have created a page called blog, which loads up the main blog index.

    The content block editor does not appear when I go into that blog page.

    Is this because in reality this page doesn't exist? It is working on all my other pages even on individual blog posts, just the blog page which isn't working?

    As this is setup in my header.php file I am not going to be able to hard code the message in for that one page, so I need a solution if this is possible or not.

    Please let me know.

    Cheers

    Dan

    http://wordpress.org/plugins/multiple-content-blocks/

  2. Trendwerk
    Member
    Plugin Author

    Posted 9 months ago #

    Hi Dan,

    I see. WordPress is changing the default loop in that template. Since MCB relies on $post, it doesn't work. The only workaround that I can think of is something like this:

    $page = get_page_by_title( 'Blog' ); //Or whatever your blog page is called
    $block = get_post_meta( $page->ID, '_mcb-{your-block-name}', true ); //Fill in your block name (sanitized)
    
    echo $block;

    Should be something like that. You can also get the post meta manually in these situations.

  3. winnard
    Member
    Posted 9 months ago #

    Hi,

    Thanks for getting back to me. I will give it a go and see if I can get it to work.

    What do you mean by "You can also get the post meta manually in these situations?"

    Cheers for the quick response. Keep up the good work with the plugin. Love it!

  4. Trendwerk
    Member
    Plugin Author

    Posted 9 months ago #

    I meant that the data is saved in the wp_postmeta table. So there's always a way to retrieve the data in specific situations :)

    By the way, this bug is on our issue list, so we'll fix this some time in the future.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.