This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get user IP in WordPress | |
| function get_the_user_ip() { | |
| if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { | |
| //check ip from share internet | |
| $ip = $_SERVER['HTTP_CLIENT_IP']; | |
| } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { | |
| //to check ip is pass from proxy | |
| $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
| } else { | |
| $ip = $_SERVER['REMOTE_ADDR']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $args = array( | |
| //Sayfa ve Yazı parametreleri | |
| 'p' => 1, | |
| 'name' => 'hello-world', | |
| 'page_id' => 1, | |
| 'pagename' => 'sample-page', | |
| 'post_parent' => 1, | |
| 'post__in' => array(1,2,3), | |
| 'post__not_in' => array(1,2,3), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Sorgu | |
| $the_query = new WP_Query( $args ); | |
| // Loop Döngüsü | |
| if ( $the_query->have_posts() ) { | |
| echo '<ul>'; | |
| while ( $the_query->have_posts() ) { | |
| $the_query->the_post(); | |
| echo '<li>' . get_the_title() . '</li>'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function phpcode($atts, $content = "") { | |
| return '<pre class="php">'.esc_attr($content).'</pre>'; | |
| } | |
| function csscode($atts, $content = "") { | |
| return '<pre class="css">'.$content.'</pre>'; | |
| } | |
| function htmlcode($atts, $content = "") { | |
| return '<pre class="html">'.esc_html($content).'</pre>'; | |
| } | |
| function init_common_shortcodes() { |
NewerOlder