Check if the child page has sibling pages, and bookmark current page

Yes, it is possible: <?php global $post; $current_post = $post; if ( $post->post_parent ) { $siblings = new WP_Query( array( ‘post_type’ => ‘page’, ‘order’ => ‘ASC’, ‘post_parent’ => $post->post_parent ) ); } if ( $siblings->have_posts() ) : ?> <ul> <?php while ( $siblings->have_posts() ) : $siblings->the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/306078/<?php the_permalink(); ?>”> <?php if ( $current_post->ID … Read more

determine whether content is of type Page or a Post and display accordingly

The wordpress way solution is // put this in header.php var ajax_url =”<?php echo admin_url(‘admin-ajax.php’);?>” // in js file $(‘a:not([href^=”#”])[href]’).click(function(e) { e.preventDefault(); var $this = $(this); var lnk = $this.attr(‘href’); var jqxhr = $.post(ajax_url, {‘action’:’list_content’, url: lnk}); jqxhr.done(function(data) { if(data === ‘post’) { $.prettyPhoto.open(lnk + ‘?iframe=true&width=80%&height=80%’); } }); }); // functions.php add_action(‘wp_ajax_nopriv_list_content’, ‘list_content’); add_action(‘wp_ajax_list_content’, ‘list_content’); … Read more

Use same page-mypage.php template for several pages

To re-use the same template for different kinds of pages you can use the template_include filter. Example given from the docs: add_filter( ‘template_include’, ‘portfolio_page_template’, 99 ); function portfolio_page_template( $template ) { if ( is_page( ‘portfolio’ ) ) { $new_template = locate_template( array( ‘portfolio-page-template.php’ ) ); if ( !empty( $new_template ) ) { return $new_template; } … Read more

how can i remove page title on desktop view

Write the CSS into style.css file @media only screen and (min-width: 768px) { .single-product .title-desc { display: none; } } .single-product CSS will only work on single product details. It will not create any issue on other pages.

Show FormCraft form on page open [closed]

From the documentation, you have to use the shortcode: [fc id=’12’ type=”popup”][/fc] Next, something has to trigger the form, you can create a button for that and then click it from jQury, edit the link which would trigger this form, and put the href or hyperlink to: <a class=”triggerForm” href=”http://yoursite.com/form-view/12″>Link Trigger</a> jQuery trigger. $(document).ready(function () … Read more

Getting ACF Field in Page – From the Footer

I have the same issue, the acf get_field() function in footer returned null. Native WP function get_post_meta( get_the_ID(), ‘option_key’, true ) didn’t work to. But when I’ve noticed that get_the_ID() function in footer returned the wrong value because I forgot to reset query after custom WP_Query. So, reset custom WP_Query (wp_reset_query()) or hard code the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)