WordPress.org

Ready to get started?Download WordPress

Forums

Multiple content blocks
[resolved] v 3.0.1 braking in second language and when chosing more than 1 category (8 posts)

  1. ferylee
    Member
    Posted 1 year ago #

    Hi,

    Two days ago I finished a multi language page using the multi language plugin WPML. The content blocks I split into two columns using your Multiple content blocks.

    Everything worked good before the two last updates (3.0) and (3.0.1)... On version (2.2.1) the extra blocks rendered immediately and also for the second language and depending the Category chosen.

    For example, in single.php I use something like this:

    <!-- NEWS  -->
    		<?php if (in_category('1') || in_category('12') ) { ?>
    
    		<!-- THE LOOP -->
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<div class="news_pages">
    
    			<!-- input -->
    			<div class="content">
    
    				<!-- entry images -->
    				<div class="entry_images">
    				<?php the_block('images news'); ?>
    				</div>
    				<!-- end entry images -->
    
    				<!-- entry text -->
    				<div class="entry_text">
    				<?php the_content(); ?>
    				</div>
    				<!-- end entry text -->
    
    			</div>
    			<!-- end input -->
    
    		</div>
    
    		<?php endwhile; ?>
    		<?php else : ?>
    
    		<div class="single_pages">
    		No News Found
    		</div>
    
    		<?php endif; ?>
    		<!-- END THE LOOP -->
    
    		<!-- END NEWS  -->
    
    		<!-- WORK -->
    		<?php } else { ?>
    
    		<!-- THE LOOP -->
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<div class="single_pages">
    
    			<!-- input -->
    			<div class="content">
    
    				<!-- entry images -->
    				<div class="entry_images">
    				<?php the_block('images news'); ?>
    				</div>
    				<!-- end entry images -->
    
    				<!-- entry text -->
    				<div class="entry_text">
    				<?php the_content(); ?>
    				</div>
    				<!-- end entry text -->
    
    			</div>
    			<!-- end input -->
    
    		</div>
    
    		<?php endwhile; ?>
    		<?php else : ?>
    
    		<div class="single_pages">
    		No Project Found
    		</div>
    
    		<?php endif; ?>
    		<!-- END THE LOOP -->
    
    		<!-- END WORK -->
    
    		<?php } ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still - use a pastebin. As it stands, your posted code may now have been permanently damaged/corrupted by the forum's parser.]

    In version (3.0) I had to comment line 92 of assets/inc/class.MCB.php so it kept working also for the second language.

    When I updated to (3.0.1) nothing worked anymore, not redering for second language and no second content block appearing when adding another category.

    Now I switched back to the backup copy of version (3.0), buggy solution.

    Another problem I have, when I switch back to backup copy of (2.2.1), the content for the extra content blocks is gone!

    Let me know if there is a solution, thanks

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

  2. Piet
    Member
    Posted 1 year ago #

    I have never worked with the multiple content blocks plugin, but I can tell you already that you are using a wrong way to select your category when using WPML.

    wrong: <?php if (in_category('1') || in_category('12') ) { ?>

    IF category 12 is a translation of category 1 then you should use:

    <?php if ( icl_object_id( 1, 'category', false ) ); ?>

    IF category 1 and 12 are both categories of the default language, you should use:

    <?php if ( icl_object_id( array( 1,12 ), 'category', false ) ); ?>

    more information via http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/language-dependent-ids/

  3. ferylee
    Member
    Posted 1 year ago #

    Piet,

    Great, thanks a lot for your input, Im will change that.
    Funny that it's actually working the way it is now, even I turend off (to try) the option "Adjust ID's for multilingual functionality"...

    In relation to the multiple content blocks, I guess that my wrong selection of selecting the categories will noch influence too much... or will it?

  4. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    I'm not sure.. does it work yet? Multiple content blocks should work at all times. However, if a plugin adds functionality outside of WP's core, other plugins (like MCB) maybe won't work.

    I'm not very familiar with WPML. We just use a Multisites installation for a multilingual website.

    3.0.1 is not very different from 3.0, it just catches an error when wp_remote_get doesn't work on your server.

  5. ferylee
    Member
    Posted 1 year ago #

    Hi, I didn't have time to change anything now. Now it's working on v3.0, commenting out line 92 of assets/inc/class.MCB.php. Problem on v3.0 is that the MCB content blocks are rendering after Publishing and in second language even more tricky to make them visible.

    Actually, now that you say so, with v3.0.1 I also got the error message related to (wp_remote_get): "Your server doesn't allow remote HTTP requests using wp_remote_get. You will have to visit this page manually to update which blocks are used on each page."
    What could I do about that in case I would decide to update to v3.0.1 ?

    For now, in that case, the version that best worked was v2.2.1 . I have a backup copy with this version but somehow I canot get the content back...

    Thanks for your support.

  6. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    The content is migrated to version 3.0.

    I would not advise to use 2.2.1, since it was fairly outdated and could break with any WP update. It's also not very reliable anymore in reading the correct template files.

    In 3.0 you had to comment out line 92, but in 3.0.1 this is solved and catches and shows you the error. It still cannot search for content blocks automatically, because HTTP requests don't seem to work on your server. You should try to enable this, maybe your hosting provider can help you. We use WP's own function wp_remote_get, so you might find some help about that.

  7. emati
    Member
    Posted 1 year ago #

    Sorry. Wrong form. Please remove this post.

  8. Trendwerk
    Member
    Plugin Author

    Posted 10 months ago #

    In case HTTP Requests don't work, automatic initialization of blocks is not possible.

    I've just added an admin page where you can disable HTTP requests. You can refresh the blocks manually by visiting the page.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.