davidswain
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Posts mentioned in this postsThanks Samuel B
Not quite what I’m after those are related posts, I am looking for posts mentioned in the article
Forum: Fixing WordPress
In reply to: call function called by [embed] shortcode directShould anyione be interested the solution is:
if (!empty($full)) { $var = apply_filters('the_content', "[embed]" . $full . "[/embed]"); echo $var; }
where $full is the value of the url to be embed (eg https://www.youtube.com/watch?v=wLh6F7G7rPA) from a custom field
Forum: Fixing WordPress
In reply to: call function called by [embed] shortcode directThanks Michael
Had a look through media.php but i dont really understand it!
Forum: Fixing WordPress
In reply to: Scheduling post allows viewing if url knownThat’s great, how do you then shows posts for the future? I.e. “upcoming” as opposed to past?
Forum: Fixing WordPress
In reply to: call function called by [embed] shortcode directDoesnt work im afriad!
I tried it with the following code:
<?php echo do_shortcode('[-embed]https://www.youtube.com/watch?v=CSA657kxJQw[/embed]'); ?>
and it just echoed the content
remove the echo
<?php do_shortcode('[-embed]https://www.youtube.com/watch?v=CSA657kxJQw[/embed]'); ?>
rendered nothing
Forum: Fixing WordPress
In reply to: How do I browse and link to files already on the server?<?php function formatBytes($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } function getDirectory( $path = '.', $level = 0 ){ $ignore = array( 'cgi-bin', '.', '..' ); // Directories to ignore when listing output. Many hosts // will deny PHP access to the cgi-bin. $dh = @opendir( $path ); // Open the directory to the handle $dh while( false !== ( $file = readdir( $dh ) ) ){ // Loop through the directory if( !in_array( $file, $ignore ) ){ // Check that this file is not to be ignored if( is_dir( "$path/$file" ) ){ // Its a directory, so we need to keep reading down... echo "<h2>" . ucwords($file). "</h2>\n\n"; echo "<ul>\n"; getDirectory( "$path/$file", ($level+1) ); echo "</ul>\n\n"; // Re-call this same function but on a new directory. // this is what makes function recursive. } else { $thefile = str_replace("./", "", $path) . "/" . $file; echo "<li><a href=\"/" . str_replace("./", "", $path) . "/" . $file . "\">" . $file . "</a> " . formatBytes(filesize($thefile)) . "</li>\n"; // Just print out the filename } } } closedir( $dh ); // Close the directory handle } getDirectory( "./download" ); ?>
I’m using this function in a template file, just set the directory you want to browse in getDirectory() function
Forum: Themes and Templates
In reply to: Showposts being “odd:anyone?
Forum: Fixing WordPress
In reply to: previous_post_link questionOK
I have somewhat of a solution using some code i stole from eric martin it is:
$img = "<img src=\"/image/galleries/" . $catnicename . "/" . $image ."\" alt=\"" . get_the_title() . "\" />"; /** * New function that will display the navigation only if a previous or next entry exists * Hint: For entries, next == newer and previous == older */ function post_navigation() { global $checkthelink; $older = theme_previous_post_link('%link', '? %title'); if(strlen($older) > 0) { $checkthelink = 1; } return $checkthelink; } /** * Overrides the WordPress previous_posts() function in link-template.php * Modification: Changed echo to return */ function theme_previous_posts() { return clean_url(get_previous_posts_page_link()); } /** * Overrides the WordPress previous_post_link() function in link-template.php * Modification: Changed echo to return */ function theme_previous_post_link($format='? %link', $link='%title', $in_same_cat = TRUE, $excluded_categories = '') { $post = get_previous_post($in_same_cat, $excluded_categories); if ( !$post ) { return; } else { $format = 1; return $format; } } post_navigation(); if ($checkthelink != 1) { echo $img; } else { previous_post_link('%link', $img, TRUE); }
thats as small as i can get it but im sure it could be more efficient, anyone can they help?
David
Forum: Fixing WordPress
In reply to: previous_post_link questionThinking about it could i do another query_posts() with offset within the main loop get the permalink?
Forum: Fixing WordPress
In reply to: Gallery useAhhhh
I think i have discovered why (in sort) it because im using /%category%/%postname%/ as my permalink structure. Im not quite sure why that adds attachement and using day and name permalink structure doesnt but im getting closer…
Forum: Fixing WordPress
In reply to: characters in urls and lsugIridiax i see *sound of penny dropping*
thank you ever so much for your help, i’ll have a rethink.
Forum: Fixing WordPress
In reply to: characters in urls and lsugIm not being clear.
I would like to have urls like:
Forum: Fixing WordPress
In reply to: characters in urls and lsugWell i have sen urls with characters like * in