Posted By

manavecplan on 09/12/10


Tagged


Versions (?)

Buttons+Boxes together


 / Published in: PHP
 

  1. function box_shortcode( $atts, $content = null )
  2. {
  3. extract( shortcode_atts( array(
  4. 'color' => 'yellow',
  5. 'size' => 'medium',
  6. ), $atts ) );
  7.  
  8. return '
  9. <style type="text/css">
  10. .shortcode_box {
  11. padding: 2px 4px;
  12. border: 1px solid #ccc;
  13. }
  14. .yellow {
  15. background: #ffd149;
  16. color: #666;
  17. }
  18. .blue {
  19. background: #a0c5ef;
  20. color: #333;
  21. }
  22. .gray {
  23. background: #f0f0f0;
  24. color: #333;
  25. }
  26. </style>
  27.  
  28. <div class="shortcode_box ' . $size . ' ' . $color . '">' . $content . '</div>';
  29.  
  30. }
  31. add_shortcode('box', 'box_shortcode');
  32.  
  33.  
  34.  
  35.  
  36. function button_shortcode( $atts, $content = null )
  37. {
  38. extract( shortcode_atts( array(
  39. 'color' => 'blue',
  40. 'size' => 'medium',
  41. ), $atts ) );
  42.  
  43. return '
  44. <style type="text/css">
  45. .shortcode_button {
  46. padding: 2px 8px;
  47. border: 1px solid #ccc;
  48. border-radius: 10px;
  49. -webkit-border-radius: 10px;
  50. -moz-border-radius: 10px;
  51. }
  52. .black {
  53. background: #ffd149;
  54. background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#636363), to(#332F2F));
  55. background: -moz-linear-gradient(19% 75% 90deg,#332F2F, #636363);
  56. color: #f0f0f0;
  57. border-top-color: #1c1c1c;
  58. border-left-color: #1c1c1c;
  59. border-right-color: #525252;
  60. border-bottom-color: #525252;
  61. }
  62. .blue {
  63. background: #a0c5ef;
  64. background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#508BC7), to(#203F75));
  65. background: -moz-linear-gradient(19% 75% 90deg,#203F75, #508BC7);
  66. color: #f0f0f0;
  67. border-top-color: #023778;
  68. border-left-color: #023778;
  69. border-right-color: #26609e;
  70. border-bottom-color: #26609e;
  71. }
  72.  
  73. .large {
  74. width: 200px;
  75. }
  76. .medium {
  77. width: 120px;
  78. }
  79. .small {
  80. width: 80px;
  81. }
  82. </style>
  83.  
  84. <div class="shortcode_button ' . $size . ' ' . $color . '">' . $content . '</div>';
  85.  
  86. }
  87. add_shortcode('button', 'button_shortcode');
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. add_filter('the_content', 'do_shortcode');
  99.  
  100.  
  101. [box color=blue]Porta ultricies. Amet odio amet, pellentesque elementum adipiscing sagittis enim, eu, proin placerat sed pid cum? Dictumst turpis integer. Adipiscing, porttitor scelerisque! Lorem turpis porttitor.
  102.  
  103. Integer in, odio mattis ac! Nascetur augue odio in risus, arcu nunc, phasellus ultrices lectus velit, et tincidunt tristique. Integer vel pulvinar purus magnis.
  104.  
  105. [button color=black size=small]<a href="#">Download[/button][/box]

Report this snippet  

You need to login to post a comment.