What do you mean by “custom functions”?
For example, I created a custom function so I can insert shortcode on a page or post to display tag cloud within. The function can be added to the theme’s functions.php file but it will get over-written with a theme update. So I can use a plugin like My Custom Functions to insert/add my custom function, but I would use Ad Inserter instead to include the function if it works so I don’t use an extra plugin if it’s not necessary.
custom function example for tag cloud shortcode:
add_shortcode( 'native_tagcloud', 'wp_tag_cloud' );
No need to create a function.
You can use Ad Inserter shortcodes to insert arbitrary HTML/Javascript/CSS/PHP code in any page or post:
https://adinserter.pro/documentation/manual-insertion#shortcodes
Good to know thanks. So, for example, I can implement this custom function and shortcode using Ad Inserter?
I’m not sure how…will have to trial and error I guess.
// create [custom_rss] shortcode
add_shortcode( 'custom_rss', 'execute_custom_rss_shortcode' );
function execute_custom_rss_shortcode() {
return do_shortcode('[wp_rss_retriever url="https://news.google.com/rss/search?q=' . get_the_title() . '&hl=en-US&gl=US&ceid=US%3Aen" items="8" excerpt="50" read_more="true" credits="false" new_window="true" cache="1800"]');
}
-
This reply was modified 6 years, 8 months ago by
wordmax.
-
This reply was modified 6 years, 8 months ago by
wordmax.
If I understand your needs correctly you simply configure one block with your (long) shortcode
[wp_rss_retriever url="https://news.google.com/rss/search?q=<?php get_the_title(); ?>&hl=en-US&gl=US&ceid=US%3Aen" items="8" excerpt="50" read_more="true" credits="false" new_window="true" cache="1800"]
and enable PHP processing and Ad Inserter shortcode for this block.
Assuming this is block 1 with name “Custom RSS” you can then use in posts either
[ADINSERTER block="1"]
or
[ADINSERTER name="Custom RSS"]
You can also use Ad Inserter shortcode [ADINSERTER data='title'] to get post/page title but I’m not sure how it will behave nested in other shortcodes.