Aminta
Forum Replies Created
-
Ok, so I have to ask to Stripe support?
Thanks…
Thanks, I’ve already read the documentation: do you confirm that there is no hook to add label/input classes and/or change the markup?
Thanks,
Davide
Hi Sunny!
I’m filtering it with “All-in-One Event Calendar: Import Feeds” inserting the appropriate Feed Url and Tag filter…
Ok but what for the backend? Only a Css-JS solution?
Thanks for your answer, I’ve tried this:
function alt_filter($attr) { // var_dump($attr); // array(5) { ["src"] ["class"] ["alt"] ["srcset"] ["sizes"] } $attr["alt"] = 'showme'; return $attr; }; add_filter( 'wp_get_attachment_image_attributes', 'alt_filter', 10, 2 );
But in /wp-admin/post.php?post=184&action=edit it doesn’t change nothing, why?
- This reply was modified 8 years, 1 month ago by Aminta.
Forum: Developing with WordPress
In reply to: Make pagination work for multiple queriesThanks bcworkz, for having once again extended the answer to a broader perspective. Only one question: can you please a brief code example of:
The total count needs to be maintained between requests, either passed as an URL parameter, or kept as a cookie or session variable (which is just another type of cookie).
I fear I can’t reproduce it…
Thanks
Forum: Developing with WordPress
In reply to: Make pagination work for multiple queriesHi bcworkz! You were right about the computational problems!
These two lines:
$category_posts = get_posts(array(‘category_name’ => get_query_var( ‘category_name’ )));
$category_posts = get_posts(array(‘category_name’ => get_query_var( ‘category_name’ )));
made exceed the script time limit in production when calculating
$array_where_to_get_post = array_diff( $category_posts_ids, $sticky, $expired_posts_ids );
So I’ve changed this portion of code in:
$nr_of_posts_to_be_analyzed_to_include_only_current_events = 100; // How many post to anatlyze to include only current events, ie events thata are not in category id 11114 // posts in category, limited in number otherwise - if you set '-1' and you have 7.000 posts - you exceed the script time limit execution $category_posts = get_posts(array('category_name' => get_query_var( 'category_name' ), 'posts_per_page' => $nr_of_posts_to_be_analyzed_to_include_only_current_events,'orderby' => 'date', 'order' => 'DESC')); // expired posts in category, limited in number otherwise - if you set '-1' and you have 7.000 posts - you exceed the script time limit execution $expired_posts = get_posts(array('category__and' => array(11114, get_query_var('cat')), 'posts_per_page' => $nr_of_posts_to_be_analyzed_to_include_only_current_events, 'orderby' => 'date', 'order' => 'DESC'));
Now, about your last considerations, I fear that there is a misunderstanding. The final output that I would get is not like:
Page 1
Featured Category
–Post 3
Other Posts
–Post 1
–Post 2
–Post 4Page 2
Featured Category
–Post 5
–Post 7
–Post 8
Other Posts
–Post 6Page 3
Featured Category
Other Posts
–Post 9
–Post 10But like:
Page 1
Featured Category
-Post 3
-Post 5
-Post 7
-Post 8Page 2
Featured Category
-Post 9
-Post 10
Other Posts
–Post 1
–Post 2So my goal is to output first all the “Featured category” posts (in multiple pages if the total number of these posts exceed the “posts_per_page” one) and then output the “Other posts category” posts…
Any idea to achieve this with the “multiple loop” (and not “mulitple queries”) method?
Last: what did you mean with
the solution would be to use output buffering and conditionally output the buffered content once the looping has completed and we know if posts would appear or not under each title.
?
Many thanks!
Forum: Developing with WordPress
In reply to: Make pagination work for multiple queriesI’m particularly interested in this solution of yours:
“You would limit each query to just the posts for the current page. If the total posts per page are 10, you may get 10 posts in one category and none in the other, or 5 posts in each, 1 post in one and 9 in the other, etc.
Then for the next page, you offset the query by 10 to get the next 10 posts, again with variable number of posts in each category. For the 3rd page you offset by 20 to get the next 10 posts, etc.
This scheme would work with pre_get_posts because you don’t restrict the posts by category here, that is done by the loops. You cannot know how many posts will occur in each category, but the total will always be 10.
Please, can you write down a small example?
Thanks!
Forum: Developing with WordPress
In reply to: Make pagination work for multiple queriesThanks for your detailed explanation. For performance is it not enough to use the argument ‘fields’ => ‘ids’ in the single queries? Surely it avoids memory exhausted errors, as I have seen… So do you have a solution that gets the exact same output that my example with a single query or using “pre_get_posts” action? Thanks!
Forum: Developing with WordPress
In reply to: Make pagination work for multiple queriesMeanwhile I’ve found by me this solution, that works, but I’d like to know if there is a solution event without multiple queries…
`global $wp_query;
$paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1;
$post_per_page = 5; // How many post per page – setup as you need
$sticky = get_option( ‘sticky_posts’ );
$category_posts = get_posts(array(‘category_name’ => get_query_var( ‘category_name’ )));
$category_posts_ids = array();
foreach( $category_posts as $post ) {
$category_posts_ids[]=$post->ID; // Array with posts ID
}
$expired_posts = get_posts(array(‘cat’ => 11114));
$expired_posts_ids = array();
foreach( $expired_posts_ids as $post ) {
$expired_posts_ids[]=$post->ID; // Array with posts ID
}
$array_where_to_get_post = array_diff( $category_posts_ids, $sticky, $expired_posts_ids );
// 1/3 only the sticky posts
$stickies_posts_args = array(
‘category_name’ => get_query_var( ‘category_name’ ),
‘post__in’ => get_option( ‘sticky_posts’ ),
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
‘posts_per_page’ => -1,
‘fields’ => ‘ids’ // important: to avoid memory exhausted error we retrive postids only
);// 2/3 only the posts not in cat id 11114 and not the sticky posts
$not_expired_posts_args = array(
‘post__in’ => $array_where_to_get_post,
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
‘posts_per_page’ => -1,
‘fields’ => ‘ids’ // important: to avoid memory exhausted error we retrieve postids only
);// 3/3 only the 11114 cat id posts and not the sticky posts
$expired_posts_args = array(
‘category_name’ => get_query_var( ‘category_name’ ),
‘post__not_in’ => get_option( ‘sticky_posts’ ),
‘category__in’ => array(11114),
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
‘posts_per_page’ => -1,
‘fields’ => ‘ids’ // important: to avoid memory exhausted error we retrieve postids only
);$firstQuery = get_posts($stickies_posts_args);
$secondQuery = get_posts($not_expired_posts_args);
$thirdQuery = get_posts($expired_posts_args);
$mergePosts = array_merge( $firstQuery, $secondQuery, $thirdQuery ); // Merge all queries
$uniquePosts = array_unique($mergePosts); // Create an array with unique posts
// Final query
$args = array(
‘post_type’ => ‘any’,
‘post__in’ => $uniquePosts,
‘paged’ => $paged,
‘orderby’ => ‘post__in’, // order the posts as they are (already ordered in separate queries)
‘order’ => ‘DESC’,
‘posts_per_page’ => $post_per_page,
‘ignore_sticky_posts’ => 1 // otherwise it breaks pagination
);$wp_query = new WP_Query($args);
if( $wp_query->have_posts() ):
while( $wp_query->have_posts() ): $wp_query->the_post();
// outputs what you want
endwhile;
endif;
echo paginate_links();`
Forum: Developing with WordPress
In reply to: Make pagination work for multiple queriesSorry, what solution your referring at speaking of “limit each query to just the posts for the current page”? The solution with multiple queries or the solution with “rewind posts”?
Thanks
Forum: Developing with WordPress
In reply to: Make pagination work for multiple queriesFirst of all, thanks @bcworkz, for your extensive explanation of the problem in general. Knowing the problems of multiple queries with pagination, I’ve tried the second way:
if ( have_posts() ) { while ( have_posts() ) { the_post(); if ( in_category(11114) === false ) { // Only display posts not in category with 11114 ID // Do what you need to do post post type posts } } rewind_posts(); // Rewind the loop so we can run it again while ( have_posts() ) { the_post(); if ( in_category(11114) ) { // Only display posts from category with ID 11114 // Do what you need to do page post type posts } } }
But there is a (currently) not solvable problem. Let’s say the “post_per_page” are set to “5” and let’s say the query have these results:
post 1 is in category 11114
post 2 is in category 11114
post 3 is NOT in category 11114
post 4 is NOT in category 11114
post 5 is in category 11114
post 6 is in category 11114
post 7 is in category 11114
post 8 is NOT in category 11114
post 9 is NOT in category 11114
post 10 is in category 11114Desired result:
Page 1:
(first the posts that are NOT in category 11114, then posts that are in category 11114, 5 posts per page)
post 3 (NOT 11114)
post 4 (NOT 11114)
post 8 (NOT 11114)
post 9 (NOT 11114)
post 1 (in 11114)Page 2:
post 2 (in 11114)
post 5 (in 11114)
post 6 (in 11114)
post 7 (in 11114)
post 10 (in 11114)Real result:
Page 1:
post 3 (NOT 11114)
post 4 (NOT 11114)
post 1 (in 11114)
post 2 (in 11114)
post 5 (in 11114)Page 2:
post 8 (NOT 11114)
post 9 (NOT 11114)
post 6 (in 11114)
post 7 (in 11114)
post 10 (in 11114)So, with “posts_per_page” = “5”, WP consider the first 5 posts from the query and if it can find a post not in category 11114 outputs it, otherwise it doesn’t BUT IT COUNTS ALSO THE POSTS SKIPPED. I’ve tried to manually change the “post_count” value with something like $wp_query->set(‘post_count’, $post_count – 1) run each time we find a post that is not in category 11114 but it doesn’ work, its value is always “5” (the value of “posts_per_page”).
As you suggest, I could try to move the logic of grouping the posts to the “pre_get_posts” action, but I don’t know what to set there to make the query outputs first the posts that are not in category 11114 and then the posts that are in category 11114…
Forum: Plugins
In reply to: [Contact Form 7] Please remove span wrapping !I would add to earlier requests, please remove the <span> tag, and thanks for your wonderful plugin!
Forum: Plugins
In reply to: [Edge Suite] Permission set to 777 but Extraction of…. failed! :-(Hi!
My host has verified that ZIP is enabled on server!
Here you can read the Php.ini:
https://www.prolocoregionefvg.it/info.html
What can we do?
Many thanks for you support!
Davide
Forum: Plugins
In reply to: [Edge Suite] Permission set to 777 but Extraction of…. failed! :-(Ok, sorry I’ve misunderstood!
I’ve installed the version from the link, I’ve also tried with other .OAM but still:
Extraction of /data/www/proloco.qnet.it/html/wp-content/uploads/edge_suite/tmp/Consorzio700F.oam failed: Impossibile copiare il file.
??