How do I add html content to custom post type Posts using php?

After searching through the wordpress docs, I found what I needed. What I was missing was the hook called “the_content”. My function, and all the code I wrote inside it, was correct. I just needed this stupid hook. function displayIframe($content) { //[my code to get the $currentPostID and $currentPostGuid] //… //… if (is_single( $currentPostID )) … Read more

Attach a external file as attachement using wp_mail

You can’t attach from a URL. So https://ucarecdn.com/8aa17c61-bd55-4311-8b45-7d9a2efde6c5/ won’t work. You need an absolute path to the file, such as /path/to/my/file.ext. But there are some other problems with your code snippet as well. You use $email_attachement (with a ..chement…) in one place, but then $email_attachment in your wp_mail() call. Also, your “attachment” isn’t a file. … Read more

Gutenberg Block: Image resolution

I was asking the same question in the comments of another question. The solution is (thanks to Кирилл-Меркушев), to get another URL from the onSelect Callback. Before I had this: function onSelectImage( media ) { props.setAttributes( { mediaURL: media.url } ); props.setAttributes( { mediaID: media.id } ); } Then I console logged the media parameter, … Read more

hide attached images of a post

My first recommendation would be to use Advanced Custom Fields to setup a gallery rather than using this method. However, I think you may be able to load your images using Add Media -> Create Gallery which will add a shortcode to your post content You could then use the_content filter and strip_shortcodes to remove … Read more

Reinstall WordPress while keeping attachments

Depending on how those inbound links work, this could be simpler than you think. If the links are direct to files in the file system, WordPress isn’t actually needed at all – just a corresponding path for a valid URL. So let’s say you install WP today, the ‘earliest’ folder in uploads will be 2020/09. … Read more

Hook after attachment added and cropped

There is to filters needed for optimizing all images, that will be uploaded: add_filter(‘wp_handle_upload’, ‘random_function’, 10, 2); add_filter(‘image_make_intermediate_size’, ‘rand_function2’, 10, 1); function random_function($array, $string) { // Some random action with main image return $array } function rand_function2($file) { // Some random action with cropped images return $file }

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