I have created a page and added the following shortcode from wp-orbit-slider
[orbit-slider category="test"]
I want the contents of
[orbit-slider category="test"]
be displayed on the header part, instead of on the content area part, which the wordpress usually does . I tried adding the the short code on header.php and it works, but the same content will be duplicated on the content area also. I need to avoid this. How can this be achieved ?
This might work for you, trying to hook early to
the_content
filter to strip the shortcode tag from it:You can use the PHP call for a Shortcode. It works like this:
But I think, from your question, that you may have different Shortcodes for each page. If this is the case, try adding a Custom Field for your Pages, containing the
category
for your Orbit-Slider.Of course, if you use the build in Taxonomy System (e.g. the standard Categories) you do not have to use a Custom Field, you can just use the Category. I use the first Caategory for the Categoryversion – be sure to handle the exceptions yourself here.
You should be fine like this.
And remember to not put your shortcode into the Content again 🙂