Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add the Meta Box --->> Create a Meta Box
- function add_custom_meta_box() {
- add_meta_box(
- 'custom_meta_box', // $id
- 'Custom Meta Box', // $title
- 'show_custom_meta_box', // $callback
- 'post', // $page
- 'normal', // $context
- 'high'); // $priority
- }
- add_action('add_meta_boxes', 'add_custom_meta_box');
- // Field Array -->> Create the Field Array
- $prefix = 'banksoal_';
- $custom_meta_fields = array(
- array(
- 'label'=> 'Download',
- 'desc' => 'A description for the field.',
- 'id' => $prefix.'download',
- 'type' => 'text'
- ),
- array(
- 'label'=> 'Kunci',
- 'desc' => 'A description for the field.',
- 'id' => $prefix.'kunci',
- 'type' => 'textarea'
- ),
- );
- // The Callback -->> Outputting the Fields
- function show_custom_meta_box() {
- global $custom_meta_fields, $post;
- // Use nonce for verification
- echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';
- // Begin the field table and loop
- echo '<table class="form-table">';
- foreach ($custom_meta_fields as $field) {
- // get value of this field if it exists for this post
- $meta = get_post_meta($post->ID, $field['id'], true);
- // begin a table row with
- echo '<tr>
- <th><label for="'.$field['id'].'">'.$field['label'].'</label></th>
- <td>';
- switch($field['type']) {
- // TEXT
- case 'text':
- echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
- <br /><span class="description">'.$field['desc'].'</span>';
- break;
- // TEXT AREA
- case 'textarea':
- echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
- <br /><span class="description">'.$field['desc'].'</span>';
- break;
- } //end switch
- echo '</td></tr>';
- } // end foreach
- echo '</table>'; // end table
- }
- // SAVE THE DATA
- function save_custom_meta($post_id) {
- global $custom_meta_fields;
- // verify nonce
- if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))
- return $post_id;
- // check autosave
- if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
- return $post_id;
- // check permissions
- if ('page' == $_POST['post_type']) {
- if (!current_user_can('edit_page', $post_id))
- return $post_id;
- } elseif (!current_user_can('edit_post', $post_id)) {
- return $post_id;
- }
- // loop through fields and save the data
- foreach ($custom_meta_fields as $field) {
- $old = get_post_meta($post_id, $field['id'], true);
- $new = $_POST[$field['id']];
- if ($new && $new != $old) {
- update_post_meta($post_id, $field['id'], $new);
- } elseif ('' == $new && $old) {
- delete_post_meta($post_id, $field['id'], $old);
- }
- } // end foreach
- }
- add_action('save_post', 'save_custom_meta');
- ====================================
- MENAMPILKANNYA
- ====================================
- <div style="text-align: center !important;">
- <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
- <!-- responsiv-bawah -->
- <ins class="adsbygoogle"
- style="display:block"
- data-ad-client="ca-pub-1162866178338695"
- data-ad-slot="6086448713"
- data-ad-format="auto"></ins>
- <script>
- (adsbygoogle = window.adsbygoogle || []).push({});
- </script>
- <div id="spoiler" style="display:none">
- <?php
- $my_download = get_post_meta( get_the_ID(), 'banksoal_download', true);
- if( ! empty( $my_download ) ) {
- echo '<a href="' . $my_download . '" target="_blank"><b>DOWNLOAD FILE BANK SOAL INI</b></a>';
- }
- ?>
- <?php
- $my_kunci = get_post_meta( get_the_ID(), 'banksoal_kunci', true);
- if( ! empty( $my_kunci ) ) {
- echo '' . $my_kunci . '';
- }
- ?>
- </div>
- <button title="Click to Show/Hide Content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">Show/Hide Kunci Jawaban</button>
- <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
- <!-- responsiv-bawah -->
- <ins class="adsbygoogle"
- style="display:block"
- data-ad-client="ca-pub-1162866178338695"
- data-ad-slot="6086448713"
- data-ad-format="auto"></ins>
- <script>
- (adsbygoogle = window.adsbygoogle || []).push({});
- </script>
- </div>
- ==================================
- PLUGIN MATEMATIKA
- =======================================
- WPMathPub: http://wordpress.org/plugins/wpmathpub/
- Name: wpmathpub
- Panduan: http://www.xm1math.net/phpmathpublisher/doc/help.html (sdh mati)
- File demo download: https://github.com/daanforever/phpmathpublisher
- Contoh-contoh penulisan:
- [pmath size=14]int{0}{2} {(x^2 } + sin x)dx = 4.08[/pmath]
- [pmath size=14]delim{[}{matrix{3}{3}{5 3 0 6 7 0 1 2 8}}{]} [/pmath]
- [pmath size=14]delim{[}{matrix{3}{3}{5 3 (cos 2) 6 7 0 1 -2 (sin 5)}}{]} [/pmath]
- [pmath size=14]int{0}{pi /2}{(x^2 } + sin x)dx = 2.29[/pmath]
- [pmath size=14]delim{[}{matrix{3}{3}{5 3 {cos 2} 6 7 0 1 {-2} {sin 5}}}{]} [/pmath]
- [pmath size=12]S(f)(t)=a_{0}+sum{n=1}{+infty}{a_{n} cos(n omega t)+b_{n} sin(n omega t)}[/pmath]
- [pmath size=24]delim{lbrace}{matrix{3}{1}{{3x-5y+z=0} {sqrt{2}x-7y+8z=0} {x-8y+9z=0}}}{ }[/pmath]
- [pmath]delim{|}{{1/N} sum{n=1}{N}{gamma(u_n)} - 1/{2 pi} int{0}{2 pi}{gamma(t) dt}}{|} <= epsilon/3[/pmath]
Add Comment
Please, Sign In to add comment