Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function inspired_record_more_types( $types ) {
- $types[] = 'portfolios';
- $types[] = 'applicants';
- return $types;
- }
- add_filter( 'bp_blogs_record_post_post_types', 'inspired_record_more_types', 1, 1);
- // This function should go in functions.php
- function mam_posts_where ($where) {
- global $mam_global_where;
- if ($mam_global_where) $where .= " $mam_global_where";
- return $where;
- }
- add_filter('posts_where','mam_posts_where');
- // Get user role
- function get_role($user_id)
- {
- if(is_int($user_id))
- {
- $user = new WP_User( $user_id );
- if ( !empty( $user->roles ) && is_array( $user->roles ) )
- {
- foreach ( $user->roles as $role )
- echo $role;
- }
- }
- else
- echo "Something else";
- }
- // Dynamically Populating the Post Author
- add_filter('gform_field_value_author_email', 'populate_post_author_email');
- function populate_post_author_email($value){
- global $post;
- $author_email = get_the_author_meta('email', $post->post_author);
- return $author_email;
- }
- // BuddyBlog
- add_filter('buddyblog_get_post_type','buddyblog_my_post_type');
- function buddyblog_my_post_type($post_type){
- return 'portfolio';// it can be say 'events' or 'movies' or anything, just make sure you have already registered the post type
- }
- add_filter('buddyblog_get_post_type','buddyblog_my_post_type');
- function buddyblog_my_post_type($post_type){
- return 'post';// it can be say 'events' or 'movies' or anything, just make sure you have already registered the post type
- }
- <?php
- function shorten_text($text, $length) {
- $shortened_text = substr($text, 0, $length);
- $shortened_text .= '…';
- return $shortened_text;
- }
- if (have_posts()) : while (have_posts()) : the_post();
- $title=the_title('','',FALSE);
- $shortened_title = shorten_text($title, 15);
- print $shortened_title;
- ?>
- <?php endwhile;?>
- <?php else : ?>
- <h2>Introuvable</h2>
- <p>Désolé, mais vous cherchez quelque chose qui n'est pas ici.</p>
- <?php endif; ?>
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement