+44 (0)785 715 1348
office@bogdans.co.uk

Currently Browsing: Tutorials

iTunes – delete unused or removed music files 0

Posted on 2, January 2016

in Category Admin

You can’t automatically delete the music files removed from iTunes app however you can achieve something similar as follows: change the location of the iTunes library (move to a new folder): iTunes preferences > Advanced > move to new location or change tick the following check boxes keep iTunes media folder organised copy files to iTunes media folder press OK file > library > organise library > consolidate files iTunes should now copy only relevant files. Last but not least, delete the entire old folder (after having all the relevant files and folders transferred to the new location)

Read More

Faulting module name: mfmp4srcsnk.dll 0

Posted on 2, April 2015

in Category System administration

It will crash you File Explorer along with Media Player, particularly if viewing folders directly or indirectly which have MOV files within them. Solution is to remove the following 4 updates: KB2975719 KB2995388 KB3000850 KB3013769 Restart after removing each update! Uninstall them properly, reboot after every uninstall otherwise the attempt to uninstall will fail and you’ll think the solution isn’t working while in fact it works! Stop installing updates automatically!   &nbsp

Read More

Extract clean email address from Excel 0

Posted on 5, May 2014

in Category Tutorials

This function extracts the email address from the C1 column by removing the following characters/strings: “<“, “>”, “mailto:”. Hope this helps! SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(C1574,FIND(“@”,C1574,start-pos)−1),” “,REPT(” “,99),occurrence),99))&MID(C1574,FIND(“@”,C1574),FIND(” “,C1574&” “,FIND(“@”,C1574))−FIND(“@”,C1574)), “<“, “”), “>”, “”), “mailto:”, “”) Bogdan

Read More

Get the href, title or target of all links within an HTML page 0

Posted on 31, January 2014

in Category Web development

In order to do that you need to use preg_match_all just like explained below: $url = ‘<a target=”_blank” href=”‘ . $query_logs_result[“url”] . ‘”>’ . $query_logs_result[“title”] . ‘</a>’; preg_match(‘~<a(.*?)href=”([^”]+)”(.*?)>~’, $url, $only_the_url); echo $only_the_url[2]; This will show the hrefs, any other param of $only_the_url will return differently

Read More

PHP – Convert objects to Arrays 0

Posted on 11, December 2013

in Category Web development

I’d suggest using sections from the sections below in order to convert with PHP from objects to Arrays $responseXml2 = (array) $responseXml; $responseXml3 = array_values($responseXml2); $responseXml4 = $responseXml3[4]; $responseXml5 = array_values($responseXml4); $responseXml6 = $responseXml5[0]; $responseXml7 = (array) $responseXml6; $responseXml8 = array_values($responseXml7); $responseXml9 = $responseXml8[3]; $responseXml5 = array_values($responseXml9); $responseXml6 = $responseXml5[0]; $responseXml7 = (array) $responseXml6; $responseXml8 = array_values($responseXml7); $responseXml9 = $responseXml

Read More

WordPress: get the featured image from the parent’s post 0

Posted on 11, September 2013

in Category Web development

Here’s what you need to do in order to get the image from the parent’s post //get the ancestors $familyTree = get_ancestors($post->ID,’page’); array_unshift( $familyTree, $post->ID ); //add the current page to the begining of the list //loop through the family tree until you find a result or exhaust the array $featuredImage = ”; foreach ( $familyTree as $family_postid ) { if ( has_post_thumbnail( $family_postid ) ) { $featuredImage = get_the_post_thumbnail( $family_postid, ‘full’ ); break; } } // if the page has a featured image then show it echo ( $featuredImage ? $featuredImage : “” )

Read More

WordPress – get post IT by title 0

Posted on 11, September 2013

in Category Web development

It returns the post id based on the post title. It may not work if multiple posts have the same title.. function get_post_by_title($page_title, $output = OBJECT) { global $wpdb; $post = $wpdb->get_var( $wpdb->prepare( “SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type=’post’”, $page_title )); if ( $post ) return get_post($post, $output); return null; }

Read More

WordPress: get the text between a href anchor tags 0

Posted on 11, September 2013

in Category Web development

This is what you have to do in order to get the content between the a href / anchor tags: $out_vector = getTextBetweenTags(‘a’, $out); function getTextBetweenTags($tag, $html, $strict=0){ /*** a new dom object ***/ $dom = new domDocument; /*** load the html into the object ***/ if($strict==1) { $dom->loadXML($html); } else { $dom->loadHTML($html); } /*** discard white space ***/ $dom->preserveWhiteSpace = false; /*** the tag by its tag name ***/ $content = $dom->getElementsByTagname($tag); /*** the array to return ***/ $out = array(); foreach ($content as $item) { /*** add node value to the out array ***/ $out[] = $item->nodeValue; } [&hellip

Read More

PHP function to show the elapsed time in a nice way 0

Posted on 9, September 2013

in Category Web development

This function shows the elapsed time in a nice way (days left / remaining) – depending on the usage function themeblvd_time_ago() { global $post; $date = get_post_time(‘G’, true, $post); $chunks = array( array( 60 * 60 * 24 * 365 , __( ‘year’, ‘themeblvd’ ), __( ‘years’, ‘themeblvd’ ) ), array( 60 * 60 * 24 * 30 , __( ‘month’, ‘themeblvd’ ), __( ‘months’, ‘themeblvd’ ) ), array( 60 * 60 * 24 * 7, __( ‘week’, ‘themeblvd’ ), __( ‘weeks’, ‘themeblvd’ ) ), array( 60 * 60 * 24 , __( ‘day’, ‘themeblvd’ ), __( ‘days’, ‘themeblvd’ ) [&hellip

Read More

WordPress function to limit the number of characters 0

Posted on 9, September 2013

in Category Web development

This function limits a string down to a number of characters. The last parameter checks if the last word gets split or not. function limit_number_characters_string($string, $number, $words){ if ($words == true){ if (strlen($string) > $number){ $string = substr($string, 0, $number); for ($counter = strlen($string); $counter > 0; $counter–){ if (substr($string, $counter – 1, 1) == ” “){ return trim($string) . “..”; } else { $string = substr($string, 0, -1); } } } return $string; } else { if (strlen($string) > $number){ return substr($string, 0, $number) . “..”; } else { return $string; } } }

Read More