How can I implement shortcode on click event - php

I am a newbie in WordPress not totally but 6 months. So I am finding the new thing and practicing on WordPress. I want to know that how can I implement shortcode on click event means
I have buttons on my index.php page like this:
<button>Video</button>
<button>audio</button>
and with these video and audio buttons, I want to attach the WordPress inbuilt video and audio shortcodes and if I click on any of the two buttons.
suppose if I have clicked on video button the video tag appears under the video buttons and when I again click on video button the video the video tag again disappears.

I'm not completely sure if I understand what you want to accomplish with your buttons, but you can totally do that with shortcodes.
The use of shortcodes is one of the ways to expose functionality written in plugins/themes to users of a WordPress site. So you can write code to do what you want then create a shortcode for it:
function something_rad_function( $atts ){
return "Some RAD functionality";
}
add_shortcode( 'something_rad', 'something_rad_function' );
You can use the shortcode in a post or page with: [something_rad]. Also do_shortcode() may come in handy if you need external functionality available through shortcodes.

Related

Lightboxed image with social overlay

I've created a filtered gallery with a plugin called GoGalleryPro for Wordpress. When you click on an image a lightbox opens showing the image.
Whilst the lightbox active i'd visible to be able to have social icons in the bottom left corner.
I've tried a couple of plugins and tried to write a snippet of code myself by no joy. Any guidance would be great!
Here is the link to the page in question;
http://176.32.230.43/wjwhites.co.uk/congress/
I like to use http://dimsemenov.com/plugins/magnific-popup/.
You will be able to add custom html within the pop up window.

WordPress Genisis Featured page widget with an iframe

I have a clients website that uses a WordPress Genisis Framework Child Theme.
One of the widgets that are built into the theme is a featured page widget. It is placed on the front of the page. The widget gathers 250 characters and displays that on the front page along with the featured image from that page.
The problem is that because the next page only contains an iframe from another website the WordPress widget does not grab the text, so it leaves a nice blank hole on the clients homepage. The previous developer set it up this way and didn't bother to plug the hole.
Any ideas how I could get the text to display correctly.
I am familiar with most web languages and the WordPress back end so any suggestions would help.
You can try to place a hidden div on the page where you paste in the text that you want. It wont be dynamic if the integrated page changes but it could be a possible work around.

Add custom html code snippet to my website

I'm a Wordpress newbie. I want to add a widget from another site onto my Wordpress website.
Here is the snippet:
<script type="text/javascript"
src="http://www.freshcontent.net/canada_news_feed.php"></script>
It will create something like a ticker on my site. I know how to add custom html to my posts. But, how do I make this show up on every page of my site? Are there tutorials for something similar to this?
Log into the dashboard, click on "Appearance" in the menu on the left, then choose "Widgets" and "Text". Choose the widget area you want it to appear in (these are theme-dependent, but can be customized any way you like), and then click "Add Widget".
Add a title, paste in your HTML, and click "Save". That's all there is to it.

Wordpress : hide shortcodes in TinyMCE

Is it possible to change shortcode appearance in Wordpress TinyMCE editor? One of my clients has no HTML knowledge and it's really hard to explain him what not to edit on subpages.
All I want is to hide the shortcodes and add a button on the kitchen sink to show them.
Work arounds.
1 - Filter content before displaying in the editor. Onclick of the button in kitchen sink, call the same url with a $_GET param e.g ?filter=false and do not filter the content this time.
2 - Wrap all shortcodes in a div with a specific class before displaying and toggle that class onclick of the button in the kitchen sink.
For both ways I need to get the content before displaying it in TinyMCE so that I can modify it. Unable to do so .. please help.
P.S: this needs to be done in a plugin. cannot modify core wordpress files.
You could use the tinymce param "setup" and create a onBeforeSetContent handler.
This way you can modify the content before it gegts into the editor and perform Action 2.

Wordpress Gallery Links

I have a Wordpress page which is showing gallery that I created by using Wordpress built-in post editor: into it here is its url: http://jalrosh.com/lylescenter/?page_id=8
Now the issue is that when I click on some image its big image opens in a new page and that is disturbing page design. It should come in the central area but it is appearing on the top of the remaining page.
There are several plugins that could help you do this. For example http://wordpress.org/extend/plugins/lightbox-2-wordpress-plugin/ I haven't used this plugin, but a wordpress plugin search for "lightbox" came with several options. Try some of them out and see what one you like best.
I haven't tried any of them but supposedly they should take any image and have it viewed via a lightbox (which is the correct term for having the image displayed over the existing page).

Categories