Tagged: ,

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1215367

    I copy this files to child theme – archive.php, index.php and tag.php. I set ‘columns’ => 4.
    Is there any other solution, to make the same thing only from child function.php? To add some filter, function etc?

    It will be useful for better updating the theme.
    Thanks

    #1215824

    Hey Martin,

    If there are no filters around, this is the only way. Which lines are you looking at?

    Best regards,
    Victoria

    #1215884

    can you try this – don’t know if this is the correct way to use this filter but it might work in combination with blog-grid style
    just check for context: archive , index, tag

    add_filter('avf_post_slider_args', function($atts, $context){
    	global $posts;
    	if($context == 'index') { $atts['columns']  = 4;}
    	return $atts;
    }, 10, 2);
    #1216021

    It works! Thanks a lot!

    Is this correct?

    add_filter('avf_post_slider_args', function($atts, $context){
    	global $posts;
    	if($context == 'index' || $context == 'archive' || $context == 'tag') { $atts['columns']  = 4;}
    	return $atts;
    }, 10, 2);
    #1216042

    Yes the pipe will have the “or” in the if clause.
    That will work! – i’m only unsure if i had to insert that global $posts and if there is a more elegant way for the syntax.

    #1216048

    It works without “global $posts;” :)

    add_filter('avf_post_slider_args', function($atts, $context){
    	if($context == 'index' || $context == 'archive' || $context == 'tag') { $atts['columns']  = 4;}
    	return $atts;
    }, 10, 2);

    Thanks

    • This reply was modified 4 years, 5 months ago by Martin.
    #1216055

    Such a question is exactly the reason why I am also happy to answer questions here as a fellow participant. It is a challenge and i will learn the most from it. If a customer shows up and expresses exactly such a wish, I don’t stand there and won’t know what to say.
    So thank you from my point of view, too.

    #1216110

    Hi,

    Thanks for helping out as always @guenni007, it’s very much appreciated :-)

    Best regards,
    Rikard

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.