Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.05 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * Tricky Loops v5 Thanks to Richard
  5. * CF1.0 - Added feature to filter by custom fields. Base Ultimatum Version used is 2.8.7 PRO - Manik Magar
  6. */
  7.  
  8. class UltimatumCustomContentWithCFFilter extends WP_Widget {
  9.  
  10. function UltimatumCustomContentWithCFFilter() {
  11. parent::__construct( false, $name = 'WordPress Custom Loop - CF Filter' );
  12. }
  13.  
  14.  
  15. function widget( $args, $instance ) {
  16. /*
  17. * Ult. 2.6 text Array
  18. */
  19. $loop_text_vars = array(
  20. "Read More" => __( "Read More", 'ultimatum' ),
  21. "More" => __( "More", 'ultimatum' ),
  22. "Continue Reading" => __( "Continue Reading", 'ultimatum' ),
  23. "Continue" => __( "Continue", 'ultimatum' ),
  24. "Details" => __( "Details", 'ultimatum' ),
  25.  
  26. );
  27. remove_all_actions( 'ultimatum_before_featured_image' );
  28. remove_all_actions( 'ultimatum_after_featured_image' );
  29. extract( $args );
  30. $instance['ult_full_image'] = false;
  31. $title = apply_filters( 'widget_title', $instance['title'] );
  32. echo $before_widget;
  33. if ( $title ) :
  34. echo $before_title . $title . $after_title;
  35. endif;
  36. // Column Properties
  37. $colprops = explode( '-', $instance["multiple"] );
  38. $colcount = $colprops[0];
  39. $i = 1;
  40. $count = $instance["perpage"];
  41. $gallery = false;
  42. $rel = '';
  43. $col_class = '';
  44. switch ( $colcount ) {
  45. case '1':
  46. $grid = $grid_width;
  47. $cols = 1;
  48. break;
  49. case '2':
  50. $grid = $grid_width / 2;
  51. $cols = 2;
  52. $col_class = 'one_half';
  53. break;
  54. case '3':
  55. $grid = $grid_width / 3;
  56. $cols = 3;
  57. $col_class = 'one_third';
  58. break;
  59. case '4':
  60. $grid = $grid_width / 4;
  61. $cols = 4;
  62. $col_class = 'one_fourth';
  63. break;
  64. }
  65. $colcount = $cols;
  66. if ( $colcount == 1 && ( $colprops[2] == 'ri' || $colprops[2] == 'li' || $colprops[2] == 'gl' || $colprops[2] == 'gr' ) ) {
  67. $imgw = $instance["multiplew"];
  68. } else {
  69. $imgw = $grid;
  70. $instance['ult_full_image'] = true;
  71. }
  72. $gallery = false;
  73. switch ( $colprops[2] ) {
  74. case 'ri':
  75. $align = "fimage-align-right";
  76. $image = true;
  77.  
  78. break;
  79. case 'li':
  80. $align = "fimage-align-left";
  81. $image = true;
  82. break;
  83. case 'gl':
  84. $align = "fimage-align-left";
  85. $rel = 'rel="prettyPhoto[]"';
  86. $gallery = true;
  87. $image = true;
  88. break;
  89. case 'gr':
  90. $align = "fimage-align-right";
  91. $rel = 'rel="prettyPhoto[]"';
  92. $gallery = true;
  93. $image = true;
  94. break;
  95. case 'g':
  96. $rel = 'rel="prettyPhoto[]"';
  97. $gallery = true;
  98. $align = '';
  99. $image = true;
  100. break;
  101. case 'i':
  102. $align = '';
  103. $image = true;
  104. break;
  105. default:
  106. $image = false;
  107. $align = '';
  108. break;
  109. }
  110. global $wp_filter;
  111. $source = $instance['source'];
  112. $the_content_filter_backup = $wp_filter['the_content'];
  113. $looporder1 = isset( $instance['looporder1'] ) ? $instance['looporder1'] : '';
  114. $looporder2 = isset( $instance['looporder2'] ) ? $instance['looporder2'] : '';
  115. $skip = isset( $instance['skip'] ) ? $instance['skip'] : 0;
  116. // set order defaults
  117. $orderby = 'date';
  118. $order = 'DESC';
  119. $order = isset( $instance['orderdir'] ) ? $instance['orderdir'] : 'DESC';
  120. if ( $looporder1 ) {
  121. $orderby = $looporder1;
  122. $setby1 = true;
  123. }
  124. if ( $looporder2 ) {
  125. if ( $setby1 ) {
  126. $orderby .= ' ' . $looporder2;
  127. } else {
  128. $orderby = $looporder2;
  129. }
  130. }
  131. if ( preg_match( '/ptype-/i', $source ) ) {
  132. $post_type = str_replace( 'ptype-', '', $source );
  133. } elseif ( preg_match( '/cat-/i', $source ) ) {
  134. $post_type = 'post';
  135. $cat = str_replace( 'cat-', '', $source );
  136. } elseif ( preg_match( '/taxonomy-/i', $source ) ) {
  137. $prop = explode( '|', str_replace( 'taxonomy-', '', $source ) );
  138. $post_type = $prop[0];
  139. $taxonmy['taxonomy'] = $prop[1];
  140. $taxonmy['term'] = $prop[2];
  141. }
  142. $query = array(
  143. 'posts_per_page' => (int) $count,
  144. 'post_type' => $post_type,
  145. 'orderby' => $orderby,
  146. 'order' => $order,
  147. );
  148. if(isset($instance['pagination']) && $instance['pagination']!='false'){
  149. $pagged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
  150. $query['paged'] = $pagged;
  151. }
  152. if ( $skip > 0 ) {
  153. $query['offset'] = $skip;
  154. }
  155. if ( $cat ) {
  156. $query['cat'] = $cat;
  157. }
  158. if ( isset( $taxonmy ) ) {
  159. $query['taxonomy'] = $taxonmy['taxonomy'];
  160. $query['term'] = $taxonmy['term'];
  161. }
  162. $query['showposts'] = $count;
  163. $query['is_ultimatum_custom_loop'] = true;
  164. if(isset($instance['sfpro']) && $instance['sfpro']!='-1'){
  165. $query['search_filter_id' ]= $instance['sfpro'];
  166. }
  167. // CF1.0: Start - Add filter criteria to query
  168. if ($instance['filterCFKey'] != "") {
  169. $query['meta_key'] = $instance['filterCFKey'];
  170. if (isset($instance['filterCFParentAttr']) && $instance['filterCFParentAttr']!='false') {
  171. if ($instance['filterCFParentAttr'] == 'post-id') {
  172. $query['meta_value'] = get_the_ID();
  173. }
  174. } else {
  175. $query['meta_value'] = $instance['filterCFValue'];
  176. }
  177.  
  178.  
  179. }
  180. // CF1.0: End
  181.  
  182. $r = new WP_Query( $query );
  183. $a_custom_loop = true;
  184. $loopfile = null;
  185. if ( preg_match( '/.php/i', $instance["multiple"] ) ) {
  186. $loopfile = $instance["multiple"];
  187. }
  188.  
  189. include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
  190. if ( isset( $loopfile ) && file_exists( THEME_LOOPS_DIR . DS . $loopfile ) ) {
  191. include( THEME_LOOPS_DIR . DS . $loopfile );
  192. } elseif ( is_plugin_active( 'wonderloops/wonderloops.php' ) && isset( $loopfile ) && file_exists( ULTLOOPBUILDER_DIR . DS . $loopfile ) ) { //Wonder Loop include
  193. include( ULTLOOPBUILDER_DIR . DS . $loopfile );
  194.  
  195. } else {
  196. if ( $r->have_posts() ):
  197. print_r($instance);
  198. print_r($query);
  199. while ( $r->have_posts() ) : $r->the_post();
  200. global $post;
  201. if ( $colcount != 1 )://gridd
  202. if ( $i == 1 ) {
  203. $i ++;
  204. $gps = false;
  205. } elseif ( $i == $colcount ) {
  206. $gps = true;
  207. $i = 1;
  208. } else {
  209. $i ++;
  210. $gps = false;
  211. }
  212. else :
  213. $gps = '';
  214. endif;//gridd
  215. ?>
  216. <article class="post <?php $allClasses = get_post_class(); foreach ($allClasses as $class) { echo $class . " "; } ?> <?php if ( get_post_meta( $post->ID, 'ultimatum_video', true ) ) { ?>video-post <?php } ?> post-<?php echo $post->ID; ?> ultimatepost-custom <?php echo $col_class;
  217. if ( $gps ) {
  218. echo " last";
  219. } ?>">
  220. <div class="post-inner">
  221. <?php
  222. if ( $image && ( $imgw != $grid || $instance["mimgpos"] == 'btitle' ) ) {
  223. ?>
  224. <?php $this->ultimatum_custom_loop_image( $args, $instance, $imgw, $rel, $align, $gallery );?>
  225. <?php if ( $instance["mmeta"] == 'aimage' ) {
  226. echo $this->blog_multimeta( $instance );
  227. } ?>
  228. <?php
  229. }
  230.  
  231. ?>
  232. <?php if ( $instance["mtitle"] == 'true' ) { ?>
  233. <h3 class="post-header">
  234. <?php if ( $rel ) { ?>
  235. <?php the_title(); ?>
  236. <?php } else { ?>
  237. <a class="post-title" href="<?php the_permalink(); ?>"><?php the_title() ?></a>
  238. <?php } ?>
  239. </h3>
  240. <?php } ?>
  241. <?php if ( $image && ( $imgw == $grid && $instance["mimgpos"] == 'atitle' ) ) { ?>
  242. <div class="aligner">
  243. <?php $this->ultimatum_custom_loop_image( $args, $instance, $imgw, $rel, $align, $gallery ); ?>
  244. <?php if ( $instance["mmeta"] == 'aimage' ) {
  245. echo $this->blog_multimeta( $instance );
  246. } ?>
  247. </div>
  248. <?php } ?>
  249.  
  250. <?php if ( $instance["mmeta"] == 'atitle' ) {
  251. echo $this->blog_multimeta( $instance );
  252. } ?>
  253. <?php if ( $instance["excerpt"] == 'true' ) { ?>
  254. <p class="post-excerpt"><?php echo wp_html_excerpt( get_the_excerpt(), $instance["excerptlength"] ); ?>
  255. ...</p>
  256. <?php } elseif ( $instance['excerpt'] == 'content' ) { ?>
  257. <p class="post-excerpt"><?php the_content(); ?></p>
  258. <?php } ?>
  259. <?php if ( $instance["mmeta"] == 'atext' ) {
  260. echo $this->blog_multimeta( $instance );
  261. }
  262.  
  263. $tax = '';
  264.  
  265. if ( $instance["mcats"] == 'acontent' ) {
  266. $tax = array();
  267. $_tax = array();
  268. $_tax = get_the_taxonomies();
  269. if ( empty( $_tax ) ) {
  270. } else {
  271. foreach ( $_tax as $key => $value ) {
  272. preg_match( '/(.+?): /i', $value, $matches );
  273. $tax[] = '<span class="entry-tax-' . $key . '">' . str_replace( $matches[0], '<span class="entry-tax-meta">' . $matches[1] . ':</span> ', $value ) . '</span>';
  274. }
  275. }
  276. echo '<div class="post-meta taxonomy">' . join( '<br />', $tax ) . '</div>';
  277.  
  278. }
  279. if ( $instance["mreadmore"] != 'false' ) {
  280. ?>
  281. <p style="text-align:<?php echo $instance["mreadmore"]; ?>">
  282. <a href="<?php the_permalink(); ?>" class="readmorecontent read-more custom-loop">
  283. <?php echo $loop_text_vars[ $instance['rmtext'] ]; ?>
  284. </a>
  285. </p>
  286. <?php } ?>
  287. </div>
  288. </article>
  289.  
  290.  
  291. <?php
  292. if ( $i == 1 ) {
  293. echo '<div style="clear:both"></div>';
  294. }
  295.  
  296. endwhile;
  297. if(isset($instance['pagination']) && $instance['pagination']!='false'){
  298. echo '<div style="clear:both"></div>';
  299. ult_custom_numeric_posts_nav($r->max_num_pages,$pagged);
  300. echo '<div style="clear:both"></div>';
  301. }
  302. endif;
  303.  
  304. }
  305. ?>
  306. <?php
  307. echo '<div style="clear:both"></div>';
  308. ?>
  309.  
  310. <?php
  311. wp_reset_postdata();
  312. $wp_filter['the_content'] = $the_content_filter_backup;
  313. echo $after_widget;
  314. }
  315.  
  316. function ultimatum_custom_loop_image( $args, $instance, $imgw, $rel, $align, $gallery ) {
  317. global $post;
  318. extract( $args );
  319. $img = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
  320. $imgsrc = false;
  321. if ( ! $img && $instance["mnoimage"] == 'true' ) {
  322. $img[0] = null;
  323. if ( get_ultimatum_option( 'general', 'noimage' ) ) {
  324. $img[0] = get_ultimatum_option( 'general', 'noimage' );
  325. }
  326. $imgsrc = UltimatumImageResizer( null, $img[0], $imgw, $instance["multipleh"], true );
  327. } elseif ( is_array( $img ) ) {
  328. $imgsrc = UltimatumImageResizer( get_post_thumbnail_id(), null, $imgw, $instance["multipleh"], true );
  329. }
  330. if ( $imgsrc ) { ?>
  331. <div class="featured-image <?php echo $align;?>" <?php if ($gallery){ ?>style="position: relative"<?php } ?>>
  332. <?php
  333. $video = get_post_meta( $post->ID, 'ultimatum_video', true );
  334. if ( $gallery ) {
  335. if ( $video ) {
  336. $link = $video . '';
  337. } else {
  338. $link = $img[0];
  339. if ( preg_match( '/holder.js/i', $imgsrc ) ) {
  340. $link = '';
  341. $rel = '';
  342. }
  343. }
  344. }
  345. if ( $instance["mvideo"] == 'true' ) {
  346. if ( get_post_meta( $post->ID, '_image_ids', true ) && ! $gallery && $instance['ult_full_image'] ) {
  347. post_gallery( $imgw, $instance["multipleh"], $instance );
  348. } elseif ( get_post_meta( $post->ID, 'ultimatum_video', true ) && ! $gallery ) {
  349.  
  350. $sc = '[ult_video width="' . $imgw . '" height="' . $instance["multipleh"] . '"]' . $video . '[/ult_video]';
  351. echo do_shortcode( $sc );
  352. } else { ?>
  353. <a href="<?php if ( $gallery ) {
  354. echo $link;
  355. } else {
  356. the_permalink();
  357. } ?>" <?php echo $rel ?> class="preload <?php if ( $gallery ) {
  358. echo ' overlayed_image';
  359. } ?>" <?php if ( $gallery ) {
  360. if ( $video ) {
  361. echo ' data-overlay="play"';
  362. } else {
  363. echo ' data-overlay="image"';
  364. }
  365. } ?>>
  366. <img src="<?php echo $imgsrc; ?>" alt="<?php the_title(); ?>"/>
  367. </a><?php
  368. }
  369. } else { ?>
  370. <a href="<?php if ( $gallery ) {
  371. echo $link;
  372. } else {
  373. the_permalink();
  374. } ?>" <?php echo $rel ?> class="preload <?php if ( $gallery ) {
  375. echo ' overlayed_image';
  376. } ?>" <?php if ( $gallery ) {
  377. if ( $video ) {
  378. echo ' data-overlay="play"';
  379. } else {
  380. echo ' data-overlay="image"';
  381. }
  382. } ?>>
  383. <img src="<?php echo $imgsrc; ?>" alt="<?php the_title(); ?>"/>
  384. </a><?php
  385. }
  386. ?>
  387. </div><?php
  388. }
  389. }
  390.  
  391. function blog_multimeta( $instance ) {
  392. global $post;
  393. if ( $instance["mdate"] == 'true' ) {
  394. $mshowtime = isset( $instance['mshowtime'] ) ? $instance['mshowtime'] : '';
  395. if ( $mshowtime ) {
  396. $mtime = the_time();
  397. }
  398. $out[] = '<span class="date"><a href="' . get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ) . '">' . get_the_date() . ' ' . $mtime . '</a></span>';
  399. }
  400. if ( $instance["mauthor"] == 'true' ) {
  401. $out[] = '<span class="author">' . __( 'by ', 'ultimatum' ) . '<a href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . get_the_author() . '</a></span>';
  402. }
  403. if ( $instance["mcomments"] == "true" && ( $post->comment_count > 0 || comments_open() ) ) {
  404. ob_start();
  405. comments_popup_link( __( 'No Comments', 'ultimatum' ), __( '1 Comment', 'ultimatum' ), __( '% Comments', 'ultimatum' ), '' );
  406. $out[] = '<span class="comments">' . ob_get_clean() . '</span>';
  407. }
  408. if ( count( $out ) != 0 ) {
  409. $output = '<div class="post-meta">';
  410. $output .= join( ' ' . $instance["mmseperator"] . ' ', $out ) . '</div>';
  411. }
  412. unset( $out );
  413. $tax = '';
  414. if ( $instance["mcats"] == 'ameta' ) {
  415. $_tax = get_the_taxonomies();
  416. if ( empty( $_tax ) ) {
  417. } else {
  418. foreach ( $_tax as $key => $value ) {
  419. preg_match( '/(.+?): /i', $value, $matches );
  420. $tax[] = '<span class="entry-tax-' . $key . '">' . str_replace( $matches[0], '<span class="entry-tax-meta">' . $matches[1] . ':</span> ', $value ) . '</span>';
  421. }
  422. }
  423. if ( count( $tax ) != 0 ) {
  424. $output .= '<div class="post-taxonomy">' . join( '<br />', $tax ) . '</div>';
  425. }
  426. unset( $_tax );
  427. }
  428.  
  429. return $output;
  430. }
  431.  
  432.  
  433. function update( $new_instance, $old_instance ) {
  434. $instance['title'] = strip_tags( $new_instance['title'] );
  435. $instance['perpage'] = $new_instance['perpage'];
  436. $instance['mseperator'] = $new_instance['mseperator'];
  437. $instance['multiple'] = $new_instance['multiple'];
  438. $instance['multipleh'] = $new_instance['multipleh'];
  439. $instance['multiplew'] = $new_instance['multiplew'];
  440. $instance['mtitle'] = $new_instance['mtitle'];
  441. $instance['mvideo'] = $new_instance['mvideo'];
  442. $instance['mmeta'] = $new_instance['mmeta'];
  443. $instance['mdate'] = $new_instance['mdate'];
  444. $instance['mauthor'] = $new_instance['mauthor'];
  445. $instance['mimgpos'] = $new_instance['mimgpos'];
  446. $instance['mcomments'] = $new_instance['mcomments'];
  447. $instance['mcats'] = $new_instance['mcats'];
  448. $instance['excerpt'] = $new_instance['excerpt'];
  449. $instance['excerptlength'] = $new_instance['excerptlength'];
  450. $instance['mreadmore'] = $new_instance['mreadmore'];
  451. $instance['rmtext'] = $new_instance['rmtext'];
  452. $instance['mmargin'] = $new_instance['mmargin'];
  453. $instance['mmseperator'] = $new_instance['mmseperator'];
  454. $instance['source'] = $new_instance['source'];
  455. $instance['noimage'] = $new_instance['noimage'];
  456. $instance['mnoimage'] = $new_instance['mnoimage'];
  457.  
  458. $instance['mshowtime'] = $new_instance['mshowtime'];
  459.  
  460. $instance['looporder1'] = $new_instance['looporder1'];
  461. $instance['looporder2'] = $new_instance['looporder2'];
  462. $instance['skip'] = $new_instance['skip'];
  463. $instance['orderdir'] = $new_instance['orderdir'];
  464. $instance['sfpro'] = $new_instance['sfpro'];
  465. $instance['pagination'] = $new_instance['pagination'];
  466.  
  467. // CF1.0: Start - Update the fields to new instance
  468. $instance['filterByCF'] = $new_instance['filterByCF'];
  469. $instance['filterCFParentAttr'] = $new_instance['filterCFParentAttr'];
  470. $instance['filterCFKey'] = $new_instance['filterCFKey'];
  471. $instance['filterCFValue'] = $new_instance['filterCFValue'];
  472. // CF1.0: End
  473.  
  474. return $instance;
  475. }
  476.  
  477. function form( $instance ) {
  478. $source = isset( $instance['source'] ) ? $instance['source'] : 'post';
  479. $excerpt = isset( $instance['excerpt'] ) ? $instance['excerpt'] : 'true';
  480. $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
  481. $mtitle = isset( $instance['mtitle'] ) ? $instance['mtitle'] : 'true';
  482. $mimgpos = isset( $instance['mimgpos'] ) ? $instance['mimgpos'] : 'btitle';
  483. $mvideo = isset( $instance['mvideo'] ) ? $instance['mvideo'] : 'false';
  484. $perpage = isset( $instance['perpage'] ) ? $instance['perpage'] : '10';
  485. $multiple = isset( $instance['multiple'] ) ? $instance['multiple'] : '1coli';
  486. $multiplew = isset( $instance['multiplew'] ) ? $instance['multiplew'] : '220';
  487. $multipleh = isset( $instance['multipleh'] ) ? $instance['multipleh'] : '220';
  488. $excerptlength = isset( $instance['excerptlength'] ) ? $instance['excerptlength'] : '100';
  489. $mmeta = isset( $instance['mmeta'] ) ? $instance['mmeta'] : 'aimage';
  490. $mmargin = isset( $instance['mmargin'] ) ? $instance['mmargin'] : '30';
  491. $mdate = isset( $instance['mdate'] ) ? $instance['mdate'] : 'true';
  492. $mauthor = isset( $instance['mauthor'] ) ? $instance['mauthor'] : 'false';
  493. $mcomments = isset( $instance['mcomments'] ) ? $instance['mcomments'] : 'true';
  494. $mcats = isset( $instance['mcats'] ) ? $instance['mcats'] : 'false';
  495. $mreadmore = isset( $instance['mreadmore'] ) ? $instance['mreadmore'] : 'right';
  496. $mmseperator = isset( $instance['mmseperator'] ) ? $instance['mmseperator'] : '|';
  497. $rmtext = isset( $instance['rmtext'] ) ? $instance['rmtext'] : 'Read More';
  498. $noimage = isset( $instance['noimage'] ) ? $instance['noimage'] : 'true';
  499. $mnoimage = isset( $instance['mnoimage'] ) ? $instance['mnoimage'] : 'true';
  500.  
  501. $mshowtime = isset( $instance['mshowtime'] ) ? $instance['mshowtime'] : '';
  502.  
  503.  
  504. $looporder1 = isset( $instance['looporder1'] ) ? $instance['looporder1'] : '';
  505. $looporder2 = isset( $instance['looporder2'] ) ? $instance['looporder2'] : '';
  506. $orderdir = isset( $instance['orderdir'] ) ? $instance['orderdir'] : 'DESC';
  507. $skip = isset( $instance['skip'] ) ? $instance['skip'] : '';
  508. $sfpro = isset( $instance['sfpro'] ) ? $instance['sfpro'] : '-1';
  509. $pagination = isset( $instance['pagination'] ) ? $instance['pagination'] : 'false';
  510.  
  511. // CF1.0: Start - set the variables
  512. $filterByCF = isset( $instance['filterByCF'] ) ? $instance['filterByCF'] : '';
  513. $filterCFParentAttr = isset( $instance['filterCFParentAttr'] ) ? $instance['filterCFParentAttr'] : '';
  514. $filterCFKey = isset( $instance['filterCFKey'] ) ? $instance['filterCFKey'] : '';
  515. $filterCFValue = isset( $instance['filterCFValue'] ) ? $instance['filterCFValue'] : '';
  516. // CF1.0: End
  517.  
  518.  
  519. global $wpdb;
  520. $termstable = $wpdb->prefix . ULTIMATUM_PREFIX . '_tax';
  521. ?>
  522. <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'ultimatum' ); ?></label>
  523. <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>"
  524. name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>"/>
  525. </p>
  526. <p>
  527. <label
  528. for="<?php echo $this->get_field_id( 'source' ); ?>"><?php _e( 'Select Content Source', 'ultimatum' ); ?></label>
  529. <select class="widefat" name="<?php echo $this->get_field_name( 'source' ); ?>"
  530. id="<?php echo $this->get_field_id( 'source' ); ?>">
  531. <optgroup label="Post Type">
  532. <?php
  533. $args = array( 'public' => true, 'publicly_queryable' => true );
  534. $post_types = get_post_types( $args, 'names' );
  535. foreach ( $post_types as $post_type ) {
  536. if ( $post_type != 'attachment' ) {
  537. echo '<option value="ptype-' . $post_type . '" ' . selected( $source, 'ptype-' . $post_type, false ) . '>' . $post_type . '</option>';
  538. }
  539. }
  540. ?>
  541. </optgroup>
  542. <?php
  543. $entries = get_categories( 'title_li=&orderby=name&hide_empty=0' );
  544. if ( count( $entries ) >= 1 ) {
  545. echo '<optgroup label="Categories(Post)">';
  546. foreach ( $entries as $key => $entry ) {
  547. echo '<option value="cat-' . $entry->term_id . '" ' . selected( $source, 'cat-' . $entry->term_id, false ) . '>' . $entry->name . '</option>';
  548. }
  549. echo '</optgroup>';
  550. }
  551. ?>
  552. <?php
  553.  
  554. $termsql = "SELECT * FROM $termstable";
  555. $termresult = $wpdb->get_results( $termsql, ARRAY_A );
  556. foreach ( $termresult as $term ) {
  557. $properties = unserialize( $term['properties'] );
  558. echo '<optgroup label="' . $properties['label'] . '(' . $term['pname'] . ')">';
  559. $entries = get_terms( $properties['name'], 'orderby=name&hide_empty=0' );
  560. foreach ( $entries as $key => $entry ) {
  561. $optiont = 'taxonomy-' . $term['pname'] . '|' . $properties['name'] . '|' . $entry->slug;
  562. echo '<option value="' . $optiont . '" ' . selected( $source, $optiont, false ) . '>' . $entry->name . '</option>';
  563. }
  564. echo '</optgroup>';
  565. }
  566.  
  567. ?>
  568. </select>
  569. </p>
  570. <p>
  571. <label for="<?php echo $this->get_field_id( 'mtitle' ); ?>"><?php _e( 'Show Article Titles', 'ultimatum' ) ?></label>
  572. <select class="widefat" name="<?php echo $this->get_field_name( 'mtitle' ); ?>"
  573. id="<?php echo $this->get_field_id( 'mtitle' ); ?>">
  574. <option value="true" <?php selected( $mtitle, 'true' ); ?>>ON</option>
  575. <option value="false" <?php selected( $mtitle, 'false' ); ?>>OFF</option>
  576. </select>
  577. </p>
  578. <!-- CF1.0:Start - Add fields in form to capture filter configuration -->
  579. <fieldset>
  580. <legend>Post Filter by Custom fields</legend>
  581. <p>
  582. <label
  583. for="<?php echo $this->get_field_id( 'filterCFKey' ); ?>"><?php _e( 'Custom Field Name', 'ultimatum' ) ?>
  584. </label>
  585. <input class="widefat" id="<?php echo $this->get_field_id( 'filterCFKey' ); ?>"
  586. name="<?php echo $this->get_field_name( 'filterCFKey' ); ?>" type="text" value="<?php echo $filterCFKey; ?>"/>
  587. </p>
  588. <p>
  589. <label
  590. for="<?php echo $this->get_field_id( 'filterCFValue' ); ?>"><?php _e( 'Custom Field value', 'ultimatum' ) ?>
  591. </label>
  592. <input class="widefat" id="<?php echo $this->get_field_id( 'filterCFValue' ); ?>"
  593. name="<?php echo $this->get_field_name( 'filterCFValue' ); ?>" type="text" value="<?php echo $filterCFValue; ?>"/>
  594.  
  595. <label for="<?php echo $this->get_field_id('filterCFParentAttr'); ?>"><?php _e('Or Use Field value from Parent Post', 'ultimatum') ?></label>
  596. <select class="widefat" name="<?php echo $this->get_field_name('filterCFParentAttr'); ?>" id="<?php echo $this->get_field_id('filterCFParentAttr'); ?>">
  597. <option value="false" <?php selected($filterCFParentAttr, 'false'); ?>><?php _e('None', 'ultimatum') ?></option>
  598. <option value="post-id" <?php selected($filterCFParentAttr, 'post-id'); ?>><?php _e('Post ID', 'ultimatum') ?></option>
  599. </select>
  600. <i>If this loop is displayed on Single Post then attributes from it will be used. If set, 'Custom Field Value' will be ignored.</i>
  601. </p>
  602.  
  603. </fieldset>
  604. <!-- CF1.0:End -->
  605. <p>
  606. <label for="<?php echo $this->get_field_id( 'perpage' ); ?>"><?php _e( 'Items Count', 'ultimatum' ) ?></label>
  607. <input class="widefat" type="text" value="<?php echo $perpage; ?>" name="<?php echo $this->get_field_name( 'perpage' ); ?>"
  608. id="<?php echo $this->get_field_id( 'perpage' ); ?>"/>
  609. </p>
  610.  
  611. <p>
  612. <label
  613. for="<?php echo $this->get_field_id( 'looporder1' ); ?>"><?php _e( 'Loop Order first', 'ultimatum' ) ?>
  614. </label>
  615. <select class="widefat" name="<?php echo $this->get_field_name( 'looporder1' ); ?>"
  616. id="<?php echo $this->get_field_id( 'looporder1' ); ?>">
  617. <option
  618. value='' <?php selected( $looporder1, '' ); ?>><?php _e( 'None', 'ultimatum' ) ?></option>
  619. <option
  620. value='ID' <?php selected( $looporder1, 'ID' ); ?>><?php _e( 'ID', 'ultimatum' ) ?></option>
  621. <option
  622. value='author' <?php selected( $looporder1, 'author' ); ?>><?php _e( 'author', 'ultimatum' ) ?></option>
  623. <option
  624. value='title' <?php selected( $looporder1, 'title' ); ?>><?php _e( 'title', 'ultimatum' ) ?></option>
  625. <option
  626. value='name' <?php selected( $looporder1, 'name' ); ?>><?php _e( 'name', 'ultimatum' ) ?></option>
  627. <option
  628. value='date' <?php selected( $looporder1, 'date' ); ?>><?php _e( 'date {default}', 'ultimatum' ) ?></option>
  629. <option
  630. value='modified' <?php selected( $looporder1, 'modified' ); ?>><?php _e( 'modified', 'ultimatum' ) ?></option>
  631. <option
  632. value='parent' <?php selected( $looporder1, 'parent' ); ?>><?php _e( 'parent', 'ultimatum' ) ?></option>
  633. <option
  634. value='rand' <?php selected( $looporder1, 'rand' ); ?>><?php _e( 'rand', 'ultimatum' ) ?></option>
  635. <option
  636. value='comment_count' <?php selected( $looporder1, 'comment_count' ); ?>><?php _e( 'comment_count', 'ultimatum' ) ?></option>
  637. <option
  638. value='menu_order' <?php selected( $looporder1, 'menu_order' ); ?>><?php _e( 'menu_order', 'ultimatum' ) ?></option>
  639. </select>
  640. </p>
  641.  
  642. <p>
  643. <label
  644. for="<?php echo $this->get_field_id( 'looporder2' ); ?>"><?php _e( 'Loop Order second', 'ultimatum' ) ?>
  645. </label>
  646. <select class="widefat" name="<?php echo $this->get_field_name( 'looporder2' ); ?>"
  647. id="<?php echo $this->get_field_id( 'looporder2' ); ?>">
  648. <option
  649. value='' <?php selected( $looporder2, '' ); ?>><?php _e( 'None', 'ultimatum' ) ?></option>
  650. <option
  651. value='ID' <?php selected( $looporder2, 'ID' ); ?>><?php _e( 'ID', 'ultimatum' ) ?></option>
  652. <option
  653. value='author' <?php selected( $looporder2, 'author' ); ?>><?php _e( 'author', 'ultimatum' ) ?></option>
  654. <option
  655. value='title' <?php selected( $looporder2, 'title' ); ?>><?php _e( 'title', 'ultimatum' ) ?></option>
  656. <option
  657. value='name' <?php selected( $looporder2, 'name' ); ?>><?php _e( 'name', 'ultimatum' ) ?></option>
  658. <option
  659. value='date' <?php selected( $looporder2, 'date' ); ?>><?php _e( 'date {default}', 'ultimatum' ) ?></option>
  660. <option
  661. value='modified' <?php selected( $looporder2, 'modified' ); ?>><?php _e( 'modified', 'ultimatum' ) ?></option>
  662. <option
  663. value='parent' <?php selected( $looporder2, 'parent' ); ?>><?php _e( 'parent', 'ultimatum' ) ?></option>
  664. <option
  665. value='rand' <?php selected( $looporder2, 'rand' ); ?>><?php _e( 'rand', 'ultimatum' ) ?></option>
  666. <option
  667. value='comment_count' <?php selected( $looporder2, 'comment_count' ); ?>><?php _e( 'comment_count', 'ultimatum' ) ?></option>
  668. <option
  669. value='menu_order' <?php selected( $looporder2, 'menu_order' ); ?>><?php _e( 'menu_order', 'ultimatum' ) ?></option>
  670. </select>
  671. </p>
  672.  
  673. <p>
  674. <label for="<?php echo $this->get_field_id( 'orderdir' ); ?>"><?php _e( 'Order Direction', 'ultimatum' ) ?>
  675. </label>
  676. <select class="widefat" name="<?php echo $this->get_field_name( 'orderdir' ); ?>"
  677. id="<?php echo $this->get_field_id( 'orderdir' ); ?>">
  678. <option
  679. value='DESC' <?php selected( $orderdir, 'DESC' ); ?>><?php _e( 'Descending', 'ultimatum' ) ?></option>
  680. <option
  681. value='ASC' <?php selected( $orderdir, 'ASC' ); ?>><?php _e( 'Ascending', 'ultimatum' ) ?></option>
  682.  
  683. </select>
  684. </p>
  685.  
  686. <?php ultimatum_custcontent_inptext( 'skip', $skip, __('Skip first','ultimatum'), $this, '3' ); ?> Posts...
  687.  
  688. <p>
  689. <label for="<?php echo $this->get_field_id( 'multiple' ); ?>"><?php _e( 'Loop Layout', 'ultimatum' ) ?>
  690. </label>
  691. <select class="widefat" name="<?php echo $this->get_field_name( 'multiple' ); ?>"
  692. id="<?php echo $this->get_field_id( 'multiple' ); ?>">
  693. <?php
  694. if (file_exists(THEME_LOOPS_DIR . '/extraloops.php')) {
  695. include(THEME_LOOPS_DIR . '/extraloops.php');
  696. foreach ($extraloops as $loops) {
  697. ?>
  698. <option
  699. value="<?php echo $loops["file"]; ?>" <?php selected($multiple, $loops["file"]); ?>><?php _e($loops["name"], 'ultimatum') ?></option>
  700. <?php
  701. }
  702. }
  703. if(is_plugin_active( 'wonderloops/wonderloops.php' )) {
  704. $theme_loops_dir = @opendir(ULTLOOPBUILDER_DIR);
  705. $loop_files = array();
  706. if ($theme_loops_dir) {
  707. while (($file = readdir($theme_loops_dir)) !== false) {
  708. if (substr($file, 0, 1) == '.') {
  709. continue;
  710. }
  711. if (substr($file, -4) == '.php') {
  712. $loop_files[] = $file;
  713. }
  714. }
  715. }
  716. @closedir($theme_loops_dir);
  717.  
  718. if ($theme_loops_dir && !empty($loop_files)) {
  719. foreach ($loop_files as $loop_file) {
  720. if (is_readable(ULTLOOPBUILDER_DIR . "/$loop_file")) {
  721. unset($data);
  722. $data = ultimatum_get_loop_files(ULTLOOPBUILDER_DIR . "/$loop_file");
  723.  
  724. if (isset($data['generator']) && !empty($data['generator'])) {
  725. ?>
  726. <option
  727. value="<?php echo $data["file"]; ?>" <?php selected($multiple, $data["file"]); ?>><?php _e($data["name"], 'ultimatum') ?></option>
  728. <?php
  729. }
  730. }
  731. }
  732. }
  733. }
  734. ?>
  735. <option
  736. value="1-col-i" <?php selected( $multiple, '1-col-i' ); ?>><?php _e( 'One Column With Full Image', 'ultimatum' ) ?></option>
  737. <option
  738. value="1-col-li" <?php selected( $multiple, '1-col-li' ); ?>><?php _e( 'One Column With Image On Left', 'ultimatum' ) ?></option>
  739. <option
  740. value="1-col-ri" <?php selected( $multiple, '1-col-ri' ); ?>><?php _e( 'One Column With Image On Right', 'ultimatum' ) ?></option>
  741. <option
  742. value="1-col-gl" <?php selected( $multiple, '1-col-gl' ); ?>><?php _e( 'One Column Gallery With Image On Left', 'ultimatum' ) ?></option>
  743. <option
  744. value="1-col-gr" <?php selected( $multiple, '1-col-gr' ); ?>><?php _e( 'One Column Gallery With Image On Right', 'ultimatum' ) ?></option>
  745. <option
  746. value="1-col-n" <?php selected( $multiple, '1-col-n' ); ?>><?php _e( 'One Column With No Image', 'ultimatum' ) ?></option>
  747. <option
  748. value="2-col-i" <?php selected( $multiple, '2-col-i' ); ?>><?php _e( 'Two Columns With Image', 'ultimatum' ) ?></option>
  749. <option
  750. value="2-col-g" <?php selected( $multiple, '2-col-g' ); ?>><?php _e( 'Two Columns Gallery', 'ultimatum' ) ?></option>
  751. <option
  752. value="2-col-n" <?php selected( $multiple, '2-col-n' ); ?>><?php _e( 'Two Columns With No Image', 'ultimatum' ) ?></option>
  753. <option
  754. value="3-col-i" <?php selected( $multiple, '3-col-i' ); ?>><?php _e( 'Three Columns With Image', 'ultimatum' ) ?></option>
  755. <option
  756. value="3-col-g" <?php selected( $multiple, '3-col-g' ); ?>><?php _e( 'Three Columns Gallery', 'ultimatum' ) ?></option>
  757. <option
  758. value="3-col-n" <?php selected( $multiple, '3-col-n' ); ?>><?php _e( 'Three Columns With No Image', 'ultimatum' ) ?></option>
  759. <option
  760. value="4-col-i" <?php selected( $multiple, '4-col-i' ); ?>><?php _e( 'Four Columns With Image', 'ultimatum' ) ?></option>
  761. <option
  762. value="4-col-g" <?php selected( $multiple, '4-col-g' ); ?>><?php _e( 'Four Columns Gallery', 'ultimatum' ) ?></option>
  763. <option
  764. value="4-col-n" <?php selected( $multiple, '4-col-n' ); ?>><?php _e( 'Four Columns With No Image', 'ultimatum' ) ?></option>
  765. </select>
  766. </p>
  767. <p>
  768. <label for="<?php echo $this->get_field_id( 'mnoimage' ); ?>"><?php _e( 'No Image', 'ultimatum' ) ?>
  769. </label>
  770. <select class="widefat" name="<?php echo $this->get_field_name( 'mnoimage' ); ?>"
  771. id="<?php echo $this->get_field_id( 'mnoimage' ); ?>">
  772. <option value="true" <?php selected( $mnoimage, 'true' ); ?>>Show Placeholder</option>
  773. <option value="false" <?php selected( $mnoimage, 'false' ); ?>>OFF</option>
  774. </select>
  775. </p>
  776. <p>
  777. <label for="<?php echo $this->get_field_id( 'mimgpos' ); ?>"><?php _e( 'Image Position', 'ultimatum' ) ?>
  778. </label> <i>For Full image and columns 2 or 2+</i>
  779. <select class="widefat" name="<?php echo $this->get_field_name( 'mimgpos' ); ?>"
  780. id="<?php echo $this->get_field_id( 'mimgpos' ); ?>">
  781. <option
  782. value="atitle" <?php selected( $mimgpos, 'atitle' ); ?>><?php _e( 'After Title', 'ultimatum' ) ?></option>
  783. <option
  784. value="btitle" <?php selected( $mimgpos, 'btitle' ); ?>><?php _e( 'Before Title', 'ultimatum' ) ?></option>
  785.  
  786.  
  787. </select>
  788. </p>
  789. <p>
  790. <label
  791. for="<?php echo $this->get_field_id( 'mvideo' ); ?>"><?php _e( 'Replace Featured Image with gallery or Video', 'ultimatum' ) ?>
  792. </label> <i>Works for non Gallery views only</i>
  793. <select class="widefat" name="<?php echo $this->get_field_name( 'mvideo' ); ?>"
  794. id="<?php echo $this->get_field_id( 'mvideo' ); ?>">
  795. <option value="true" <?php selected( $mvideo, 'true' ); ?>>ON</option>
  796. <option value="false" <?php selected( $mvideo, 'false' ); ?>>OFF</option>
  797. </select>
  798. </p>
  799. <p>
  800. <label for="<?php echo $this->get_field_id( 'excerpt' ); ?>"><?php _e( 'Show Content As', 'ultimatum' ) ?>
  801. </label>
  802. <select class="widefat" name="<?php echo $this->get_field_name( 'excerpt' ); ?>"
  803. id="<?php echo $this->get_field_id( 'excerpt' ); ?>">
  804. <option value="true" <?php selected( $excerpt, 'true' ); ?>>Excerpt</option>
  805. <option value="content" <?php selected( $excerpt, 'content' ); ?>>Content</option>
  806. <option value="false" <?php selected( $excerpt, 'false' ); ?>>OFF</option>
  807. </select>
  808. </p>
  809. <p>
  810. <label
  811. for="<?php echo $this->get_field_id( 'excerptlength' ); ?>"><?php _e( 'Excerpt Length(chars)', 'ultimatum' ) ?>
  812. </label>
  813. <input class="widefat" type="text" value="<?php echo $excerptlength; ?>"
  814. name="<?php echo $this->get_field_name( 'excerptlength' ); ?>"
  815. id="<?php echo $this->get_field_id( 'excerptlength' ); ?>"/>
  816. </p>
  817. <p>
  818. <label for="<?php echo $this->get_field_id( 'multiplew' ); ?>"><?php _e( 'Image Width', 'ultimatum' ) ?>
  819. </label>
  820. <input class="widefat" type="text" value="<?php echo $multiplew; ?>"
  821. name="<?php echo $this->get_field_name( 'multiplew' ); ?>"
  822. id="<?php echo $this->get_field_id( 'multiplew' ); ?>"/><i>Applied on Image on Left/Right Aligned
  823. pages</i>
  824. </p>
  825. <p>
  826. <label for="<?php echo $this->get_field_id( 'multipleh' ); ?>"><?php _e( 'Image Height', 'ultimatum' ) ?>
  827. </label>
  828. <input class="widefat" type="text" value="<?php echo $multipleh; ?>"
  829. name="<?php echo $this->get_field_name( 'multipleh' ); ?>"
  830. id="<?php echo $this->get_field_id( 'multipleh' ); ?>"/>
  831. </p>
  832. <p>
  833. <label for="<?php echo $this->get_field_id( 'mcats' ); ?>"><?php _e( 'Taxonomy', 'ultimatum' ) ?></label>
  834. <select class="widefat" name="<?php echo $this->get_field_name( 'mcats' ); ?>"
  835. id="<?php echo $this->get_field_id( 'mcats' ); ?>">
  836. <option
  837. value="ameta" <?php selected( $mcats, 'ameta' ); ?>><?php _e( 'After Meta', 'ultimatum' ) ?></option>
  838. <option
  839. value="acontent" <?php selected( $mcats, 'acontent' ); ?>><?php _e( 'After Content', 'ultimatum' ) ?></option>
  840. <option value="false" <?php selected( $mcats, 'false' ); ?>>OFF</option>
  841. </select>
  842. </p>
  843. <p>
  844. <label for="<?php echo $this->get_field_id( 'mmeta' ); ?>"><?php _e( 'Meta', 'ultimatum' ) ?></label>
  845. <select class="widefat" name="<?php echo $this->get_field_name( 'mmeta' ); ?>"
  846. id="<?php echo $this->get_field_id( 'mmeta' ); ?>">
  847. <option
  848. value="atitle" <?php selected( $mmeta, 'atitle' ); ?>><?php _e( 'After Title', 'ultimatum' ) ?></option>
  849. <option
  850. value="aimage" <?php selected( $mmeta, 'aimage' ); ?>><?php _e( 'After Image', 'ultimatum' ) ?></option>
  851. <option
  852. value="atext" <?php selected( $mmeta, 'atext' ); ?>><?php _e( 'After Content', 'ultimatum' ) ?></option>
  853. <option value="false" <?php selected( $mmeta, 'false' ); ?>>OFF</option>
  854. </select>
  855. </p>
  856. <fieldset>
  857. <legend>Post Meta Properties</legend>
  858. <p>
  859. <label
  860. for="<?php echo $this->get_field_id( 'mmseperator' ); ?>"><?php _e( 'Meta Seperator', 'ultimatum' ) ?>
  861. </label>
  862. <input name="<?php echo $this->get_field_name( 'mmseperator' ); ?>"
  863. id="<?php echo $this->get_field_id( 'mmseperator' ); ?>" value="<?php echo $mmseperator; ?>"/>
  864. </p>
  865.  
  866. <p>
  867. <label for="<?php echo $this->get_field_id( 'mdate' ); ?>"><?php _e( 'Date', 'ultimatum' ) ?></label>
  868. <select name="<?php echo $this->get_field_name( 'mdate' ); ?>"
  869. id="<?php echo $this->get_field_id( 'mdate' ); ?>">
  870. <option value="true" <?php selected( $mdate, 'true' ); ?>>ON</option>
  871. <option value="false" <?php selected( $mdate, 'false' ); ?>>OFF</option>
  872. </select>
  873. <?php ultimatum_custcontent_inpcheckbox( 'mshowtime', $mshowtime, 'Show time', $this ); ?>
  874. <label for="<?php echo $this->get_field_id( 'mauthor' ); ?>"><?php _e( 'Author', 'ultimatum' ) ?>
  875. </label>
  876. <select name="<?php echo $this->get_field_name( 'mauthor' ); ?>"
  877. id="<?php echo $this->get_field_id( 'mauthor' ); ?>">
  878. <option value="true" <?php selected( $mauthor, 'true' ); ?>>ON</option>
  879. <option value="false" <?php selected( $mauthor, 'false' ); ?>>OFF</option>
  880. </select>
  881.  
  882. <label for="<?php echo $this->get_field_id( 'mcomments' ); ?>"><?php _e( 'Comments', 'ultimatum' ) ?>
  883. </label>
  884. <select name="<?php echo $this->get_field_name( 'mcomments' ); ?>"
  885. id="<?php echo $this->get_field_id( 'mcomments' ); ?>">
  886. <option value="true" <?php selected( $mcomments, 'true' ); ?>>ON</option>
  887. <option value="false" <?php selected( $mcomments, 'false' ); ?>>OFF</option>
  888. </select>
  889. </p>
  890. </fieldset>
  891. <p>
  892. <label for="<?php echo $this->get_field_id( 'mreadmore' ); ?>"><?php _e( 'Read More Link', 'ultimatum' ) ?>
  893. </label>
  894. <select class="widefat" name="<?php echo $this->get_field_name( 'mreadmore' ); ?>"
  895. id="<?php echo $this->get_field_id( 'mreadmore' ); ?>">
  896. <option
  897. value="right" <?php selected( $mreadmore, 'right' ); ?>><?php _e( 'Right Aligned', 'ultimatum' ) ?></option>
  898. <option
  899. value="left" <?php selected( $mreadmore, 'left' ); ?>><?php _e( 'Left Aligned', 'ultimatum' ) ?></option>
  900. <option value="false" <?php selected( $mreadmore, 'false' ); ?>>OFF</option>
  901. </select>
  902. </p>
  903. <p>
  904. <label
  905. for="<?php echo $this->get_field_id( 'rmtext' ); ?>"><?php _e( 'Read More Text', 'ultimatum' ) ?></label>
  906. <select class="widefat" name="<?php echo $this->get_field_name( 'rmtext' ); ?>"
  907. id="<?php echo $this->get_field_id( 'rmtext' ); ?>">
  908. <option
  909. value="Read More" <?php selected( $rmtext, 'Read More' ); ?>><?php _e( 'Read More', 'ultimatum' ) ?></option>
  910. <option value="More" <?php selected( $rmtext, 'More' ); ?>><?php _e( 'More', 'ultimatum' ) ?></option>
  911. <option
  912. value="Continue Reading" <?php selected( $rmtext, 'Continue Reading' ); ?>><?php _e( 'Continue Reading', 'ultimatum' ) ?></option>
  913. <option
  914. value="Continue" <?php selected( $rmtext, 'Continue' ); ?>><?php _e( 'Continue', 'ultimatum' ) ?></option>
  915. <option
  916. value="Details" <?php selected( $rmtext, 'Details' ); ?>><?php _e( 'Details', 'ultimatum' ) ?></option>
  917.  
  918. </select>
  919. </p>
  920. <p>
  921. <label for="<?php echo $this->get_field_id('pagination'); ?>"><?php _e('Pagination', 'ultimatum') ?></label>
  922. <select class="widefat" name="<?php echo $this->get_field_name('pagination'); ?>" id="<?php echo $this->get_field_id('pagination'); ?>">
  923. <option value="false" <?php selected($pagination, 'false'); ?>><?php _e('None', 'ultimatum') ?></option>
  924. <option value="true" <?php selected($pagination, 'true'); ?>><?php _e('Show', 'ultimatum') ?></option>
  925. </select>
  926. </p>
  927. <?php
  928. if ( is_plugin_active( 'search-filter-pro/search-filter-pro.php' ) ) {
  929.  
  930. query_posts(array('post_type' => 'search-filter-widget', 'posts_per_page' => -1));
  931. $result = array();
  932. if (have_posts()) :
  933. $ult_slide = array();
  934. while (have_posts()) : the_post();
  935. $sfpros = array('id' => get_the_ID(), 'title' => the_title('', '', false));
  936. $result[] = $sfpros;
  937. unset($sfpros);
  938. endwhile;
  939. endif;
  940. // print_r($result);
  941. wp_reset_query();
  942. ?>
  943. <p>
  944. <label
  945. for="<?php echo $this->get_field_id('sfpro'); ?>"><?php _e('Search and Filter Pro Filter ID', 'ultimatum') ?></label>
  946. <select class="widefat" name="<?php echo $this->get_field_name('sfpro'); ?>"
  947. id="<?php echo $this->get_field_id('sfpro'); ?>">
  948. <option
  949. value="-1" <?php selected($sfpro, '-1'); ?>><?php _e('Select if you want to apply a S&F Pro filter', 'ultimatum'); ?></option>
  950. <?php
  951. if (is_array($result) && count($result) != 0) {
  952. foreach ($result as $f) {
  953. ?>
  954. <option
  955. value="<?php echo $f["id"]; ?>" <?php selected($sfpro, $f["id"]); ?>><?php echo $f["title"]; ?></option>
  956. <?php
  957. }
  958. }
  959. ?>
  960. </select>
  961. </p>
  962. <?php
  963. }
  964. }
  965.  
  966. }
  967.  
  968. add_action( 'widgets_init', create_function( '', 'return register_widget("UltimatumCustomContentWithCFFilter");' ) );
  969.  
  970. function ultimatum_custcontent_inpcheckbox( $fieldid, &$currval, $title, &$that ) {
  971. // ech( $fieldid, $currval);
  972. ?>
  973.  
  974. <label for="<?php echo $that->get_field_id( $fieldid ); ?>"><?php echo $title ; ?></label>
  975. <input id="<?php echo $that->get_field_id( $fieldid ); ?>" name="<?php echo $that->get_field_name( $fieldid ); ?>"
  976. type="checkbox" value="1" <?php checked( $currval, 1, true ); ?> />
  977.  
  978. <?php
  979. } // end ultimatum_inpcheckbox
  980.  
  981. function ultimatum_custcontent_inptext( $fieldid, &$currval, $title, &$that, $size = '' ) {
  982.  
  983. $format = '';
  984.  
  985. if ( $size !== '' ) {
  986. $format = ' size="' . $size . '" ';
  987. }
  988.  
  989. ?>
  990.  
  991. <label for="<?php echo $that->get_field_id( $fieldid ); ?>"><?php echo $title ?>:</label>
  992. <input type="text" name="<?php echo $that->get_field_name( $fieldid ); ?>"
  993. id="<?php echo $that->get_field_id( $fieldid ); ?>" value="<?php echo $currval; ?>" <?php echo $format; ?> />
  994.  
  995.  
  996. <?php
  997.  
  998. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement