fabiano1987
Forum Replies Created
-
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Make the Addition of new Ads FASTERok
so we could just remove the 3rd page?
i mean the page which says: your ad has been posted, you can view it clicking here: XXX
it works! thanks!
thank you, it worked fine in template/single.php
now can you help me to put the image URL inside this?
<meta property="og:image" content="XXXXXXXXXXX" />
I need the “adverts_gallery” dimension, so $img2
wp-admin / Settings / Permalinks panel and click “Save Changes”
Hi Greg i already did this but no luck
Update:
i’ve found that to get the image in “advert_list” SIZE, i can use this:
<php $image = adverts_get_main_image( get_the_ID() ) ?> <php echo esc_attr($image) ?>
But what i need the image in “advert gallery” SIZE. What is the code to recall that URLs?
- This reply was modified 7 years ago by fabiano1987.
ok, a friend helped me and now everything is working.
i would like to share the code to help someone else in future.
that’s the final code to add in functions.php to have the shortcode to work:add_shortcode('appscr', 'nome_funzione_fabiano_1'); function nome_funzione_fabiano_1( $atts, $content = null ) { // Attributes $atts = shortcode_atts( array( 'appscr_id' => '', ), $atts ); $app = get_app_info($atts['appscr_id']); if ( $app ){ $device = 'iphonescreens'; $screens = $app->screenshotUrls; if ( !count($screens) ) { $screens = $app->ipadScreenshotUrls; $device = 'ipadscreens'; } // Qui restituisco le info sull'app $html = '<ul class="lightGallery '.$device.'">'; foreach ( $screens as $pic ) { $html.= '<li data-mfp-src="'. get_high_res($pic) .'"><a href="'. get_high_res($pic) .'" title=""><img src="'. img_resize(get_high_res($pic),0,300) .'" alt=""></a></li>'; } $html.= '</ul>'; /* echo '<pre>'; var_dump($app); echo '</pre>'; */ // Qui effettuo la sostituzione return $html; } else { return 'App ID errato'; } } // To use: echo do_shortcode('[appscr appscr_id="331441694"]');
i will close the topic so.
Thank you Greg, to be interested in my problem- This reply was modified 7 years ago by fabiano1987.
i made some searches and i’ve understand that:
1) my shortcodes can be used only inside “the_content”
2) to use a shortcode “outside” the_content, i need to define it in functions.php using “add_shortcode”What now..
– Here is the_content that i use to show the shortcode inside the_content:
add_action('the_content', 'get_app_id_shortcode18'); function get_app_id_shortcode18( $content ) { if ( !preg_match_all( '/\[appscr_([0-9]*)\]/im', $content, $matches ) ) return $content; if ( isset( $matches[1] ) ){ foreach ($matches[0] as $key => $shortcode) { $app = get_app_info($matches[1][$key]); if ( $app ){ global $post; if($post!=NULL) $post->app = $app; $device = 'iphonescreens'; $screens = $app->screenshotUrls; if ( !count($screens) ) { $screens = $app->ipadScreenshotUrls; $device = 'ipadscreens'; } // Qui restituisco le info sull'app $html = '<ul class="lightGallery '.$device.'">'; foreach ( $screens as $pic ) { $html.= '<li data-mfp-src="'. get_high_res($pic) .'"><a href="'. get_high_res($pic) .'" title=""><img src="'. img_resize(get_high_res($pic),0,300) .'" alt=""></a></li>'; } $html.= '</ul>'; /* echo '<pre>'; var_dump($app); echo '</pre>'; */ // Qui effettuo la sostituzione $content = str_replace($shortcode, $html, $content); } else { $content = str_replace($shortcode, 'App ID errato', $content); } } } return $content; }
What i have to add in my functions.php to define a new “add_shortcode” instead of “add_action”?
- This reply was modified 7 years ago by fabiano1987.
hi,
i tried to add in the wpadverts/template/single.php
<?php echo do_shortcode('[gallery]'); ?>
and
<?php echo do_shortcode('[gallery id="2"]'); ?>
and nothing is displayed. I mean, i see “nothing” on the frontend page
If i add:
<?php echo do_shortcode('[app_331441694]'); ?>
i just see [app_331441694] on the frontend –> an “echo” of the shortcode, without the “conversion”
If i add:
<?php do_shortcode('[app_331441694]'); ?>
(without the echo) i see “nothing” on the front end.the [app_id] shortcode is registered in mytheme/inc/shorcodes.php and it works fine if i use it in a post or in a page so it’s pretty strange that your custom_post_type doesn’t display it after the addition of “add_filter( “adverts_the_content”, “do_shortcode” );” in functions.php
the problem is that i really need it to work for the idea i’m going to develop using your plugin ??
One other thing i noticed is that you have a custom view for the Ad details page, what code are you using there to display the description?
yes i’ve customized the view.. i also purchased “wpadverts custom fields” so to show the description i’m simply using
<?php echo get_post_meta($post_id, 'app_description', true); ?>
BTW the [app_id] shortcode is not inside the description. it is inside the wpadverts/template/single.php file
please help me
- This reply was modified 7 years ago by fabiano1987.
Thank you!
this worked fine! now wordpress can load the Text Editor perfectlyi will close this topic and send the link to the Content Cards developer. Thanks again
UPDATE: i’ve found that the Plugin “ContentCards” is creating this conflict with WP Adverts
i still don’t know why but if i deactivate ContentCards, everything works fine.
The problem is that i cannot deactivate it ??It’s too much to ask you to try to install this plugin on your “test” site and try to fix the bug?
this is the screenshot:
if i select plain text, it works, otherwise it shows the error…
maybe plugin conflicts?
Hi,
thank you for the reply but this is not solving my problemafter adding the filter to my function.php file, nothing changes.. it still cannot convert my theme shortcode ??
i also tried
add_filter( "adverts", "do_shortcode" );
but no luck