Custom Post Types – WP CPT template not found if another CPT is active / public = true

I have 2 custom post types in my WordPress theme and have never had any problems when both are set to.

'public' => 'true'

However, on that occasion, I cleared the cache and still did not succeed if I set one to true and the other refused to load the template and I got a 404 error.

I looked through the code and see no errors.

add_action("init", "custom_post_type_menu_wp_admin");
function custom_post_type_menu_wp_admin() {

register_post_type('developments', 
    array(
        'label' => __('Developments','templatic'),
        'labels' => array(  
            'name' => __('Developments','templatic'),
            'singular_name' => __('Developments','templatic'),
            'add_new' => __('Add Developments','templatic'),
            'add_new_item'=> __('Add New Developments','templatic'),
            'edit' => __('Edit','templatic'),
            'edit_item'=> __('Edit Developments','templatic'),
            'new_item' => __('New Developments','templatic'),
            'view_item' => __('View Developments','templatic'),
            'search_items' => __('Search Developments','templatic'),
            'not_found' => __('No Developments','templatic'),
            'not_found_in_trash'=> __('No Developments found in trash','templatic')   
        ),
        'public'            => true,
        'can_export'        => true,
        'show_ui'           => true,
        '_builtin'          => false,
        '_edit_link'        => 'post.php?post=%d',
        'capability_type'   => 'post',
        'menu_icon'         => 'dashicons-hammer',
        'hierarchical'      => false,
        'rewrite'           => array(
                                        "slug" => "developments",
                                        "with_front" => false
                                    ),
        'query_var'         => "true",
        'supports'          => array(   
                                        'title'
                                    ),
        'show_in_nav_menus' => true
    )
); 

register_post_type('house_types', 
    array(
            'label' => __('House Types','templatic'),
            'labels' => array(  'name' => __('House Types','templatic'),
            'singular_name' => __(
            'House Types','templatic'),
            'add_new' => __('Add House Types','templatic'),
            'add_new_item'=> __('Add New House Types','templatic'),
            'edit' => __('Edit','templatic'),
            'edit_item'=> __('Edit House Types','templatic'),
            'new_item' => __('New House Types','templatic'),
            'view_item' => __('View House Types','templatic'),
            'search_items' => __('Search House Types','templatic'),
            'not_found' => __('No House Types','templatic'),
            'not_found_in_trash'=> __('No House Types found in trash','templatic')   
        ),
        'public'            => true,
        'can_export'        => true,
        'show_ui'           => true, // UI in admin panel
        '_builtin'          => false, // It's a custom post type, not built in
        '_edit_link'        => 'post.php?post=%d',
        'capability_type'   => 'post',
        'menu_icon'         => 'dashicons-admin-multisite',
        'hierarchical'      => false, // Sets parent, child effect. Needs 'page-attributes' setting up
        'rewrite'           => array(
                                        "slug" => "house-types",
                                        "with_front" => false
                                    ), // Permalinks
        'query_var'         => "true", // This goes to the WP_Query schema
        'supports'          => array(   
                                        'title'
                                    ) ,
        'show_in_nav_menus' => true 
    )
); 
}

Can anyone recognize what went wrong on this occasion?

Thank you in advance!

Functions – Horizontal divider Between each post … Please edit my code

As below picture …..
Enter image description here

Here is my code

