-
AuthorPosts
-
January 25, 2021 at 7:49 pm #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
January 27, 2021 at 12:35 pm #1275761Hey 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,
IsmaelJanuary 27, 2021 at 12:44 pm #1275764hello 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 authorok for you ?
regardsJanuary 28, 2021 at 5:23 am #1275937Hi,
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-1149381Best regards,
IsmaelFebruary 18, 2021 at 8:59 pm #1282083hello
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’);February 19, 2021 at 3:38 pm #1282251Hi,
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 -
AuthorPosts
- You must be logged in to reply to this topic.