fabiano1987
Forum Replies Created
-
you’re welcome,
as i love to be helped, i love to help too, when it is in my capabilities ??ok i solved last question with a little modification of your code and something in addition, i will publish everything here for posterity
<?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : '1'; $ids = new WP_Query( array( "post_type" => "advert", "post_status" => "publish", "posts_per_page" => 10, 'paged'=> $paged, "tax_query" => array( array( 'taxonomy' => "advert_category", 'field' => 'term_id', 'terms' => 478 ) ), ) ); ?> <?php $total_pages = $ids->max_num_pages; ?> <?php foreach ($ids->posts as $value) { ?> <!-- HTML here --> <?php }// this closes the for $args = array( 'base' => get_pagenum_link(1).'?paged=%#%', 'current' => $paged, 'total' => $total_pages, ); ?> <?php echo paginate_links( $args );?>
worked very well! thank you!
if i would like to add pagination?
posts_per_page 10, then?
how do i add the “numbers” to change the page?Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] How to get the “advert” Featured Image URL?Yes in fact the $post_id is not defined and that’s why i can’t see the image
(i don’t know why it works for advert posts update, but not for scheduled posts.. it should not work in both cases)
By the way, You don’t need to be an OneSignal expert because the plugin was created from scratch, it’s not something existing to understand before to modify
so my question is: How would you do, to indicate the Advert Post ID inside a php file which is located outside the WP-Adverts directory?
if you write me the code i will try to re-use it inside that plugin and this could be very helpfull for everyone
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] How to get the “advert” Featured Image URL?it works but not always..
i mean, i’ve created a onesignal plugin, so i’ve added this code in a php file which is inside another directory , (different from wpadverts plugin folder )
What happens:
when i update an already-published advert post, it works fine and i receive the push notification with the imagebut when i schedule an advert post , i receive the push notification without the image.
It’s like it cannot get the image on scheduled posts, or cannot read the post-id, i don’t know
maybe i also need to specify $post_id = something?
This is the whole OneSignal Plugin code, (the php page)
add_filter('onesignal_send_notification', 'onesignal_send_notification_filter', 11, 4); function onesignal_send_notification_filter($fields, $new_status, $old_status, $advert) { $id = $post->ID; $immagine = get_the_post_thumbnail_url( $post_id, "full" ); $app_data = [ 'id_article' => $id, 'imageURL' => '' ]; $fields['ios_sound'] = 'unsure.aiff'; $fields['ios_attachments'] = array ('img1' => $immagine,); $fields['content_available'] = 1; $fields['data'] = $app_data; $fields['ios_badgeType'] = 'Increase'; $fields['ios_badgeCount'] = 1; $fields['mutable_content'] = 1; return $fields; }
Am i missing something? Because it’s only on scheduled posts which it doesn’t work
it was a plugin, i’ve solved the problem thanks to your help
i’ve disabled them all and reactivated them one by one. As soon as i saw that the
action="./"
was back in the form code, i was able to understand what was causing the problemIt’s very strange. I’ve installed the plugin from zero.. it’s not customized in this moment
I will check everything better now. Thank you
1. I know it doesn’t work for the image. Even if I add your code to the single.php to show the category image in the post, it doesn’t works
2. Ah ok
3. So what can I do
Now opengraph can see the proper category url, which is good, but still no luck for the category big icon image
it doesn’t work
i also try to add inside the page
<img src="<?php echo get_term_meta( $term_id, 'advert_category_big_icon', true) ?>">
but it can’t obtain the image url, so maybe we need another code?
In wpadverts/template/ single.php
1) every advert category page… for example, this: https://scontiamolo.com/advert-category/coverstyle/
2) do you mean this?
1. Thank you, worked
2. Ok, i will think at something else
your help is very precious
this plugin is the best thing i’ve ever purchased (the addons)What do you mean by og:image not working? It does not show when sharing on Facebook or it does not show in the page source code?
I mean that using that code, i don’t get the category image url
<?php if( is_tax( 'advert_category' ) ): ?> <?php $term_id = get_queried_object()->term_id ?> <meta property="og:url" content="<?php echo get_term_link( $term_id ) ?>" /> <meta property="og:image" content="<?php echo get_term_meta( $term_id, 'advert_category_big_icon', true) ?>" /> <?php endif; ?>
I use the facebook opengraph debugger and here, even if the image is too small, you can see the link in the meta (even if it cannot display the image)
In this case, instead, the result is blank
lol
after doing this https://www.ads-software.com/support/topic/how-to-create-a-page-advert-php-to-duplicate-and-change-the-page-php-code/
nothing works anymoremaybe
<?php if ( is_tax( 'advert_category' ) ) { ?>
is not good anymore when using a taxonomy-advert_category.php pagethank you
worked