Remove POST_TYPE from custom post type permalink

As @WebElaine commented on this question I tried the following code which worked for me. First, remove the slug from the permalink function na_remove_slug( $post_link, $post, $leavename ) { if ( ‘services’ != $post->post_type || ‘publish’ != $post->post_status ) { return $post_link; } $post_link = str_replace( “https://wordpress.stackexchange.com/” . $post->post_type . “https://wordpress.stackexchange.com/”, “https://wordpress.stackexchange.com/”, $post_link ); return … Read more

how would I include a js file with tags into wordpress?

First you should use the wp_enqueue_scripts to load your scripts. add_action( ‘wp_enqueue_scripts’ , ‘javascript_file-exmp’ ); Second, be sure to both register and then enqueue your script Register: wp_register_script( ‘links’, plugins_url( ‘test.js’, __FILE__ ), array( ‘jquery’ ), ‘1.0’, true ); 1.0 is the version, used mainly to avoid caching on when you update it. true controls … Read more

How to get all attachment image from post ?? WordPress

<?php /* * Template Name: Gallery Page */ $query_images_args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => – 1, ); $query_images = new WP_Query( $query_images_args ); ?> <?php get_header();?> <div class=”main”> <div class=”row”> <?php foreach ( $query_images->posts as $image ) {?> <div class=”col-md-3″> <img src=”<?php echo wp_get_attachment_url($image->ID); ?>” > <a … Read more