I know that probably you have answered this questions many times but I can’t use your advices in my case.
I have the Adelle theme by Blu Chic on my blog (right now I just test different functions and make changes before I move my blog on my own hosting). I made same changes in archive.php to change how posts displays in categories and archive.
<div style="height:251px; display:block; margin:0 0 20px 0;"><h3><?php echo get_the_post_thumbnail( $post_id, array(174,251), array('class' => 'alignleft'), $attr ); ?> <?php the_title();?> </h3>
<?php the_excerpt(); ?></div>
I works but…during editing new post I have to set featured /thumbnail image. It’s not a problem. The problems show on first page because right now I have 2 images – one small and one big. Is it possible to remove thumbnail of post on main page?
I would be very grateful for your help!
Best,
Kasia
You simply need to find the CSS classes that belong to those thumbnail images on the main page and add a CSS property in the Additional CSS:
display: none
For screenshots you can check this guide: https://www.helpmegeek.com/remove-featured-thumbnails-list-pages-wordpress/
For your requirement to use two images for your post, one on the main page that is archive page and other on post detail page, you can use one best plugin available for that
http://wordpress.org/plugins/multiple-post-thumbnails/
By using Multiple Post Thumbnails plugin you can see two featured images for your post, one you can display on main page and other on post detail page or whichever section you want to display.
If you want to remove the thumbnails just delete/comment out the php code that display the thumbnail like so:
<div style="height:251px; display:block; margin:0 0 20px 0;">
<h3>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php //echo get_the_post_thumbnail( $post_id, array(174,251), array('class' => 'alignleft'), $attr ); ?> <!-- Notice the // just after the first <?php tag
</a>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php the_title();?>
</a>
</h3>
</div>
Related
I created a pop-up lightbox gallery in WordPress using Advanced Custom Fields and while all of the base functionality works, for some reason the lightbox appears to be showing all photos attached to the gallery_photos field across multiple posts instead of just the photos attached to the single post.
<?php
$images = get_field('gallery_photos');
if($images): ?>
<div class="gallery" id="post-gallery-<?php echo get_the_ID(); ?>">
<?php $i=0; foreach( $images as $image ) : ?>
<a href="<?php echo $image['url']; ?>" target="_blank" rel="lightbox" class="thumbnail">
<?php if( $i==0 ) : ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/camera-icon.png" width="30px" height="30px" alt="" border="0"/>
<?php endif; ?>
</a>
<?php $i++; endforeach; ?>
</div>
<?php endif; ?>
You can see a sample of how this is working at the following link to the dev site. There's a list of products, defined as a custom post type, and each product has an associated lightbox gallery of photos accessible via the camera icon at the end of each row.
However, if you click the icon you'll actually see photos for all products, not just the one you clicked. Any idea what I'm doing wrong?
I was curious if this would a best practice to add social media SVG icons to page and post types ( without using a plugin)?
I have added three custom fields to WordPress page and post. facebook, twitter and google plus fields I have added the WordPress provided SVG tags specific to each social media site.
wordpress page admin screenshot
here is the code that I have added to my front page where I need the social share icons to be added
<header class="entry-header-hp">
<div class="page-title-homepage">
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
<nav class="social-naviation-news" role="navigation">
<div>
<ul>
<li>
<a href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]=<?php echo urlencode(get_permalink()); ?>" target="_blank"><?php echo the_field('facebook'); ?>
</a>
</li>
<li>
<a href="https://twitter.com/intent/tweet?text=<?php echo urlencode(get_the_title()); ?>+<?php echo get_permalink(); ?>" target="_blank">
<?php echo the_field('twitter'); ?>
</a>
</li>
<li>
<a href="https://plus.google.com/share?url=<?php echo urlencode(get_permalink()); ?>" target="_blank">
<?php echo the_field('Google'); ?>
</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="entry-meta">
<?php echo the_modified_date(); ?>
</div><!-- .entry-meta -->
<div class="edit-link">
<?php twentyseventeen_edit_link( get_the_ID() ); ?>
</div>
</header><!-- .entry-header -->
As you can see the icons will display on the front page.
https//staging.rockimages.com
Is this a good approach or will this cause any problems down the line?
It wouldn't cause problem down the line but i recommend you structure the sharing element in a way that is re-usable and doesn't require bulk change on multiple pages templates. So basically make a function out of it and place it in your functions.php file of your theme. Also if you use any default Wordpress theme makes sure you copy the original and rename it or create a child theme.
Ref:
https://premium.wpmudev.org/blog/five-hacks-twenty-seventeen/#social
https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/
I have a Franchise site that I am working on. We setup at least 15 locations, and the microsite is serving well except for the fact of adding custom elements to the individual franchise locations.
How do I edit an individual microsite without having to mess with the "Network Admin" theme editor?
The Franchisee wants a block to be changed on the homepage: 'home-template.php'
Is there a way I can add the editor to the microsites?
Also, is there a way I can edit the CSS for an individual microsite?
Thank you,
Kyle
P.S. If anyone requires more information, please leave a comment, and I'll edit this question immediately.
Edit:
Here is how the block in question is being loaded from the template:
<div class="col span_4_of_12">
<?php $posts = get_posts( "category_name=home_04" ); ?>
<?php if( $posts ) : ?>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<div id="box-personal_svc_bg">
<div class="sq-label_box_gr">
<h1><a href="<?php the_permalink();?>">
<?php the_title();?>
</a></h1>
</div>
</div>
<?php endforeach; wp_reset_postdata(); ?>
<?php endif; ?>
</div>
So, the franchisee wants to change the picture for that block (which is a background css attribute, and they also want to change the link - which I believe could be changed by just changing the category of the page/post to home_04, right?)
Even though one problem was partially resolved, is there still a way I can add an editor to each microsite?
I want to display all categories with an image in wordpress homepage. I dont want to display posts in homepage. When visitors will click on that image , then he will go to that category posts. How can i do it ? Please help me.
This can be done by installing the Category Images plugin, adding images to the categories. Next add the following code to the index.php page:
<ul>
<?php foreach (get_categories() as $cat) : ?>
<li>
<a href="<?php echo get_category_link($cat->term_id); ?>">
<?php echo $cat->cat_name; ?>
<br>
<img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /></a>
</li>
<?php endforeach; ?>
</ul>
The above code will display the category name and image for each category that have a post assigned to it. Clicking on the category name or image will bring you to the category posts.
You can see here what i am doing:
http://www.arvag.net/otkrijte-svet/leto/
So its pulling 2 custom fields from child pages, one of them is just url for the image on the left, and the other field is that text showing on the right.
Now, what i want to do is to add pagination there. The code i have now will just simply show all child pages, but i want to show only 5 child pages, so if user want to see 6th child page he would have to click on link for "Page 2" and so on.
The code im using to display these child pages is this:
<?php
$pages = get_pages('child_of='.$post->ID.'&sort_column=post_title&sort_order=desc');
$count = 0;
foreach($pages as $page)
{
$short_info = get_post_meta($page->ID,'info',true);
$image = get_post_meta($page->ID,'slika',true);
$count++;
?>
<div class='preview_slika left'><img src="<?php echo $image ?>" alt="<?php echo $page->post_title ?>" /></div>
<div class='preview_info right'>
<h2><?php echo $page->post_title ?></h2>
<p><?php echo $short_info ?></p>
Više o >>
</div>
<div class='clear'></div>
<?php
}
?>
So any idea what to do to get what i need?
Take a look at wp-PageNavi plugin. And this blog post if you want to integrate it in your theme an not have another plugin to manage.
Some guy posted some sample code on wordpress forums which works much better for me than this plugin.
http://wordpress.org/support/topic/383773