How to load file only in single post page through function.php?

is_single function checks for $wp_query global variable is loading single post of any post type or not , $wp_query is set after running query_posts function that loaded after wp action hook. So you should call this function in the right order ( hook ) add_action( ‘wp’, ‘include_single_lazy_load’ ); function include_single_lazy_load() { if( is_single() ) { … Read more

How to upload DICOM (dcm) files using wordpress wp_handle_upload?

Unlike jpg, pdf, and png files, dcm files, by default, aren’t allowed to be uploaded by WordPress. You can add them to the allowed list using the upload_mimes filter: add_filter( ‘upload_mimes’, ‘wpse409071_allow_dcm_uploads’ ); function wpse409071_allow_dcm_uploads( $mimes ) { $mimes[‘dcm’] = ‘image/dicom’; return $mimes; } (I found the MIME type here: https://www.file-extensions.org/dcm-file-extension. You might need to … Read more

Problems with defining UPLOADS constant

(Converting my comment to an answer.) Since you store themes and plugins in that folder as well, try setting the WP_CONTENT_DIR constant instead. (Always prefer absolute paths when possible.) As to your specific case, why it worked in one file but not in another – this will probably involve more debugging, checking where exactly WP … Read more

WordPress Custom Fonts Problem! [closed]

In /wp-content/themes/centric-pro/style.css, delete line 88 through line 113 this removes all the font-face declarations. On line 88 paste the following: @font-face { font-family: ‘GothamRounded-Bold’; font-style: normal; font-weight: 400; src: url(‘fonts/GothamRounded-Bold.eot’) format(’embedded-opentype’), url(‘fonts/GothamRounded-Bold.otf’) format(‘opentype’), url(‘fonts/GothamRounded-Bold.woff’) format(‘woff’), url(‘fonts/GothamRounded-Bold.ttf’) format(‘truetype’), url(‘fonts/GothamRounded-Bold.svg#GothamRounded-Bold’) format(‘svg’); } @font-face { font-family: ‘GothamRounded-Light’; font-style: normal; font-weight: 400; src: url(‘fonts/GothamRounded-Light.eot’) format(’embedded-opentype’), url(‘fonts/GothamRounded-Light.otf’) format(‘opentype’), url(‘fonts/GothamRounded-Light.woff’) format(‘woff’), … Read more

Media upload takes too long

Please check you file size first, if it’s too large or heavy wait. it will take time. by default WordPress upload file size limited to 2MB only, so you have to upload less than it or you have to increase the upload file size limit.

How to upload and add images to the existing post from the front-end with admin approval which is posted by other user

This is a way to add post images and other things. So put different check on it according to your need. <?php if( ‘POST’ == $_SERVER[‘REQUEST_METHOD’ ] && !empty( $_POST[‘action’ ] ) && $_POST[‘action’ ] == “new_post”) { if (isset ($_POST[‘post_title’])) { $post_title = $_POST[‘post_title’]; } $post = array( ‘post_title’ => $post_title, ‘post_content’ => $post_content, … Read more

media_handle_sideload() fails

The Problem was the @copy() in wp-includes/file.php class of wordpress. This will mask the real problem why the file could not copied (the rights on on htdocs was not ok). So the problem is fixed.