public function display_archive_f($atts) { extract(shortcode_atts(array('wpargs' => '', 'cats' => ''), $atts)); $out = ""; $parse = array(); //Set up Query Arrays $query_att = $this->query; $sc_att = DTGAL_func::asc_string_to_array(htmlspecialchars_decode($wpargs)); $base_att = array("post_type" => $this->pt); if ($cats !== '' && isset($query_att['tax_query'])) { $query_att['tax_query'][0]['terms'] = explode(",", $cats); } $argOut = array_merge($sc_att, $base_att, $query_att); $this->par->reg_hooks_sc(); $out .= "<div class='" . $this->pt . "-sc-wrapper'>"; $quer = new WP_Query($argOut); while ($quer->have_posts()) { $quer->the_post(); ob_start(); do_action($this->par->name_s . 'pt_shortcode', $quer); $out .= ob_get_clean(); } wp_reset_postdata(); $out .= "</div>"; return $out; }
function DTGAL_tn_f($quer = null) { $post = DTGAL_func::get_post($quer); global $tn_img; $img_link = $tn_img->get_val(); $out = ""; if ($img_link != "" || $img_link != null) { $img_link = $tn_img->get_val(); } else { $img_link_ar = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail'); $img_link = $img_link_ar[0]; } $out .= "<div class='DTGAL-tn'>"; $out .= "<a title='" . $post->post_title . "' href='" . get_permalink($post->ID) . "'>"; $out .= "<img alt='" . $post->post_title . "' src='" . $img_link . "''>"; $out .= "</a>"; $out .= "</div>"; echo $out; }
public static function get_cats($tax, $post_slug = null, $pt = null) { $output = ""; $tax_terms = get_terms($tax); $tax_info = get_taxonomy($tax); $pID = DTGAL_func::get_id_by_slug($post_slug, $pt); if (!empty($tax_terms)) { foreach ($tax_terms as $tax_term) { if (has_term($tax_term->slug, $tax, $pID)) { $output .= "<h3>" . $tax_info->labels->name . "</h3>"; $output .= "<ul>"; break; } } foreach ($tax_terms as $tax_term) { if (has_term($tax_term->slug, $tax, $pID)) { $output .= '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $tax)) . '" title="' . sprintf(__("View all items in %s"), $tax_term->name) . '" ' . '>' . $tax_term->name . '</a></li>'; } } $output .= "</ul>"; } return $output; }
public function hook_article_start_sc($quer = null) { $post = DTGAL_func::get_post($quer); $classes = implode(" ", get_post_class("", $post->ID)); echo "<article class='" . $this->classes . " " . $classes . " ar_shortcode'>"; }
public static function pc_fimed_a($quer = null) { $post = DTGAL_func::get_post($quer); $out = ""; if (has_post_thumbnail($post->ID)) { $out .= "<div class='" . "DTGAL-image" . "'>"; $out .= "<a title='" . $post->post_title . "' href='" . get_permalink($post->ID) . "' alt='" . $post->post_title . "'>"; $out .= get_the_post_thumbnail($post->ID, 'medium'); $out .= "</a>"; $out .= "</div>"; } echo $out; }
public function render_meta_box_content($post) { // Add an nonce field so we can check for it later. wp_nonce_field($this->cust_box, $this->met_nonce); // Use get_post_meta to retrieve an existing value from the database. $value = get_post_meta($post->ID, $this->val_key, true); // Display the form, using the current value. echo '<label for="' . $this->new_field . '">'; _e("<sub>" . $this->desc . "</sub><br>", 'DTGAL_textdomain'); echo '</label> '; if ($this->type == "text") { echo '<input type="text" id="' . $this->new_field . '" name="' . $this->new_field . '"'; echo ' value="' . esc_attr($value) . '" size="25" />'; } if ($this->type == "number") { echo '<input type="number" id="' . $this->new_field . '" name="' . $this->new_field . '"'; echo ' value="' . esc_attr($value) . '" size="25" />'; } if ($this->type == "radio") { $i = 0; foreach ($this->options as $option) { if (esc_attr($value) == esc_attr($option) || $value == null && $i == 0) { $chk = "checked"; } else { $chk = ""; } echo '<input type="radio" id="' . $this->new_field . '" name="' . $this->new_field . '"'; echo ' value="' . esc_attr($option) . '" size="25" ' . $chk . ' />'; echo esc_attr($option) . "<br>"; $i++; } } if ($this->type == "textarea") { echo "<textarea style='max-width:100%; width:100%; min-height:200px;' name='" . $this->new_field . "'>" . esc_attr($value) . "</textarea>"; } if ($this->type == "color") { if ($value == "") { $value = ""; } echo '<input type="text" class="pt-color-field" id="' . $this->new_field . '" name="' . $this->new_field . '"'; echo ' value="' . esc_attr($value) . '" size="25" />'; } if ($this->type == "link") { if ($value == null) { $value = ""; } echo '<input class="cmb_text_link" type="text" size="25" id="' . $this->new_field . '" name="' . $this->new_field . '" value="' . esc_attr($value) . '" />'; echo '<input class="pt_link_button button" type="button" value="Get Link" />'; } if ($this->type == "media") { if ($value == null) { $value = ""; } if ($value !== "") { echo "<div>"; echo DTGAL_func::media_check($value); echo "</div>"; } echo "<input type='text' size='25' name=" . $this->new_field . " id=" . $this->new_field . " value=" . $value . ">"; echo "<input class='pt_image_button button' type='button' value='Upload Media' >"; } }