Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 3.6.0

Overview of the issue

Clicking the Load more button when using the secondary language on the front-end, displays a message that there are no more posts found.

Initial list with the Load more button. A message stating that there are no more posts found.
initial-list-with-load-more-button no-more-posts-found-message

Workaround


To resolve this issue you need to find and replace some code. Find the directories of the files you need to edit along with the code snippets to replace.

Directory:
wp-content/plugins/otw-blog-manager/skeleton/components/widget_pagination.php
Find:
$ajaxURL = admin_url( 'admin-ajax.php?action=get_posts&post_id='. $listID .'&nonce='. $uniqueHash .'&page='. $page );
Replace with:
$ajaxURL = admin_url( 'admin-ajax.php?action=get_posts&list_id='. $listID .'&nonce='. $uniqueHash .'&page='. $page );

 

Directory:
wp-content/plugins/otw-blog-manager/include/otw_components/otw_functions/otw_functions.php
Find:
if( function_exists( 'icl_get_languages' ) ){
Replace with:
if( did_action( 'wpml_loaded' ) ){

 

Directory:
wp-content/plugins/otw-blog-manager/skeleton/timeline.php
Find:
$ajaxURL = admin_url( 'admin-ajax.php?action=get_posts&post_id='. $listID .'&nonce='. $uniqueHash .'&page='. $page );
Replace with:
$ajaxURL = admin_url( 'admin-ajax.php?action=get_posts&list_id='. $listID .'&nonce='. $uniqueHash .'&page='. $page );

 

Directory:
wp-content/plugins/otw-blog-manager/otw_blog_manager.php
Find:
$otw_bm_options = $this->otwBMQuery->getItemById( $_GET['post_id'] );
Replace with:
$otw_bm_options = $this->otwBMQuery->getItemById( $_GET['list_id'] );

 

Directory:
wp-content/plugins/otw-blog-manager/skeleton/components/pagination.php
Find:
$ajaxURL = admin_url( 'admin-ajax.php?action=get_posts&post_id='. $listID .'&nonce='. $uniqueHash .'&page='. $page );
Replace with:
$ajaxURL = admin_url( 'admin-ajax.php?action=get_posts&list_id='. $listID .'&nonce='. $uniqueHash .'&page='. $page );

 

Directory:
wp-content/plugins/otw-blog-manager/skeleton/components/pagination.php
Find:
$ajaxURL = admin_url( 'admin-ajax.php?action=get_posts&post_id='. $listID .'&nonce='. $uniqueHash .'&page='. $page );
Replace with:
$ajaxURL = admin_url( 'admin-ajax.php?action=get_posts&list_id='. $listID .'&nonce='. $uniqueHash .'&page='. $page );

 

Now, you should be able to load more posts from the secondary language list, as shown in the following image.
more-post-loaded-in-secondary-language

2 risposte a “Blog Manager - the "Load more" button doesn't load posts on the secondary language”

  1. Hi Everyone,

    The above “fix” is for an issue presented to the WPML team over 6 months ago:

    https://wpml.org/forums/topic/compatibility-with-blog-manager-load-more-link/

    It took a few months struggling with theme so that they figure out that the issue is in their code and the Blog Manager is working just fine.

    After long time no response we contacted them again. What they have offered is to change our code (which was confirmed to work correctly by the WPML team). We have refused to change something that works correctly just because they didn’t fix their issue.

    I confirm that the Blog Manager is 100% I18n compatible:

    https://codex.wordpress.org/I18n_for_WordPress_Developers

    And I am sorry that the WPML users will need to change the Blog Manager code if they need the load more link.

    I hope the WPML team fixes the issue some time soon.

    Thank you all for understanding!

    Stoyan
    OTWthemes

  2. Respectfully, editing plugin files is not a best practice. If anyone edits the Blog Manager plugin in this way, they will not be able to perform any updates on that plugin going forward, or they will have to redo this every time they update.

    What should be addressed and corrected in WPML are the following items, as described by the Blog Manager dev and submitted to WPML support:

    First: WPML does not get the right labels:

    /* */

    Second: The Blog Manager query is being changed for both languages but for both it is applied EN: language_code = ‘en’ This is something that WPML does.

    Here are both queries:

    English:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships
    ON (wp_posts.ID = wp_term_relationships.object_id) JOIN wp_icl_translations t
    ON wp_posts.ID = t.element_id AND t.element_type = CONCAT(‘post_’, wp_posts.post_type)
    WHERE 1=1
    AND wp_posts.ID NOT IN (1179,1083,1111,1046,1001,979) AND (
    wp_term_relationships.term_taxonomy_id IN (1,2,3,4,5,8,9,10,11,52,100,102)
    ) AND wp_posts.post_type = ‘post’ AND ((wp_posts.post_status = ‘publish’)) AND
    ( ( t.language_code = ‘en’ AND wp_posts.post_type IN (‘post’,’page’,’attachment’ ) ) OR wp_posts.post_type NOT IN (‘post’,’page’,’attachment’ ) ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 12, 12

    Secondary Language:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships
    ON (wp_posts.ID = wp_term_relationships.object_id) JOIN wp_icl_translations t
    ON wp_posts.ID = t.element_id AND t.element_type = CONCAT(‘post_’, wp_posts.post_type)
    WHERE 1=1 AND (
    wp_term_relationships.term_taxonomy_id IN (18,19,20,21,22,23,24,25,26,51,97,101)
    ) AND wp_posts.post_type = ‘post’ AND ((wp_posts.post_status = ‘publish’)) AND
    ( ( t.language_code = ‘en’ AND wp_posts.post_type IN (‘post’,’page’,’attachment’ ) ) OR wp_posts.post_type NOT IN (‘post’,’page’,’attachment’ ) ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 12, 12