Soundcloud Wordpress Plugin passing database value into Shortcode - wordpress

I'm using the SoundCloud plugin for Wordpress. The shortcode format they recommend using is:
[soundcloud]http://soundcloud.com/forss/flickermood[/soundcloud]
I've also searched and found that this format can be used as well:
[soundcloud url="https://api.soundcloud.com/playlists/25121853" params="auto_play=false&hide_related=false&visual=true" width="100%" height="450" iframe="true" /]
Basically my question is how would I pass a database value into the url section of this shortcode. I've used shortcodes for other plugins before which involve the use of key="xxx", but the Soundcloud shortcode seems to need the url="xxx" part.
I'm sorry if this is unclear, it's my first attempt at getting help on stackoverflow.
Many Thanks,
Paul

If you want to do it from the wordpress post editor, you will first have to install "Allow PHP in Posts and Pages" plugin. As you already have the value in your post_meta table, All you have to do in your editor is something like.
[php] echo get_post_meta( $post_id, 'soundcloudlink', TRUE );[/php]
Replace $post_id with the id of your post.

Related

Woocommerce best_selling_products shortcode not working

Trying to add:
<?php echo do_shortcode('[products best_selling="true" limit="4"]'); ?>
In a template returns nothing. I see that no hooks are present for this but woocommerce says it should be supported.
Please Try this shortcode
[best_selling_products per_page="12"]
Please refer below link for Woocommerce Shortcodes
https://docs.woocommerce.com/document/woocommerce-shortcodes/
Coming back to this one because I came across another shortcode that wasn't working.
It turned out that the theme was the culprit. After switching to the default theme all shortcodes were working correctly.

woocommerce theme development without shortcodes

I was wondering if someone could help me out. I am developing a theme that uses woocommerce as the ecommerce solution. I know that there are predefined shortcodes that you can use but i was wondering if there was a way to actually implement woocommerce items in my php code as opposed to using shortcodes.
Thanks,
Try this:
https://wordpress.stackexchange.com/a/125286/60175
<?php echo do_shortcode('[product_page id="31"]'); ?>
And at the Shortcodes doc, I see
To find the Product ID, go to the Product > Edit screen and look in the URL for the postid= as shown below.
http://docs.woothemes.com/document/woocommerce-shortcodes/
Of course this still uses shortcodes (pretty slick), but in your PHP. The Wordpress framework must be available in your PHP page, which I think you do by including wp-load.php at the beginning.

Wordpress plugin shortscodes in other plugins?

I'm developing a plugin that creates custom wordpress pages, however I ran into a problem when trying to get shortcodes from other plugins to integrate into my plugin, well more like I couldn't find any info on it.
For example if someone uses my custom page builder and adds a short code [gallery] that is associated with an enabled plugin, I want the shortcode to do it's thing.
Could anyone point me in the right direction for this?
Try wordpress
http://wordpress.org/plugins/synved-shortcodes/
while this plugin let's you integrate shortcodes on every wordpress page , I suppose that you issue is with wordpress functions.php file where you can have a look at , with this plugin installed !
You can check if a shortcode exist before printing it with the function shortcode_exists() (https://codex.wordpress.org/Function_Reference/shortcode_exists)
Example:
<?php
if ( shortcode_exists( 'gallery' ) ) {
// The [gallery] short code exists.
}
?>
Then, if it exist and you want to print that shortcode with PHP code you should use do_shortcode() function (https://developer.wordpress.org/reference/functions/do_shortcode/)
Example:
<?php echo do_shortcode('[gallery]); ?>
Always use in WordPress's in-built
the_content
hook to print your custom page content.
WordPress by default process all shortcodes before outputting any stuff from this hook.
More info can be found here: https://codex.wordpress.org/Function_Reference/the_content

Wordpress: How to pass additional Content to the blog-preview page?

For each blog-post on my wordpress-blog I'd like to have Teaxtarea where i can pass additional content for that post.
In my case that would be an unordered list which contains a quick overview of the content.
That additional content should be displayed in the preview of the post on the blog-preview-page.
My problem:
I am actually not sure on how to best add this additional content and then pass it to the preview.
Do I use wordpress' custom fields for something like this?
I'm gratefull for a push in the right direction.
Thank you,
Nils
If I understand you right, I'd take a look at "custom meta boxes" functionality - it allows you to add any type of additional input into your blog post admin area, and than display its content on front-end however you like.
There's a nice tutorial series on that topic, with example code snippets:
http://wp.tutsplus.com/series/reusable-custom-meta-boxes/
And if you'd like to display the textarea content only in preview mode, you can use appropriate conditional tag in you template file:
http://codex.wordpress.org/Conditional_Tags#A_Preview
The conditional tag is_preview returns true when a single post is viewed in Draft mode. The following will append post meta to the content when a post is being previewed:
function so16799607_preview( $content )
{
if ( ! is_preview() )
return $content;
return $content . get_post_meta( get_the_ID(), 'my_post_meta', true );
}
add_filter( 'the_content', 'so16799607_preview', 10, 1 );
You should check out Advanced Custom Fields. That's a really stable plugin that lets you create custom meta boxes in posts, pages and custom post types. That plugin does exactly what your question states. Need al little PHP to get stuff from your database, but that is as easy as:
<?php the_field(field_name);?>
And the documentation is pretty good. And if you don't like a plugin, it exports the PHP as well.
Anther tool that does the same is Pods Framework. Both powerfull extensions to any WP install in my opinion.
Hope this helps.

Archive Page in Wordpress?

I want to know how to make an archive page like instantshift has made.. link below..
http://www.instantshift.com/archive/
I have made everything but don't know the query to specify the orderly archives listing
I use Viper Bond's Clean Archives for a similar effect: http://www.viper007bond.com/wordpress-plugins/clean-archives-reloaded. I like that the jQuery effect only shows when you activate the plugin in a page.
You could also use <?php wp_get_archives( $args ); ?> as found here: http://codex.wordpress.org/Function_Reference/wp_get_archives
Don't forget to not leave wordpress.stackexchange.com lonely too!

Resources