Display the queried publications in a custom publication type and taxonomy loop model

I have two types of personalized messages (& # 39; services & # 39; and & # 39; case_studies & # 39;) one of which (services) is a taxonomy for the other (case_studies) . My goal is to display a list at the bottom of & # 39; single-services.php & # 39; to display / get all messages (case_studies) on which & # 39; this service & # 39; was tagged.

Here's what I've gotten so far:

    'case_studies', 'posts_per_page' => 1, 'orderby' => 'rand', 'tax_query' => array( array( 'taxonomy' => 'services', 'field' => 'id', 'terms' => $qobj->term_id, // 'field' => 'slug', // 'terms' => $qobj->name ) ) ); $random_query = new WP_Query( $args ); // var_dump($random_query); // debugging only if ($random_query->have_posts()) { while ($random_query->have_posts()) { $random_query->the_post(); ?>

SQL query: update the meta key for the selected publication IDs

I am trying to update the meta_value for the selected post_ids .. need help

javascript – The submission of the publication form does not work properly

More specifically, my form (which is not automatically validated) does nothing when I try to submit it, I just want to insert data from a form into a database.

Here is my HTML:


Name
Email

Message

and here is my javascript / jQuery:

$("#contact-form").on("submit", function(event){"use strict";
 console.dir(event);
    event.preventDefault();

    var serialData = $("#contact-form").serialize();

     console.log(serialData);

//validate fields
    if(!$("#name")(0).validity.valid){$("#one").addClass("fa-remove text-danger");
    $("#one").removeClass("fa-check text-success");
        return false;}
    else{
$("#one").addClass("fa-check text-success");
$("#one").removeClass("fa-remove text-danger");
    }

    if(!$("#email")(0).validity.valid){$("#two").addClass("fa-remove text-danger");
    $("#two").removeClass("fa-check text-success");
        return false;}
    else{
$("#two").addClass("fa-check text-success");
$("#two").removeClass("fa-remove text-danger");
    }

    if(!$("#msg")(0).validity.valid){$("#three").addClass("fa-remove text-danger");
    $("#three").removeClass("fa-check text-success");
        return false;}
    else{
$("#three").addClass("fa-check text-success");
$("#three").removeClass("fa-remove text-danger");
    }



    $.post( "php/form-control.php", serialData).done(function( data ){
        console.log("post");
        var result;
        try{

            result = JSON.parse(data);
             console.dir(result);

            if(result.success === "yes"){

                $("#status").html(result.comment);
                $("#status").addClass("text-success");
                $("#status").removeClass("text-danger");
            }else{
                $("#status").html(result.comment);
                $("#status").removeClass("text-success");
                $("#status").addClass("text-danger");

            }
        }catch(error){console.log("catch"); alert(error.message);
                            if(result)
                                {
                                $("#status").html(result.comment);
                                //alert(error.message);
                                }
                            else
                                {
                                $("#status").html(data);
                                }
        }
    });
});

Although I think the problem is related to javascript (as the php file never returns JSON data to start with), I will include the php used to manage the form just to be sure:

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $pre = $conn->prepare("INSERT INTO redzoneb_cli (id, name, email, message, submitted) VALUES (NULL, :name, :email, :message, CURRENT_TIMESTAMP);");

        $pre->bindValue(":name", $name);
      $pre->bindValue(":email", $email);
    $pre->bindValue(":message", $msg);
       $pre->execute();

              $response = ("success"=>"yes", "comment"=>"Thank you, I will get back to you as soon as possible via the email you  provided.");
       $conn = null;
       exit();} catch(PDOException $e){
    // if no connection can be made to the database display this message.

     //$response = ("success"=>"no","comment"=>"Currently the system is down. Please try again later.");
      $response = ("success"=>"no", "comment"=>$e->getMessage());
   exit();
}

echo json_encode($response);
?>

I already used a similar code and it worked, that's why I don't understand what I'm missing here, does anyone have any suggestions on how to reach the root of this problem?

Thanks in advance.

How to generate an automatic shortcode for a custom publication type identical to the Elementor model?

I want to generate an automatic shortcode for the custom publication type. It is the same as the elementor model shortcode.

I have a custom publication type named clients and there are many clients. The unique customer publication type is generated with a custom template. Now what I want is to generate an automatic shortcode for each article. As for client1: [clients name="1"] for client2: [client name="2"]. If I create a new customer, the shortcode will be generated automatically and will be displayed in a field in the list.

I am stuck and have no idea. Please help.

Thank you

rearrange messages by publication date in the menu message selection

I need to rearrange the messages by ordering them from the date of publication instead of alphabetical order in the message selection panel of the menu, see the whole section.

enter description of image here

I want them to order the same in the most recent articles in the Show All section.

Is it possible to achieve this via a hook or any other code?

plugins – WordPress Custom publication status not public but visible via the link: Publications published privately

I worked on my site to post private messages on my site. I have created a custom publication status for this purpose.

My goal is to exclude messages belonging to this status from search, blog page, WordPress requests, RSS feed, etc. In principle, it should not be mentioned anywhere on the site.

So far it sounds simple, but the problem is that I WANT people to be able to see the message via a direct link.

Basically, I want it not to be mentioned throughout my site, but if someone visits it from a direct link, they can see it.

function custom_post_status(){ 
register_post_status( 'privatised', array( 'label' => _x( 'Privately Published', array('post', 'download')),
'public' => false,
 'exclude_from_search' => true,
'show_in_admin_all_list' => true, 
'show_in_admin_status_list' => true, 
'label_count' => _n_noop( 'Privately Published (%s)', 'Aggregated (%s)' ),
 ) ); 
} 
add_action( 'init', 'custom_post_status' );

Here, if you see in the table, the first option is public, and I set it to false, which basically guarantees that my post is not there on my blog page, or research, or taxonomy page, or RSS FEED etc. Etc. But if I open the same message via its direct URL, it gives a 404, because not found …

Please help me, my message is only visible by the direct link of it.

As a sidenote, is it possible that I can make it public, then exclude it from taxonomy and everything, as I can do with exclude from research …

8 – Update of entities / publication of data via ajax?

J & # 39; have a handful of & # 39; entities that need to be updated on the & # 39; user interaction, such as:

  1. Track user progress via video, so a listener checks the playhead position every x seconds and publishes information about an entity containing data about that user's progress on this video.

  2. Set of check boxes which, when clicked, automatically update the state of a corresponding value on an associated entity. For the sake of argument, I am not sure yet whether this will be the actual form of the entity or a generic form / set of forms.

In the past, I tried # 1 by having a hidden, ajax compatible form whose field values ​​were updated every x seconds and the submit button clicked automatically, but this caused ajax errors assorted for some iOS users who were difficult / impossible to debug. Ideally I think I would avoid having a form there. I know how to configure the js to track data, but I do not know how to pass on to Drupal from the front end. I guess I want to do something like this (via http://hayageek.com/jquery-ajax-post/), but I'm not sure exactly how to determine the AJAX_POST_URL or how the data should be formatted.

$.ajax({
    url : "AJAX_POST_URL",
    type: "POST",
    data : formData,
    success: function(data, textStatus, jqXHR)
    {
        //data - response from server
    },
    error: function (jqXHR, textStatus, errorThrown)
    {

    }
});

For # 2, I guess it might be enough to just have a form that automatically submits via ajax when the box is checked, but given the various errors that I encountered above , I'm curious to know whether or not there is a better way to manage it.

Glad to update this problem if necessary if it is deemed too generic.

Publication template divided into two pages

I need to split my unique publishing model into two pages using pagination.
It is very simple in the message editor by

I want to know where to share the articles after their publication

Hello guys

Happy New Year!

I want to know where to share the link of your blog article or say an article, so a little traffic can be gotten on the article, especially when you are worried about having poor networking skills.
SEMrush

Please also indicate if there is an area on DigitalPoint, where I can just publish my blog posts and not be banned like on Reddit, etc.

thanks and greetings
Raj Kumar

WordPress error The publication failed. Error message: the response is not a valid JSON response.

Does anyone experience it with wordpress? when you try to create a message, it failed and display that message. Please share how to solve it

The publication failed. Error message: the response is not a valid JSON response.

See attachment 247920