<h3> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></h3> <p class="padding-top-medium padding-bottom-medium"><?php if (empty($post->post_excerpt)) { echo first_sentence($post->post_content); } else { echo $post->post_excerpt; } ?> </p> <p><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " class="button">Explore this document</a></p>
if (isset($data)) { $parameters = $data['parameters']; } else { $parameters['metas'] = '%p - %f'; } $query = $db->query("select pd.name as pname, p.price as price, cd.name as cname, pd.description as pdescription, pd.language_id as language_id, pd.product_id as product_id, p.model as model, p.sku as sku, p.upc as upc, m.name as brand from " . DB_PREFIX . "product_description pd\n\t\t\t\tleft join " . DB_PREFIX . "product_to_category pc on pd.product_id = pc.product_id\n\t\t\t\tinner join " . DB_PREFIX . "product p on pd.product_id = p.product_id\n\t\t\t\tleft join " . DB_PREFIX . "category_description cd on cd.category_id = pc.category_id and cd.language_id = pd.language_id\n\t\t\t\tleft join " . DB_PREFIX . "manufacturer m on m.manufacturer_id = p.manufacturer_id;"); foreach ($query->rows as $product) { echo 'Generating meta description for <b>' . $product['pname'] . ' (from ' . $product['cname'] . ')</b>: '; $bef = array("%", "_", "\"", "'", "\\", "\r", "\n"); $aft = array("", " ", " ", " ", "", "", ""); $ncategory = trim(mysql_real_escape_string(html_entity_decode(str_replace($bef, $aft, $product['cname']), ENT_COMPAT, "UTF-8"))); $nproduct = trim(mysql_real_escape_string(html_entity_decode(str_replace($bef, $aft, $product['pname']), ENT_COMPAT, "UTF-8"))); $model = trim(mysql_real_escape_string(html_entity_decode(str_replace($bef, $aft, $product['model']), ENT_COMPAT, "UTF-8"))); $sku = trim(mysql_real_escape_string(html_entity_decode(str_replace($bef, $aft, $product['sku']), ENT_COMPAT, "UTF-8"))); $upc = trim(mysql_real_escape_string(html_entity_decode(str_replace($bef, $aft, $product['upc']), ENT_COMPAT, "UTF-8"))); $sentence = trim(mysql_real_escape_string(html_entity_decode(str_replace($bef, $aft, first_sentence($product['pdescription'])), ENT_COMPAT, "UTF-8"))); $brand = trim(mysql_real_escape_string(html_entity_decode(str_replace($bef, $aft, $product['brand']), ENT_COMPAT, "UTF-8"))); $price = trim(mysql_real_escape_string(html_entity_decode(str_replace($bef, $aft, number_format($product['price'], 2)), ENT_COMPAT, "UTF-8"))); $bef = array("%c", "%p", "%m", "%s", "%u", "%f", "%b", "%\$"); $aft = array($ncategory, $nproduct, $model, $sku, $upc, $sentence, $brand, $price); $meta_description = str_replace($bef, $aft, $parameters['metas']); $exists = $db->query("select count(*) as times from " . DB_PREFIX . "product_description where product_id = " . $product['product_id'] . " and language_id = " . $product['language_id'] . " and meta_description not like '%" . htmlspecialchars($meta_description) . "%';"); foreach ($exists->rows as $exist) { $count = $exist['times']; } if ($count) { $db->query("update " . DB_PREFIX . "product_description set meta_description = concat(meta_description, '" . htmlspecialchars($meta_description) . "') where product_id = " . $product['product_id'] . " and language_id = " . $product['language_id'] . ";"); } echo " - " . (!$count ? "No new " : "<span style=\"color:red;\">{$meta_description}</span> ") . "meta description was added;<br>"; } }
<img src="<?php echo make_path_relative($image_url[0]); ?> " class="img-responsive" alt="<?php echo $post->post_title; ?> "> </a> <?php } ?> <?php if (has_excerpt($post->ID)) { echo the_excerpt(); } else { echo "<p>" . first_sentence(get_the_content()) . "</p>"; } ?> <?php $child_page_id = get_the_ID(); // loop through the sub-pages for each child page as grandchildren. $grandchildrenpages = new WP_Query(array('post_type' => 'page', 'post_parent' => $child_page_id, 'posts_per_page' => -1, 'cat' => 0, 'orderby' => 'menu_order date', 'order' => 'ASC')); if ($grandchildrenpages->have_posts()) { ?> <ul class="child"> <?php while ($grandchildrenpages->have_posts()) { $grandchildrenpages->the_post(); $redirect = get_post_meta($post->ID, 'redirectUrl', true); ?> <li>