Child page in custom post throws 404 page not found

Currently I am trying to add a page as a child in my custom post section. The parent pages in my custom posts works correctly, I’ve set a template file for them as singe-custom_post_name.php. All good. Now I have added support to create child pages, I am able to create those pages in my custom post type section but when I navigate to the url a template couldn’t be found. What are the possible problems or solutions to this kind of problem? As far I don’t understand where this problem…

Double count view in archive.php

I’m having a hard time using this snippet I’m getting double views each time the post is queried. This is in my functions.php file: function getPostViews($postID){ $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count== »){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); return « 0 »; } return $count; } function setPostViews($postID) { $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count== »){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); }else{ $count++; update_post_meta($postID, $count_key, $count); } } // Remove issues with prefetching adding extra views remove_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0); Then I places setPostViews(get_the_ID());…

Variable Products Being Added to Cart with AJAX on Shop and Category Pages

By default, Woocommerce ajax add to cart functionality is only supposed to apply to simple products on archive, shop, category pages, etc.. But for some reason it is also adding variable products to the cart when I click « Select Options. » Select Options is supposed to go to the product page. How can I disable ajax add to cart on variable products? Source: https://wordpress.stackexchange.com/feeds

Web Design Weekly #219

Headlines The Web Is Okay Wise words from Charlotte Spencer about remaining calm why the world of web development goes crazy. (charlotteis.co.uk) Responsive Email Designer App Creating responsive emails is a huge plus for individuals and companies today. With more than 50% of emails initially being opened and read on smartphones and tablets, a solid responsive design is pretty much a necessity. Check it out today. (mightydeals.com) Articles Leaner Responsive Images With Client Hints In this article Jon Arne Sæterås looks into how Client Hints can reduce both image size…

Correct permalinks and 404-error

I have a paid plugin that creates a custom type categories and posts in this categories. I want to get URLs like site_name/category_name/post_name. This plugin forms links like this: List item for categories – site_name/category_name List item for posts – site_name/category_name I have installed plugin Custom Post Type Permalinks, configured it. When I click on post link, I have a 404 page of theme (not server). But URL is right. In the post edit page the permalink is right too. Pages shows correctly. I can’t change any file of paid…

Custom plugin: Trying to show saved data on frontend

I’m working on my first plugin and I have made a nice settings page which saves and works. But I have split it to few files and now I can’t determine if field is checked.. I have also tried declaring a global variable but I can’t get it to work : Plugin This is how my plugin starts: global $if_autoload; add_action(‘init’, ‘additional_menus_admin’); function additional_menus_admin() { require_once(dirname(__FILE__) . ‘/admin.php’); require_once(dirname(__FILE__) . ‘/hooks.php’); } hooks.php Here I try to see if the « autoload » checkbox is checked: add_action(‘wp_head’,’hook_additional_menu’, 20); function hook_additional_menu() { global…

Adding submenu to custom plugin menu page created with add_menu_page() function

I have created a custom menu page using add_menu_page() function. Everything in that page appears as it should in the screen. What I am trying to achieve is adding another submenu under the under the page i previously created(i want it to appear just like when you click on the settings menu in wordpress dashboard). I am pasting a code snippet below: //creating the menu item for the plugin function qpv_custom_menu_link() { add_menu_page( ‘Quick Product View Options’, ‘Quick Product View’, ‘manage_options’, ‘qpv-options’, ‘qpv_options_page’,  », ‘100’ ); add_submenu_page( ‘qpv-options’, ‘Quick Product…

Get Image Width From WP_Customize_Image_Control() File Set in WP Theme Customizer

Here’s the code we’re using to set an image file as an option for the site’s logo via WordPress’ theme customizer: /* Logo > Image ————————————————– */ $wp_customize->add_setting( ‘themeslug_logo’ ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘themeslug_logo’, array( ‘label’ => __( ‘Logo’, ‘themeslug’, ‘themeslug’ ), ‘section’ => ‘themeslug_header’, ‘settings’ => ‘themeslug_logo’, ‘description’ => ‘Upload a logo to replace the default site name in the header.’, ) ) ); Accordingly, we’re displaying the logo like this: <img src='<?php echo esc_url( get_theme_mod( ‘themeslug_logo’ ) ); ?>’ alt='<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) );…

Web Design Weekly #218

Headlines How are websites still screwing up these user experiences?! An appropriate rant by Troy Hunt that highlights all the current annoying techniques sites are utilising that should be abolished. (troyhunt.com) Web standards now and forever (zeldman.com) Sponsor Web Design Weekly and reach 24,845 designers and developers Articles Small lessons, loosely learned Jeremy Keith reminds us that there is nothing wrong with documenting each small thing we learn. It’s one of the best ways to make sure you understand it and to test our knowledge. (adactio.com) The future of bundling…

Embed image in post from external url

Is there a way in WordPress that I can embed an image to a post when I want to include it like this: <img src= »….. » /> So I want to add this manually. Is this possible? Now, I get the URL, without the image. So the embedding process isn’t done. PS: I am using a front-end editor. Source: https://wordpress.stackexchange.com/feeds