Add SWF file to wordpress through custom template

wordpress is not alowing me to upload the swf file into the media library Actually you can insert this code to the functions.php: add_filter(‘upload_mimes’, ‘add_custom_upload_mimes’); function add_custom_upload_mimes($existing_mimes){ $existing_mimes[‘swf’] = ‘text/swf’; //allow swf files return $existing_mimes; } Then you try to upload your swf file to the media library. As for homepage, you can install a … Read more

How to change the value “uploaded to” in the media library (WordPress 4.0)

You’ll need to do 2 things. First, filter the current media columns. add_filter(‘manage_media_columns’ , ‘newMediaColumnNames’); function newMediaColumnNames( $columns ) { //remove the old column – optional unset( $columns[‘parent’] ); //add a new one to take it’s place $columns[‘new_uploaded_to’] = __(‘New Uploaded To’); return $columns; } I was not able to find a way to edit … Read more

Issue removing Media Editor Tabs — Duplicate Items

Changing strings to null or to empty strings removes items from left menu of the uploader and corresponding tabs. Paste this code in functions.php: function remove_media_tab( $strings ) { if( !current_user_can( ‘administrator’ ) ) { $strings[“createGalleryTitle”] = “”; $strings[“setFeaturedImageTitle”] = “”; $strings[“insertFromUrlTitle”] = “”; $strings[‘createPlaylistTitle’] = “”; $strings[‘createVideoPlaylistTitle’] = “”; } return $strings; } add_filter( … Read more

Distinguish between 2 instances of admin-ajax.php

There isn’t much point to distinguishing admin-ajax.php since it’s essentially same file with same logic running for many many purposes. You are passing action data and hooking into respective action. So action is your identifier. If you are reusing same action and need to further differentiate — just pass more data with your GET/POST request … Read more

How to link a PDF file to a category URL

If your theme has an attachment template (attachment.php) and you upload your page/post-specific media items, then you will get a page/post-specific media attachment URL. Suppose you are adding/editing your post/page on Case Study (i.e. cs1), so your post/page URL will be (if post-name permalink structure is enabled): http://example.com/cs1/ If you upload an image or a … Read more

Using the media library for theme customization

I figured this out. For anyone facing the same issue, I ended up using this code instead: function hi_customization_options( $wp_customize ) { $wp_customize->add_section( ‘landing_page_image’, array( ‘title’ => ‘Landing Page Image’, ‘priority’ => 35, ) ); $wp_customize->add_setting( ‘lp-image_selector’, array( ‘default’ => ”, ) ); $wp_customize->add_setting( ‘img-upload’ ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘lp-image_selector’, array( ‘label’ => ‘Landing … Read more

Changing titles in Uploader for “Posts”

you have the “media_view_strings” filter for this : add_filter(“media_view_strings”, function ($strings, $post) { $strings[“insertMediaTitle”] = “Upload Content”; $strings[“uploadFilesTitle”] = “Upload”; $strings[“mediaLibraryTitle”] = “Your Content”; return $strings; }, 10, 2);

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