1
vote
2answers
189 views

What are the disadvantages of using global variable?

I am a newbie at WordPress. In my "recent posts" shortcode, I used global $post variable, because the_title() function was giving me page's title, not post's title. I am not exactly sure, but I ...
0
votes
1answer
230 views

using 1 form shortcode (si or cf7) for all multisite sites [closed]

I have a network with more than 50 sites. I want to create one contact form (which means one shortcode) using contact form 7 or fast secure contact form. Then, I want to use that shortcode on all the ...
0
votes
1answer
126 views

How to check if this is the nth instance of a given shortcode in a post

Suppose I have a shortcode called [item], which I have used 20 times in a particular post. Is it possible, from within the shortcode handler function, to know what the numerical index of the given ...
12
votes
5answers
2k views

How to include code only on specific pages?

I'm learning about plugins and shortcodes. I noticed that when I activate my plugin its code gets loaded on all of my pages-- even pages that don't have my shortcode. (I don't mean content vs. admin ...