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
| <?php comments_template();?> -> ia fisierul comments.php | |
| <?php comments_template('/comments-new.php');?> -> ia fisierul comments-new.php | |
| !!! trebuie neaparat pun '/' inaintea numelui | |
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
| For posts: <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?> | |
| For comments:<?php echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ago'; ?> |
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
| $the_query = new WP_Query( | |
| array( | |
| 'post_type' => 'page', | |
| 'meta_key' => '_wp_page_template', | |
| 'meta_value' => 'page-attorney.php' //aici e pagina templateului | |
| ) | |
| ); | |
| if ( $the_query->have_posts() ) { | |
| while ( $the_query->have_posts() ) { |
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
| In functions.php: | |
| function cwp_set_post_views($postID) { | |
| $count_key = 'cwp_post_views_count'; | |
| $count = get_post_meta($postID, $count_key, true); | |
| if($count==''){ | |
| $count = 0; | |
| delete_post_meta($postID, $count_key); | |
| add_post_meta($postID, $count_key, '0'); | |
| }else{ |
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
| wp_register_style( 'cwp_new-style', get_template_directory_uri() . '/css/new-style.css'); | |
| wp_enqueue_style( 'cwp_new-style' ); |
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
| In fucntions.php: | |
| function cwp_get_menu_by_location( $location ) { | |
| if( empty($location) ) return false; | |
| $locations = get_nav_menu_locations(); | |
| if( ! isset( $locations[$location] ) ) return false; | |
| $menu_obj = get_term( $locations[$location], 'nav_menu' ); | |
| return $menu_obj; |
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
| In functions.php: | |
| add_filter( 'wp_nav_menu_objects', 'submenu_limit', 10, 2 ); | |
| function submenu_limit( $items, $args ) { | |
| if ( empty($args->submenu) ) | |
| return $items; | |
| $parent_id = array_pop( wp_filter_object_list( $items, array( 'title' => $args->submenu ), 'and', 'ID' ) ); | |
| $children = submenu_get_children_ids( $parent_id, $items ); |
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
| <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') ); ?> | |
| <img src="<?php echo $url ?>" /> |
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
| <?php | |
| global $post; // if outside the loop | |
| if ( is_page() && $post->post_parent ) { | |
| // This is a subpage | |
| $mypages = get_pages( array( 'child_of' => $post->post_parent, 'sort_column' => 'post_date', 'sort_order' => 'asc', 'hierarchical' => '0', 'parent' => $post->post_parent ) ); | |
| echo '<ul id="nav">'; | |
| foreach( $mypages as $page ) { |
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
| !!!!!!!!! | |
| Daca vreau sa adaug un id sau o clasa pt form: [contact-form-7 id="1234" title="Contact form 1" html_id="contact-form-1234" html_class="form contact-form"] | |
| Install Contact Form 7 plugin | |
| Install Really Simple CAPTCHA Plugin |