Guest User

Untitled

a guest
Dec 12th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. // Add default options to be set by shortcodes:
  2. add_option ('shortcode-test', 'Shortcode Default');
  3. add_option ('shortcode-include-test', 'Shortcode Include Default');
  4.  
  5. // Shortcode A:
  6. function shortcode_a(){
  7. update_option('shortcode-test', 'Shortcode A');
  8. $output = get_option('shortcode-test');
  9. $output .= " Shortcode A";
  10. return $output;
  11. }
  12. add_shortcode('shortcode-a', 'shortcode_a');
  13.  
  14. // Shortcode B:
  15. function shortcode_b(){
  16. update_option('shortcode-test', 'Shortcode B');
  17. $output = get_option('shortcode-test');
  18. $output .= " Shortcode B";
  19. return $output;
  20. }
  21. add_shortcode('shortcode-b','shortcode_b');
  22.  
  23. // Shortcode Test:
  24. function shortcode_test() {
  25. $output = "shortcode-test = " . get_option('shortcode-test') . "<br/>";
  26. $output .= "shortcode-include-test = " . get_option('shortcode-include-test');
  27. return $output;
  28. }
  29. add_shortcode('shortcode-test', 'shortcode_test');
  30.  
  31. // Shortcode Include One:
  32. function shortcode_include_one_test() {
  33. include('shortcode-include-one.php');
  34. return shortcode_include_one();
  35. }
  36. add_shortcode('shortcode-include-one', 'shortcode_include_one_test');
  37.  
  38.  
  39. // Shortcode Include Two:
  40. function shortcode_include_two_test() {
  41. include('shortcode-include-two.php');
  42. return shortcode_include_two();
  43. }
  44. add_shortcode('shortcode-include-two', 'shortcode_include_two_test');
  45.  
  46.  
  47. /* shortcode-include-one.php */
  48.  
  49. function shortcode_include_one() {
  50. update_option('shortcode-include-test', 'Shortcode Include One');
  51. $output = get_option('shortcode-include-test');
  52. return $output;
  53. }
  54.  
  55. /* shortcode-include-two.php */
  56.  
  57. function shortcode_include_two() {
  58. update_option('shortcode-include-test', 'Shortcode Include Two');
  59. $output = get_option('shortcode-include-test');
  60. return $output;
  61. }
Add Comment
Please, Sign In to add comment