Getting Un Wanted Gallery Shortcode In The Page on Loop

All filters applied to the ‘the_content’ hook (including shortcode rendering) are not applied when you call get_the_content(). This is why you get raw shortcode from your content. You could use the_content() instead, or use apply_filters directly in your template. In other words, replace this line: echo ‘<p class=”p-paragraph” style=”text-align:left”>’. get_the_content().'</p>’; with either (preferred method): echo … Read more

get_post() containing gallery is outputting an unmatched closing div at the end of the content

If you look at the gallery shortcode function the opening div (to match that closer you’re missing) looks like this: $gallery_div = “<div id=’$selector’ class=”gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}”>”; then this filter is run $output = apply_filters( ‘gallery_style’, $gallery_style . $gallery_div ); More than likely there’s code somewhere in your theme or a plugin that’s messing … Read more

How to get the Gallery form/section just like in Gutenberg block?

wp.media is the JavaScript API WordPress uses to display the media library modal. You can use it yourself by enqueueing a custom JS script on your admin page: wp_enqueue_script(‘media-upload’); wp_enqueue_media(); wp_enqueue_script( ‘pb-admin-script’, ‘admin.js’, array( ‘jquery’, ) ); Then work with it like this: HTML: <button class=”upload_image_button button button-primary”> <?php _e(‘Upload Image’, ‘pb’); ?> </button> <img … Read more

How can i link a custom post type thumbnail to intermediate size

<a rel=”lightbox” href=”https://wordpress.stackexchange.com/questions/10191/<?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,”large’, true); echo $image_url[0]; ?>”> <?php the_post_thumbnail(‘thumbnail’); ?> </a> Yeah the above (posted by @null) is correct on getting the url, here it is all put together. Including the rel=lightbox. I call to WP’s large image size here personally for the lightbox image to be linked to. … Read more

Replacement for gallery_shortcode function not taking all attributes

<?php function modified_post_gallery( $blank = NULL, $attr ) { echo ‘<pre>’; print_r( $attr ); echo ‘</pre>’; } add_filter( ‘post_gallery’, ‘modified_post_gallery’, 10, 2); ?> In media.php it shows the filter like this: // Allow plugins/themes to override the default gallery template. $output = apply_filters(‘post_gallery’, ”, $attr); Its passing two variables not one and $attr is on … Read more

Creating my own portfolio custom-type

Attachments are post objects, with post_parent set to the ID of the post they belong to (ie your ‘session’). The WP Codex page on wp_get_attachment_image() has an example almost exactly like what you’re trying to do: https://codex.wordpress.org/Function_Reference/wp_get_attachment_image#Display_all_images_as_a_list Make sure that you replace the post_parent parameter in that example with the ID of the current session … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)