Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1275330

    hello support
    i have to create a website for writers and i need to use the Masonry for posts but i need to propose them by categories and by author in order to create specifical page for each autor who publishing post : propose a page by author where there are bibliographic articles, therefore publications so that each author has on his page what he has published …

    thank you

    #1275761

    Hey caledoman,

    Thank you for the inquiry.

    Have you tried creating a category for each author? You could apply that category to the articles that they have created, and when creating a page for a specific author, just select that category in the masonry element’s Which Entries? settings.

    Best regards,
    Ismael

    #1275764

    hello Ismael
    thenk you being here for me
    i do not want to creat a category for each author because there will be to many categories and impossible to organize this way
    il do prefer to use a category for publication/books and propose to each author to publish their own publication/books in a global categoy but when i want to talk about a specific author i do have to publish a page using only the book he published for him, that’s why a need to add a filter per author

    ok for you ?
    regards

    #1275937

    Hi,

    That is possible but you may need to alter the default query of the Masonry element and include the author parameters or arguments.

    // https://developer.wordpress.org/reference/classes/wp_query/#author-parameters

    To alter the query of the Masonry element, you could use the avia_masonry_entries_query filter. Usage examples can be found in the following thread.

    // https://kriesi.at/support/topic/display-pictures-by-number-order/#post-1221028
    // https://kriesi.at/support/topic/exclude-a-category-in-masonry-portfolio/#post-1268963
    // https://kriesi.at/support/topic/show-arrows-in-easy-slider-and-full-screen-slider-but-not-dot-things/#post-1149381

    Best regards,
    Ismael

    #1282083

    hello
    how are you ?
    I have advanced but I still have a problem with the code I give you the example I do not understand why it does not work help
    this is working well :

    $authorid = get_the_author_id();
    function avia_masonry_custom_query( $query ) {
    $query = array(
    ‘cat’ => ’19’,
    ‘author’ => ’35’
    ); return $query;
    }
    add_filter(‘avia_masonry_entries_query’, ‘avia_masonry_custom_query’);

    ————————————————————————————————————————-
    but i need to use it dynamic author id and here bellow the code not working please help ?
    $authorid = get_the_author_id();
    function avia_masonry_custom_query( $query ) {
    $query = array(
    ‘cat’ => ’19’,
    ‘author’ =>$authorid
    ); return $query;
    }
    add_filter(‘avia_masonry_entries_query’, ‘avia_masonry_custom_query’);

    #1282251

    Hi,

    Thank you for the update.

    The code should look something like this..

    /** alter masonry query **/
    function avia_masonry_entries_query_mod( $query ) {
    	$query["author"] = 35;
    	return $query;
    }
    
    add_filter("avia_masonry_entries_query", "avia_masonry_entries_query_mod");
    

    .. where 35 is the ID of the author. And in the Masonry element, you can already select the categories in the Which Entries? settings, so you do not have to adjust the taxonomy or category query.

    Best regards,
    Ismael

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