Changes in WordPress taking 48hrs to reflect [closed]

You have to check if your WordPress site is using a cache plugin (such as WP Super Cache) or a CDN like CloudFlare or Amazon CloudFront. In that case, you can manually clean the cache in order to see those changes. You can also force refresh without cache, that will make you be able to … Read more

Function to incorporate an option in each Page

It sounds like you need custom meta boxes. You could either create your own plugin to add them or use a plugin like Advanced Custom Fields. You would add two meta boxes to each post type where you want to be able to select these options, one to select the image, and another to set … Read more

How to store archived copies of a WordPress site

One option: revisions. If you save a large number of revisions for your pages, you can then browse through the revision history and “Preview” what a particular page looked like at a particular point in time. However, this requires whoever is viewing the past view to be logged in, since Previews are not public. Another … Read more

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