How can i hide content if not friend in Buddypress? [closed]
Returns true or false friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() )
Returns true or false friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() )
OK, it turns out that a simple function on the pre_get_posts filter does the trick. The issue was that custom post types aren’t included in the default query.
before start your posts loop in a custom page template you need to get posts from database by using wp_query() or get_posts() do some thing like this. $args = array( ‘posts_per_page’ => 3 ); $my_query = new WP_Query($args); // now start your loop if ( $my_query->have_posts() ) { while ( $my_query->have_posts() ) { $my_query->the_post(); // … Read more
Hook it in from your child themes functions file or add the template tag to a front-page.php file Untested add_action(‘loop_end’,’disqus_front_page_after_loop’); function disqus_front_page_after_loop() { if (is_front_page() && function_exists( ‘comments_template’ ) ) { comments_template(); } } Change the loop_end hook to another WordPress or theme specific hook. If using the template tag, you might want to try … Read more
This question as mentioned in the comments is not related to wordpress by any means. But anywho remove the float on your #portfolio-item and add some flex like its 2015. #contentportfolio { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap; } People still play sims?
According to WordPress template hierarchy, the page templates will fall back to page.php of the new (active) theme. You can read more about template hierarchy here:- https://developer.wordpress.org/themes/basics/template-hierarchy/
You made a mistake in the syntax: if ($featured_articles > have_posts()): while ($featured_articles > have_posts()) : $featured_articles->the_post(); in the if and while conditions should be -> instead >.
Ben, Welcome to StackExchange! Page Templates are only able to be defined in the Page post type (“Pages” in the WP-admin). https://developer.wordpress.org/themes/template-files-section/page-template-files/#uses-for-page-templates You can edit your theme (or create a child theme) to define how your post pages are displayed. Depending on your needs you could define an archive.php, category.php or index.php in your theme … Read more
You could hook into theme_{$post_type}_templates and add an identical “default” option at the end: add_action(‘theme_page_templates’, ‘wpse_296283_theme_page_templates’); function wpse_296283_theme_page_templates($post_templates){ $post_templates[‘default’] = “Default Template”; return $post_templates; } Then you’d hide the first one with CSS: add_action(‘admin_head’ ‘wpse_296283_admin_head’); function wpse_296283_admin_head(){ ?> <style>#page_template option:first-child {display: none;}</style> <?php }
Thanks to @kero I have implemented this code: <?php echo do_shortcode(‘[responsivevoice voice=”Italian Female” buttontext=”Ascolta”]’.'<br>’.$bodyContent.'[/responsivevoice]’); ?> The $bodyContent variable contains the HTML value of the article’s body, obtained using this function: http://www.web-templates.nu/2008/08/31/get_the_content-with-formatting/index.html <?php $bodyContent = get_the_content_with_formatting(); ?>