• Resolved awelsh

    (@awelsh)


    Hi Shazzad,

    I run a multilingual site and am having to call the same postlist for each language. I’m finding it a pain to call different pastelists by id (especially with 19 languages) so I wrote some code to get a postlist by slug. Any chance you could add this code into a future update so I won’t have to keep adding it when you update the plugin?

    The change is made in the core.php file. It’s around line 167. The code is pretty simple and doesn’t need any explanation.

    elseif( isset($attr['slug']) ){
    			$args = array(	'name' 				=> $attr['slug'],
    							'post_type'		=> 'w4pl',
    							'post_status'		=> 'publish',
    							'posts_per_page'	=> 1);
    
    			$post = get_posts($args);
    			if ($post){
    				$options = get_post_meta( $post[0]->ID, '_w4pl', true );
    				$options['id'] = $post[0]->ID;
    			}
    		}

    Thanks,
    Adrian

    https://wordpress.org/plugins/w4-post-list/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘postlist by slug’ is closed to new replies.