WordPress.org

Ready to get started?Download WordPress

Forums

Multiple content blocks
[resolved] can't get it to work (15 posts)

  1. novaflash
    Member
    Posted 1 year ago #

    So I downloaded and installed and activated the plugin.

    Then I went to page.php and edited it. After the loop ends I added this line:

    <?php the_block('workdamnyou'); ?>

    But nothing happens.

    I tried tons of things to convince it to work but nothing works. I never once got an extra content block visible in the 'Page' area in the Dashboard when editing a page.

    I also tried doing the same with a specific template - still nothing.

    I do get under 'custom fields' in the dropdown an extra name "mcb-blocks" but with no value.

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

  2. martsgirl
    Member
    Posted 1 year ago #

    This is what I added:

    <div class="column second-column">
    <?php the_block('Second column'); ?>
    </div>

    I added the code above to page.php and checked a page and I found the Multiple Content blocks appearing when I refreshed it.

    HTH!

  3. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    It should work. Is this still a problem?

    MCB checks what blocks you're using through a remote HTTP request. Maybe your server settings don't allow it (and we should catch that error). Can you try and comment line 92 in assets/inc/class.MCB.php?

  4. novaflash
    Member
    Posted 1 year ago #

    Nope, still nothing.

    A remote HTTP request eh? How about if the server I use has Apache2 with Nginx as caching server in front?

    I've just tried commenting line 92 in the file you mentioned but it didn't change anything.

  5. novaflash
    Member
    Posted 1 year ago #

    And to martsgirl; yes, thank you for the code sample. I use the same syntax and code, outside of the loop, but nothing shows for me.

  6. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    Actually, it registers which content blocks are used when you visit a page in the front end. But maybe they're not registered, because it wasn't visited. That's why the HTTP request (using wp_remote_get, http://codex.wordpress.org/Function_API/wp_remote_get) is made to visit it.

    Are you able to debug where the problem lies, since I cannot reproduce it myself?

    I'd appreciate it if you could post your findings to Git: https://github.com/trendwerk/multiple-content-blocks/issues

  7. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    By the way, when you uncommented that line, did you try to visit the page in the front-end? Maybe that will help..

    http://wordpress.org/support/topic/fatal-error-when-updating-to-33?replies=4

  8. novaflash
    Member
    Posted 1 year ago #

    There is progress.

    After I have uncommented line 92, I did not get a result immediately, as I mentioned in my earlier post.

    However, as you have just pointed out, I had to visit the page first to get it to trigger the creation of the extra content block. That worked and I then had "It Still Does Nothing" content block visible in the back end. Please note that I had already tried this before commenting out the line 92 - I just didn't do it after I had commented out that line. Sorry about that.

    I then changed the title of the block from "It Still Does Nothing" to "blargh" and got an extra second block. The original block added previously wasn't removed from the back-end. So then I had "It Still Does Nothing" and "blargh". When I changed the title again, to "shitzooi", I now had a total of 3 extra content blocks: "It Still Does Nothing", "blargh" and "shitzooi" even though I had only this one line:

    <?php the_block('shitzooi'); ?>

    When I removed the comment from the line 92 of class.MCB.php file, all those three content blocks disappeared from the back end and I was back to square 1: no extra content blocks visible in the back-end at all, not even "shitzooi".

    I am capable of writing some PHP code but I do not know how to debug this. If you give me some instructions on what to try I'll give it a go. I now have a working solution for now at least, so I'm happy with that, but I'd still like it to be able to work 100%.

  9. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for your work on this!

    This says enough, someone else is having this problem too. Line 92 and 93 are just removing and reinitializing which content blocks there are on a certain page. Line 92 removes the old ones and 93 makes the HTTP request to check for new ones. When line 92 doesn't work, nothing works. So I'll catch that error in the next version (which will be out real soon).

    The temporary fix is to place all the blocks you need and comment line 92 out. Thanks again for your help!

  10. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    The fix has just been committed. Couldn't really test it, so I hope it works. Please let me know!

  11. novaflash
    Member
    Posted 1 year ago #

    I am willing to test it but not willing to lose my data. When the fields disappear, and I later am able to bring them back with the exact same names, will the contents still be there?

  12. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    Yeah, the content is stored in different meta keys. This shouldn't be a problem if you've already updated to 3.0 (versions before that were stored differenly, so your data had to be migrated).

    But I would always recommend to back-up before updating a plugin, especially one with valuable content like this one!

  13. novaflash
    Member
    Posted 1 year ago #

    Backups? I like to live dangerously. I will trust in you and do the update now. If it explodes, I have only myself to blame.

  14. novaflash
    Member
    Posted 1 year ago #

    I am sorry, but there were no explosions.

    I have added the_block('Of Cheese'); in the code, and nothing happened while I stayed in the back end. When I went to the front end, it added the block 'Of Cheese' in the back end, as it should.

    Same thing with removing the code - it only updates when visiting the page in the front end. So it seems all is working well now.

    Thanks for the update and a wonderful addition to WordPress.

  15. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    I'm glad it worked. Thanks for testing it so thoroughly!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.