Allowing SVG uploads in media uploader without plug-in

I have previously managed to utilise this block of code within my functions.php file to enable and create thumbnails for SVGs that are uploaded to my site: // ALLOW SVG function add_file_types_to_uploads($file_types){ $new_filetypes = array(); $new_filetypes[‘svg’] = ‘image/svg+xml’; $file_types = array_merge($file_types, $new_filetypes ); return $file_types; } add_action(‘upload_mimes’, ‘add_file_types_to_uploads’); function common_svg_media_thumbnails($response, $attachment, $meta){ if($response[‘type’] === ‘image’ … Read more

Adding content to sidebars

I am working on a three-column layout where all three columns will have differing content depending on the post/page in the main column. How would I go about giving the ability to change and update the sidebar content and display it in templates using something like <?php the_content() ?> ? Since the sidebar content is … Read more

Why do wordpress store pages/posts within the database instead of files? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago. Improve this question I don’t understand why wordpress stores that kind of data: posts’ content and pages’ content, directly … Read more

Customize in category page

I’m working in a blog with a template of my own. When I link to a category page (i.e. mydomain.com/category/mycategory) WordPress generates this HTML code just after the header.php: <!– HTML rendered by header.php –> <!– This 2 lines belong to index.php –> <div id=”primary” class=”content-area”> <main id=”main” class=”site-main” role=”main”> <!– HTML rendered by content.php … Read more

Jetpack infinite scroll render – make different depending on post type?

I am currently working on a theme which has two post types – one is the normal “posts” post type, and the other is for portfolio posts – “mytheme_portfolio”. I am using JetPack’s infinite scroll to render new posts, as follows: function mytheme_render_infinite_scroll() { while ( have_posts() ) : the_post(); get_template_part( ‘content’, ‘archive-portfolio’ ); endwhile; … Read more

Pinterest Integration Using functions.php

I use a theme to build an portfolio. I´d like to add an pinterest “pin-it button” into the fuctions.php: Facebook, Google+ an Twitter were done, just the pinterest won´t work. Can´t found the the wrong code. This ist my code: function share_this($content){ if ( is_singular( ‘portfolio’ ) ) { $content .= ‘<div class=”share-this”>’ . /* … Read more

Convert all youtube link to embed

I have this function to convert any YouTube URL in any post or page to embed :- function embed_youtube_an($post_content) { global $posts; //preg_match(‘|http://www.youtube.com/watch?v=([a-zA-Z0-9]+)|’, $posts->post_content, $matches); preg_match(‘#http://w?w?w?.?youtube.com/watch\?v=([A-Za-z0-9\-_]+)#s’, $posts->post_content, $matches); if (!empty($matches[1])) { $post_content=”<object width=”415″ height=”250″>”; $post_content .= ‘<param name=”movie” value=”http://www.youtube.com/v/’ . $matches[1] . ‘&hl=en_US&fs=1&”></param>’; $post_content .= ‘<param name=”allowFullScreen” value=”true”></param>’; $post_content .= ‘<param name=”allowscriptaccess” value=”always”></param>’; $post_content .= … Read more