How to create a custom WordPress page with my plugin?

function to create a page and if we want to link a template to that page if (! function_exists(‘create_page’)) { function create_page($title, $template = 0){ $a = get_page_by_title( $title, ‘post’ ); if ($a == null || $a->post_status == ‘trash’) { $page = array( ‘post_type’ => ‘page’, ‘post_title’ => $title, ‘post_status’ => ‘publish’ ); $post_id = … Read more

WordPress Favicon not Working For Images/Videos/PDFs

When opening media files only the file is loaded and not the html head of your file. You can add a ‘favicon.ico’ file (‘.png’ may also work – not sure) to your root directory (‘public_html/’, ‘www/’ ‘domain.com/’ depending on server setup) and it should load even for media files as browsers are automaticly looking for … Read more

Multiple TinyMCE on button click is initialized and appended but why only last one is writeable?

Ok, with many hours of debugging and I finally came to know why it was not working. So everything is supposed to work the way it should be but there was a minor mistake in my JavaScript. Previous JavaScript var counter = 1; document.getElementById(‘add_more_content_block’).addEventListener(‘click’, function(e) { e.preventDefault(); var editor_id = “editor_”+counter; document.getElementById(‘add_content_box’).innerHTML += `<div class=”wp-`+editor_id+`-editor-container”> … Read more

Posts form with AJAX request – Plugin development

Post without AJAX is working perfectly fine, but with AJAX, it’s returning 0. Simply put, that’s because your AJAX request doesn’t include the pp_submit input which is required by pp_html_process() — the callback for both regular and AJAX form submission. I.e. As I said in the comments: jQuery doesn’t serialize submit button value (see here), … Read more