1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | <?php function port_portfolio ($atts, $content = null) { extract(shortcode_atts(array( 'id' => '2', 'images' =>'5', 'column' =>'4', 'sidebar' => '', ), $atts)); wp_enqueue_script("jquery_easing"); wp_enqueue_script('jquery_fancybox_pack'); wp_enqueue_style('css_fancybox'); ?> <script> jQuery(document).ready(function() { jQuery("a.example2").fancybox({ 'titleShow' : true, 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'easingIn' : 'easeOutBack', 'easingOut' : 'easeInBack' }); }); </script> <?php if($column == '5') { $class="one_fifth"; } if($column == '4') {$class="one_fourth";} if($column == '3') { $class="one_third"; } if($column == '2') {$class="one_half"; } if($column == '1') { $class="fullwidth"; } if($sidebar=="on") { if($column == '5') { $width="107"; $height="80"; } if($column == '4') { $width="139"; $height="120"; } if($column == '3') { $width="193"; $height="150";} if($column == '2') { $width="301"; $height="250"; } if($column == '1') { $width="624"; $height="325"; } }else{ if($column == '5') { $width="162"; $height="200";} if($column == '4') { $width="212"; $height="153";} if($column == '3') { $width="295"; $height="256"; } if($column == '2') { $width="461"; $height="247"; } if($column == '1') { $width="959"; $height="325"; } } global $post, $wpdb; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array('post_type' => 'kayaportfolio', 'posts_per_page' => $images, 'taxonomy' => 'portfolio_category', 'term' => $id, 'paged' => $paged)); $out='<div class="portfolio'.$column.' gallery">'; $i = 0; if(have_posts()) : while (have_posts()): the_post(); $readmore = get_option('readmore'); $readmore= $readmore ? $readmore: 'Read More'; $post_title = get_the_title($post->ID); $i++; $permalink = get_permalink($post->ID); if($column != "1") { $last = ($i == $column and $column != 1) ? 'last' : ''; $out.= '<div class="'.$class.' '.$last.'">'; $out.= '<div class="portfolio-padding">'; $video = get_post_meta( get_the_ID(), 'Video', true ); if($video) { if ( !empty( $video ) ) { $out.='<a href="'.$video.'" class="example2 lightbox iframe" title="Image Preview">'; $out.=kaya_imageresize(get_the_ID(),$width,$height,'img_radius','false'); $out.='</a>'; // $out.='<div class="post_nav_box">'; //$out.='<a href="'.$video.'" class="lightbox_video" rel="prettyPhoto[mixed]" title="Video Preview"> </a><a href="'.$permalink.'" class="post_link" title="Link To Post"> </a>'; // $out.='</div>'; } }else{ $thumb_id = get_post_thumbnail_id(); if ( !empty( $thumb_id ) ) { $imgurl=wp_get_attachment_url( get_post_thumbnail_id() ); $out.='<a href="'.$imgurl.'" class="example2 lightbox iframe" title="Image Preview">'; $out.=kaya_imageresize(get_the_ID(),$width,$height,'img_radius','false'); $out.='</a>'; // $out.='<div class="post_nav_box">'; // $out.='<a href="'.$imgurl.'" class="lightbox_image" rel="prettyPhoto[mixed]" title="Image Preview"></a><a href="'.$permalink.'" class="post_link" title="Link To Post"> </a>'; // $out.='</div>'; } } $out.='<div class="clear"> </div>'; $out.='<div class="item_content_holder">'; $out.='<h4><a href="'.$permalink.'">'.$post_title.'</a></h4>'; global $kaya_content; global $more; $more=0; $out.=content('10'); //$out.='<a class="readmore" href="'.$permalink.'">'.$readmore.'<span></span></a>'; // $out.='</div>'; //portfolio padding end $out.='</div>'; $out.='</div></div>'; if($last=="last"){ $out.='<div class="clear v-space"></div>'; } } if($column== "1") { $last = ($i == $column and $column != 1) ? 'last ' : ''; $out.= '<div class="portfolio-padding">'; $video = get_post_meta( get_the_ID(), 'Video', true ); if($video) { if ( !empty( $video ) ) { $out.='<a href="'.$video.'" class="example2 lightbox iframe" title="Image Preview">'; $out.=kaya_imageresize(get_the_ID(),$width,$height,'img_radius','false'); $out.='</a>'; //$out.='<div class="post_nav_box">'; //$out.='<a href="'.$video.'" class="lightbox_video" rel="prettyPhoto[mixed]" title="Video Preview"> </a><a href="'.$permalink.'" class="post_link" title="Link To Post"> </a>'; //$out.='</div>'; //$out.='<br>'; } }else{ $thumb_id = get_post_thumbnail_id(); if ( !empty( $thumb_id ) ) { $imgurl=wp_get_attachment_url( get_post_thumbnail_id() ); $out.='<a href="'.$imgurl.'" class="example2 lightbox iframe" title="Image Preview">'; $out.=kaya_imageresize(get_the_ID(),$width,$height,'','false'); $out.='</a>'; //$out.='<div class="post_nav_box">'; // $out.='<a href="'.$imgurl.'" class="lightbox_image" rel="prettyPhoto[mixed]" title="Image Preview"></a><a href="'.$permalink.'" class="post_link" title="Link To Post"> </a>'; //$out.='</div>'; } } $out.='<div class="item_content_holder">'; $out.='<h4><a href="'.$permalink.'">'.$post_title.'</a></h4>'; global $kaya_content; global $more; $more=0; $out.=content('20'); // $out.='</div>'; //portfolio padding end $out.='</div>'; $out.='</div>'; $out.='<div class="clear v-space2"> </div> '; } if($i == $column){ $i = 0; } endwhile; $out.='</div>'; else : $out.='<h2>'."Sorry but we could not find what you were looking for. But don't give up, keep at it!".'</h2>'; endif; $out.=kaya_pagination(); // $out.='</div>'; wp_reset_query(); return $out; } add_shortcode('portfolio','port_portfolio'); ?> |
In wat voor DB veld worden de gegevens opgeslagen? Als het bijvoorbeeld een varchar met een maximale lengte van 30 tekens is dan zit een deel van het probleem daar.quote:Op vrijdag 24 februari 2012 12:28 schreef Mirel het volgende:
Als ik die weghaal blijft de tekst staan.
Zoek in je DB de tekst die ingekort is eens op en kijk of het in de DB ook ingekort staat. Als het in de DB ingekort staat dan wordt het voordat het wordt opgeslagen al ingekort en moet je het probleem zoeken in de code die ervoor zorgt dat de gegevens naar de DB worden weggeschreven. Als het wel goed in de DB staat dan zit het probleem ergens in de code die de gegevens uit de DB haalt en verwerkt in de pagina.quote:Op vrijdag 24 februari 2012 12:39 schreef Mirel het volgende:
Ja idd, maar ik neem aan dat het ergens in de theme te vinden moet zijn. Het is een theme-eigen ding zover ik weet.
Zou je een voorbeeld hebben van het loopje? Ik ben heel slecht daarinquote:Op zaterdag 25 februari 2012 16:07 schreef Tijn het volgende:
Recursief in een loopje door je string blijven zoeken en elke keer het resultaat van strpos gebruiken als 3e parameter voor de volgende keer (offset). Daardoor zoek je verder vanaf het laatst gevonden resultaat.
Van: http://php.net/manual/en/function.stripos.phpquote:Op zaterdag 25 februari 2012 16:12 schreef Faux. het volgende:
[..]
Zou je een voorbeeld hebben van het loopje? Ik ben heel slecht daarin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <?php function multineedle_stripos($haystack, $needles, $offset=0) { foreach($needles as $needle) { $found[$needle] = stripos($haystack, $needle, $offset); } return $found; } // It works as such: $haystack = "The quick brown fox jumps over the lazy dog."; $needle = array("fox", "dog", ".", "duck") var_dump(multineedle_stripos($haystack, $needle)); /* Output: array(3) { ["fox"]=> int(16) ["dog"]=> int(40) ["."]=> int(43) ["duck"]=> bool(false) } */ ?> |
Niet helemaal wat ik bedoel, hier wordt er namelijk naar meerdere dingen gezocht in een string. Ik bedoel echter dat je naar één teken zoekt in de string die meerdere keren voorkomt. Toch bedankt voor het opzoekenquote:Op zaterdag 25 februari 2012 16:17 schreef The_Terminator het volgende:
[..]
Van: http://php.net/manual/en/function.stripos.php
[ code verwijderd ]
Zoiets denk ik:quote:Op zaterdag 25 februari 2012 16:12 schreef Faux. het volgende:
[..]
Zou je een voorbeeld hebben van het loopje? Ik ben heel slecht daarin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <?php // zoek recursief door een string function strpos_recursive($haystack, $needle, $offset = 0, &$results = array()) { $offset = strpos($haystack, $needle, $offset); if($offset === false) { return $results; } else { $results[] = $offset; return strpos_recursive($haystack, $needle, ($offset + 1), $results); } } $string = 'Ja hallo, dit is een string'; $search = 'a'; if($found = strpos_recursive($string, $search)) { foreach($found as $pos) { echo 'Found "'.$search.'" in string "'.$string.'" at position <b>'.$pos.'</b><br />'; } } else { echo '"'.$search.'" not found in "'.$string.'"'; } ?> |
Top, hartstikke bedankt!quote:
Het werkt inderdaad naar behoren. Bedankt!quote:Op zaterdag 25 februari 2012 16:41 schreef Tijn het volgende:
Volgens mij de eerste keer dat ik hier code post die een beetje fatsoenlijk is
1 2 3 4 5 6 7 8 9 10 | <?php foreach($concepts as $concept) { foreach($concept->getProperties() as $property) { $this->cfname = $property->getName(); $this->_insert(); $createdData[] = $this; $this->_increaseID(); } } ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [4] => Customfield Object ( [ID:Customfield:private] => 10009 [CUSTOMFIELDTYPEKEY:Customfield:private] => text [CUSTOMFIELDSEARCHERKEY:Customfield:private] => text2 [cfname:Customfield:private] => Assignee [DESCRIPTION:Customfield:private] => [defaultvalue:Customfield:private] => [FIELDTYPE:Customfield:private] => [PROJECT:Customfield:private] => [ISSUETYPE:Customfield:private] => ) [5] => Customfield Object ( [ID:Customfield:private] => 10010 [CUSTOMFIELDTYPEKEY:Customfield:private] => text [CUSTOMFIELDSEARCHERKEY:Customfield:private] => text2 [cfname:Customfield:private] => Assignee [DESCRIPTION:Customfield:private] => [defaultvalue:Customfield:private] => [FIELDTYPE:Customfield:private] => [PROJECT:Customfield:private] => [ISSUETYPE:Customfield:private] => ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [4] => Customfield Object ( [ID:Customfield:private] => 10009 [CUSTOMFIELDTYPEKEY:Customfield:private] => text [CUSTOMFIELDSEARCHERKEY:Customfield:private] => text2 [cfname:Customfield:private] => Assignee [DESCRIPTION:Customfield:private] => [defaultvalue:Customfield:private] => [FIELDTYPE:Customfield:private] => [PROJECT:Customfield:private] => [ISSUETYPE:Customfield:private] => ) [5] => Customfield Object ( [ID:Customfield:private] => 10009 [CUSTOMFIELDTYPEKEY:Customfield:private] => text [CUSTOMFIELDSEARCHERKEY:Customfield:private] => text2 [cfname:Customfield:private] => Assignee [DESCRIPTION:Customfield:private] => [defaultvalue:Customfield:private] => [FIELDTYPE:Customfield:private] => [PROJECT:Customfield:private] => [ISSUETYPE:Customfield:private] => ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php $google_bodyfont=get_option('google_bodyfont')? get_option('google_bodyfont'):'Ubuntu Condensed'; $google_generaltitlefont=get_option('google_generaltitlefont')? get_option('google_generaltitlefont'):'Ubuntu Condensed'; $gbodyfont = str_replace( ' ', '+', $google_bodyfont); $generaltitlefont = str_replace( ' ', '+', $google_generaltitlefont); ?> <?php if( get_option('kaya_typhography')=="false") { ?> <link href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed' rel='stylesheet' type='text/css'/> <?php }else{ ?> <?php if($google_bodyfont !="") { ?> <link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=<?php echo $gbodyfont; ?>'> <?php } ?> <?php if($generaltitlefont !="") { ?> <link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=<?php echo $generaltitlefont; ?>'> <?php } ?> <?php } ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | <?php if( get_option('kaya_typhography')== "true") { ?> body{ <?php echo 'font-family:'?><?php echo $google_bodyfont; ?>!important; <?php echo 'font-size:'?><?php echo $google_bodyfont_size; ?>px!important; <?php echo 'line-height:'?><?php echo $google_bodyfont_size+6; ?>px!important; } h1, h2, h3, h4, h5, h6 {<?php echo 'font-family:'?><?php echo $google_generaltitlefont; ?>!important; } #content h1{ <?php echo 'font-size:'?><?php echo $google_h1font_size; ?>px!important; <?php echo 'line-height:'?><?php echo $google_h1font_size+6; ?>px!important; } #content h2{ <?php echo 'font-size:'?><?php echo $google_h2font_size; ?>px!important; <?php echo 'line-height:'?><?php echo $google_h2font_size+6; ?>px!important; } #content h3{ <?php echo 'font-size:'?><?php echo $google_h3font_size; ?>px!important; <?php echo 'line-height:'?><?php echo $google_h3font_size+6; ?>px!important; } #content h4{ <?php echo 'font-size:'?><?php echo $google_h4font_size; ?>px!important; <?php echo 'line-height:'?><?php echo $google_h4font_size+6; ?>px!important; } #contentn h5{ <?php echo 'font-size:'?><?php echo $google_h5font_size; ?>px!important; <?php echo 'line-height:'?><?php echo $google_h5font_size+6; ?>px!important; } #content h6{ <?php echo 'font-size:'?><?php echo $google_h6font_size; ?>px!important; <?php echo 'line-height:'?><?php echo $google_h6font_size+6; ?>px!important; } <?php }else{ // Defalut googlefont if there is no font is selected from Theme Options ?> h1, h2, h3, h4, h5, h6 { color:#181818; margin-bottom:10px; font-family: 'Ubuntu Condensed', sans-serif !important; } |
Forum Opties | |
---|---|
Forumhop: | |
Hop naar: |