Need to Echo A Url path to show on a wordpress page

You can find that with somthing like the following add_shortcode( ‘url_path_number’, function ( $atts ) { // use an attribute or the current URL $a = shortcode_atts( array( ‘url’ => get_permalink(), ), $atts ); // get the path from the URL $path = parse_url($a[‘url’],PHP_URL_PATH); $parts = array_filter(explode(“https://wordpress.stackexchange.com/”, $path),function($v) { return $v !== ”; }); // … Read more

Get the image title and alt from custom query

At the top of your code, just after $large_image, you can add this : $image_alt = get_post_meta((int)get_post_meta( get_the_ID() , “_thumbnail_id” , true ), ‘_wp_attachment_image_alt’, true); $image_title = get_the_title((int)get_post_meta( get_the_ID() , “_thumbnail_id” , true )); The alt for attachment is stock in post_meta (_wp_attachment_image_alt), the title is a post_title. And then your replace the value in … Read more

Getting data from serilized array

Use this: $next_in_line = get_post_meta(esc_attr($product->get_id()), ‘_next_in_line’, true); print_r($next_in_line[‘user_id’]); print_r($next_in_line[‘product_id’]); Let me know if works.

Creating Admin Submenu Page via Class Method

the action admin_menu is called with one empty argument, then anonymous function can only be with 0 or 1 useless argument. and then if you want to pass variables to this function, you can try that : public function add_submenu_page( $title, $capability = ‘administrator’ ) { $post_type = self::uglify( $this->post_type_name ); $GLOBALS[“MyPlugin_menu”] = [ “post_type” … Read more