& # 39; # 39 ;, & block1_widget
& # 39; description & # 39; => esc_html __ ("Block Posts Widget, Best for Home Content Top & Home Content Bottom Sidebar.", & # 39; glob & # 39;)
);
parent :: __ construct (& # 39; glob_block_1_widget & # 39 ;, esc_html __ (& # 39; FT Block 1 & # 39 ;, glob & # 39; $ widget_ops);
$ this-> alt_option_name = & # 39; widget_block1 & # 39 ;;
}
/ **
* @param array $ args
* @param array $ instance
* /
public function widget ($ args, $ instance) {
// Get values ​​from widget settings.
$ title = apply_filters (& # 39; widget_title & # 39 ;, empty ($ instance (& 39; title & # 39;))? & # 39 ;: $ instance (& # 39; title & # 39; ), $ instance, $ this-> id_base);
$ block_category = (! empty ($ instance (& # 39; block_category & # 39;)))? $ instance (& # 39; block_category & # 39;): & # 39; & # 39 ;;
$ ignore_sticky = isset ($ instance (& ignore_sticky & # 39;))? $ instance (# ignore_sticky): 1;
$ orderby = (! empty ($ instance (& # 39; orderby & # 39;)))? $ instance ("orderby"): & # 39; date & # 39 ;;
$ order = (! empty ($ instance (& 39; order & # 39;)))? $ instance (& 39;): & # 39; DESC & # 39 ;;
$ number_posts = (! empty ($ instance (& # 39; number_posts & # 39;)))? Absint ($ instance (#number_posts)): 7;
if (! $ number_posts) {
$ number_posts = 7;
}
$ custom_query_args = array (
& # 39; # 39 & post_type; => & # 39; post & # 39 ;,
& # 39; # 39 & posts_per_page; => $ number_posts,
& # 39; # 39 & post_status; => & # 39; publish & # 39 ;,
& # 39; # 39 & ignore_sticky_posts; => $ ignore_sticky,
& # 39; # 39 & category__in; => $ block_category,
& # 39; order & # 39; => $ order,
& # 39; # 39 & orderby; => $ orderby,
);
$ custom_query = new WP_Query (apply_filters (& # 39; widget_block_1_posts_args & # 39 ;, $ custom_query_args));
if ($ custom_query-> have_posts ()) {
$ n = count ($ custom_query-> posts);
$ count = 0;
echo $ args (& # 39; before_widget & # 39;);
$ widget_title = glob_setup_widget_cat_title ($ block_category, $ title);
if ($ widget_title) {
?>

& # 39 ;. $ widget_title (& # 39; title & # 39;). & # 39; & # 39 ;;
} else {
?>
">

have_posts ()) {
$ custom_query-> the_post ();
$ count ++;
if ($ count == 1) {
?>

>

"title =" ">

& # 39;, & # 39; & # 39); ?>

>

"title =" ">

& # 39;, & # 39; & # 39); ?>

& # 39; & # 39 ;,
& # 39; # 39 & block_category; => & # 39 ;,
& # 39; # 39 & ignore_sticky; => 1,
& # 39; # 39 & number_posts; => 7,
& # 39; order & # 39; => & # 39; DESC & # 39 ;,
& # 39; # 39 & orderby; => & # 39; date & # 39;
));
$ instance (title title)) = sanitize_text_field ($ new_instance (& title #));
$ instance (# ignore_sticky) = isset ($ new_instance (# ignore_sticky #)) && $ new_instance (# ignore_sticky #)? 1: 0;
$ instance (& # 39; block_category & # 39;) = isset ($ new_instance (& # 39; block_category & # 39;))? absint ($ new_instance (& # 39; block_category & # 39;)): & # 39; & # 39 ;;
$ instance (& # 39; number_posts & # 39;) = absint ($ new_instance (& # 39; number_posts & # 39;));
$ instance (orderorder #) = sanitize_text_field ($ new_instance (orderorder #));
$ instance (order orderby #) = sanitize_text_field ($ new_instance (orderorderby #));
return $ instance;
}
/ **
* @param array $ instance
* /
Form of public function ($ instance) {
// set the default value.
$ defaults = array (
& # 39; title & # 39; => & # 39 ;,
& # 39; # 39 & block_category; => & # 39 ;,
& # 39; # 39 & ignore_sticky; => 1,
& # 39; # 39 & number_posts; => 7,
& # 39; order & # 39; => & # 39; DESC & # 39 ;,
& # 39; # 39 & orderby; => & # 39; date & # 39;
);
$ instance = wp_parse_args ((array) $ instance, $ defaults);
$ block_category = $ instance (& # 39; block_category & # 39;);
$ list_categories = get_categories ();
$ order = array (& # 39; ASC & # 39 ;, & # 39; DESC & # 39;);
$ orderby = array (& # 39; date & # 39 ;, & # 39; comment_count & # 39 ;, & 39; rand & # 39;);
?>

get_field_id (& # 39; title & # 39;); ?> ">
get_field_id (& # 39; title & # 39;); ?> "name =" get_field_name (& # 39; title & # 39;); ?> "value =" “/>

get_field_id (& # 39; block_category & # 39;); ?> ">
get_field_name ('block_category');?> 'id =' get_field_id ('block_category');?> ">
>

term_id); ?> "term_id); >> name." (". $ category-> count.") ";?>

get_field_id (#number_posts); ?> ">
get_field_id (#number_posts); ?> "name =" get_field_name (# number_posts); ?> "value =" “/>

get_field_id (# ignore_sticky #); ?> "name =" get_field_name (# ignore_sticky #); ?> "type =" checkbox "value =" 1 “/>
get_field_id (# ignore_sticky #); ?> ">

get_field_id (& # 39; order & # 39;); ?> ">
get_field_name (? order?);?> id = "get_field_id (? order?);?>">

">

get_field_id (order orderby #); ?> ">
get_field_name (order orderby #);?> "id =" get_field_id (order orderby #);?> ">

">

Shortcode, vs Blocks, vs Templates – What would you do to select or create custom post data in Notepad?

Let's say you have a custom post type. Call my_type,

Say in Gutenberg now, you want too

one. Insert some data into my_type Contribution from an existing instance of another_type where the inserted block has template / styling

or

b. Insert some data into my_type that creates the habit another_type Post instance.

What is the most meaningful method? You can imagine doing this with a forum posting. In Gutenberg, you want to insert a reusable style block that displays specific forum topics. Or you may want to insert a block that creates the forum topic in the first place.

As it is now, I am creating the forum topic and then using a shortcode with the topic ID. But I wonder if there is a better way.

Thank you so much!
Brian

Hooks – Change the "Post Posted Post Review" administrator notification after the wp_insert_post_data filter has been run

I run validation logic when a user has submitted a post wp_insert_post_data Filter.

When a user posts a post, the filter that invokes the check logic is executed. If this fails, the status is enforced draft,

add_filter(
    'wp_insert_post_data',
    function( $data, $postarr ) {
        /**
         * Only for Company Post type.
         */
        if (
            ! isset( $postarr('post_type') )
            || 'company' !== $postarr('post_type')
        ) {
            return $data;
        }
        /**
         * Only if post_id is defined.
         */
        if ( ! isset( $postarr('ID') ) ) {
            return $data;
        }
        /**
         * Only if they wanted to publish.
         */
        if (
            ! isset( $postarr('post_status') )
            || 'publish' !== $postarr('post_status')
        ) {
            return $data;
        }

        /**
         * TODO: Run the verification here.
         */
        if ( false === is_valid($postarr('ID')) ) {
            $data('post_status')                   = 'draft'; // the post was forced to be drafted here.
            $GLOBALS('_POST_FORCED_TO_BE_DRAFTED') = true;
            log_and_debug( $data('post_status'), 'FORCED TO SET TO DRAFT' );
        }
        return $data;
    },
    PHP_INT_MAX,
    2
);

It works great The post office will be forced to draft, With the exception that the message is still displayed:

Enter image description here

So the solution I've tried is: as you can see above, once the filter forced the post to a "draft" I would put a global variable:

$GLOBALS('_POST_FORCED_TO_BE_DRAFTED') = true;

and then in post_updated_messages Filter, if this global variable exists, I would empty the message array:

add_filter(
    'post_updated_messages',
    function( $messages ) {
        if (
            isset( $GLOBALS('_post_was_forced_to_be_drafted') )
            && true === $GLOBALS('_post_was_forced_to_be_drafted')
        ) {
            /**
             * Empty the messages.
             */
            return ();
        }
        return $messages;
    }
);

I've done a debug and I can see that wp_insert_post_data Filter runs first post_updated_messagesso the global variable should be set by then, but apparently not yet.

Does anyone know a better way to achieve this?

Is there an action I can do? remove_action() When did my function force a mail to be "drafted"?

Hope someone can help.

Greetings,

PHP – How do I view a WordPress post that has been published in the last 5/10/20/30/60 minutes and 1/5/12/24 hours?

I want the page to display a list of messages published in a specific time period.

Please have a look at an example: –

Enter image description here

Here is my code I use:

                         'post',
                            'post_status' => 'publish',
                            'posts_per_page' => -1,
                            'date_query' => array(
                                 array(
                                   'after'  => '5 minutes ago',
                                    'inclusive' => true,
                                   )
                             ),
                        )); 
                        if ( $the_query->have_posts() ) :?>
                        
News in the last 5 minutes

But this code can not reach my sample output.

can someone help me for this example output result?

Thank you in advance.

I will post your article on http://www. becomebeautiful high da 74 fashion blog for $ 4

I will publish your article on becomegorgeous high da 74 fashion blog

Special Note: I will add 1 Shutterstock HD quality pictures to You Becomegorgeous Post

Guest contributions are one of the best ways to achieve the best search engine rankings. Now I offer a guest subscription service for those who need high-performance, niche-related, permanent DO-Follow backlinks from High DA, PA, DR and UR.

Fashion, beauty, beauty tips, lifestyle, hairstyles, nails, make-up, health, weight loss, fitness and everything that has to do with fashion.

  • How to benefit from Guest Posting
  • Create the search engine and domain name authority
  • Increase your online influence with niche links
  • 100% Google Panda & Penguin Safe White Hat SEO
  • 100% natural & manual publishing.
  • Quality Follow permanent links
  • Fast indexing and positioning in SERP.

If you run a fashion website, blog, or online business, we can assist you by promoting your product or service through guest contributions.

At least 500 words of a well written, 100% unique and informative article (NOT for promotional purposes).

1 Track backlinks with your desired keywords

  • Domain Authority – 74/100
  • Page Authority – 60/100
  • DR 7
  • UR 18
  • permanent employment
  • DOFOLLOW INDEXED

(tagsToTranslate) becomego (t) fashion (t) post (t) guest (t) seo

Javascript – How do I create a POST request with angular.js?

var app = angular.module("app",());
app.controller('controlador',('$scope', '$http',function($scope,$http){

  $scope.login.username="";
  $scope.login.password="";
  $scope.login.tipo="";
  var login= this;


/****************PETICION GET************************/
	$scope.makeCall= function ($http) {
  url: 'https://prueba-admision-web.herokuapp.com/session';
 
  $http.post(url, {
    "username": "test",
    "password": "test123",
    "type": "V"
}).done(function(data, status, headers, config) {
    console.log("Se llamo a esta funcion");
      $scope.seguro=data;
  }).error(function(data, status, headers, config) {
      alert("Ha fallado la petición. Estado HTTP:"+status);
  });


}) );

I'll post 2000 blog comments for $ 50

I will make 2000 blog comments behind the backlinks

I will make 2000 blog comments. Trace backlinks manually. Create 2000 do-follow blog comments. High quality backlinks. FASTEST GOOGLE RANKING BOOM GUARANTEED!

When Google bots crawl a site, they search for external links that point to other sites. If this link is "Do-Follow", search engines will follow the link and the link juice will be redirected.

We offer permanent, contextual Do-Follow DA20 + to 90+ backlinks with the anchor of your choice. This is a unique service that can be used on any site to provide a very powerful, clean link!

We will do White HAT SEO so you can enjoy a good lifetime.

Service Features:

100% handmade

Mix naturally (high PA DA TF CF)

All links are do-follow

Accept any website language

We use human readable spin articles in English

100% customer satisfaction

24/7 customer service

★ Guaranteed sure ★

★ Order now and see results ★

, (tagsToTranslate) Blog (t) Comments (t) Backlink (t) Dofolov

How do I post the same content on multisite?

I try to achieve the following. Any help / advice is greatly appreciated.
1) I have several websites in a subdirectory that use WP names with multiple sites (for example, https://noorshaad.com/uae/, https://noorshaad.com/us/, https: / /noorshaad.com/uk/).
2) I have to post each domain to display the same content and images (recommended image), BUT
3) Show another WordPress theme, plugins & plugin configuration. etc