Pluginf for Different header image on every pages in wordpress - wordpress

I need wordpress plugin for this kind of header image http://www.slb.com/services/drilling.aspx like in this web site. And this image will not be slider but it's static image on perticular page and category and also different image for all categories and pages.

Easiest & best way is create a custom field named banner & in your header.php place below code.
<div class="banner">
<?php if(get_post_meta($post->ID, 'banner', true)) : ?>
<img src="<?php echo get_post_meta($post->ID, 'banner', true); ?>" />
<?php endif; ?>
<div>
But as you want plugin to do this, have a look at plugin named Dynamic Header.

Related

Changing Default Title on WooCommerce Single Products Pages

I suppose this is something simple, but couldn't find a solution anywhere.
Currently, my website shows <h1>"Products"</h1> title on shop archive page, but on single product pages as well. Is it possible to change default title on single product pages to product name?
Here is my website. As you can see, above breadcrumbs, there is a default shop title. And there I want to display, product name instead.
<section class="<?php echo esc_attr($class_name) ?>" <?php echo wp_kses_post($bg_style); ?>>
<div class="page-title-inner">
<div class="container"><h1><?php echo esc_html($page_title); ?></h1> <?php great_store_the_breadcrumb(); ?>
</div>
</div>
</section>

Page jump on load when implementing lightbox functionality

I'm building a custom Wordpress theme locally and using Advanced Custom Fields for much of the content alongside custom post types.
I'm currently building the gallery section and want to use lightbox - the two size images are custom size featured images.
Before I add the lightbox anchor image my code looks like this:
<?php
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'featured-image-shop', true );
?>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title();?>">
</a>
However - when I then add in the lightbox images - the lightbox functionality works fine - but makes the page jump slightly on page load. The code looks like this:
<?php
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'featured-image-shop', true );
?>
<a href="<?php echo $thumbnail_url[0];?>" data-lightbox="gallery-images" data-title="<?php the_title();?>">
<img class="gallerypics" src="<?php echo $thumbnail_url[0];?>" alt="<?php the_title();?>">
</a>
Any ideas why this happens? I thought maybe it could be a javascript issue but even if I simply add an image in the anchor without the data-lightbox attribute it still jumps.
Perhaps someone has come across this issue before?
It's ok - just the act of writing this down gave an the answer so I thought I'd share for anyone who may have the same issue. I needed to add
html { overflow-x:auto; overflow-y:scroll; }
This forces the scrollbar to be there before the content is fully loaded which is why it was jumping before!

how to get the posts of a particular category from slug name when passing through url in wordpress?

I have a link with me. This is the link:
http://localhost/rajab/product-category/pvc-hose/
I have made a a category "PVC Hose" having slug name "pvc-hose" and displayed on a page. when i am clicking this category, it goes to a link as shown above.i wanted to display all the posts in this category on linked page. Can anyone say how to display it there.
Simply create a taxonomy.php file in your root folder with the following code
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
// Your markup and template tags like
the_title();
echo '</br>';
}
}
<li class="cbp-item houses cbp-l-grid-masonry-height1">
<a class="cbp-caption cbp-lightbox" data-title="PVC Air Hose" href="<?php bloginfo('template_url'); ?>/images/buiding/pvc/img1.jpg">
<div class="cbp-caption-defaultWrap">
<img src="<?php bloginfo('template_url'); ?>/images/buiding/pvc/img1.jpg" alt="">
</div>
</a>
<h4><?php $data->post_title; ?></h4>
</li>
i wanted to repeat this code in the taxonomy file..I wanted to display not only the title and content but also featured image.

Get excerpt and permalink outside loop in wordpress

I'm trying to get the post excerpt and permalink outside a wordpress loop, pulling the thumbnail and the title work fine but when trying to get the excerpt it doesn't work? And how would I get the permalink? My code so far is below.
Thanks!
<div id="featured">
<?php
$ftid = 104;
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ftid) );
?>
<img src="<?php echo $url; ?>" style="float:left;" />
<div class="featured-info">
<h2 class="post-title"><?php echo get_the_title($ftid); ?></h2>
<?php $my_post = get_post($ftid); echo $my_post->post_excerpt; ?>
</div>
</div>
And maybe if there is a better way of doing this you can point me in the right direction? :)
The permalink should work as is:
$permalink = get_permalink($ftid);
The excerpt though, when accessing the page object directly there actually has to be excerpt content (not just post content). If you didn't manually type in an excerpt on the post then nothing will appear. Inside the loop, the_excerpt() will automatically generate from the content if an excerpt hasn't been manually typed. Did you type a separate excerpt in the WP admin?
Look at wp_get_attachment_url() - you left the $ off the name of the $ftid variable.

Wordpress Customize the_content

I am quite new to Wordpress and try to customize my Wordpress theme. My posts are always different. But basically there is a title, a text and a NivoSlider/Image/Vimeo Video.
If I use the basic the_content function it displays the post like that:
<h2>Title of the Post</h2>
<p><div class="slider-wrapper">Slider</div>Text</p>
It always includes the Slider/Image/Video in the Tag. How can I split the_content object?
I would like to have my posts display like that e.g. for the NivoSlider:
<div class="slider-wrapper">Slider</div>
<h2>Title of the Post</h2>
<p><Text</p>
It would be really great if somebody could tell me the easiest way to do for all the different kinds of posts.
I hope you understand my explanation, if you need more details, just tell me.
Thanks in advanced.
Best,
Brigi
Personally, I would take the shortcode out from your Content Body altogether, and place it in a Custom Field (named something like "postSlider"). Then you can structure your template like so:
<?php
do_shortcode(get_post_meta(get_the_ID(), 'postSlider'));
?>
<h2><?php the_title(); ?></h2>
<p><?php the_content(); ?></p>
You needs to create a custom page template for your posts. In that page template you can define your slider. Then just put your text in the content section.
Before doing serious coding refer this: Stepping Into Templates
Thanks again for your answer. Finally I used the Types plugin for Wordpress. You can easily customize your own field and use it in your index.php file with the following code:
Custom Field Image:
<?php echo(types_render_field("field-slug-image", array("alt"=>"Product image", "width"=>"600","height"=>"300","proportional"=>"true"))); ?>
Shortcode Custom Field for the Slider:
<?php echo apply_filters('the_content', get_post_meta($post->ID, 'field-slug-slider', true)); ?>
Shortcode Custom Field for the Vimeo video:
<?php echo apply_filters('the_content', get_post_meta($post->ID, 'field-slug-video', true)); ?>
Title and Content:
<h2><?php the_title(); ?></h2>
<?php the_content('Read the full post',true);?>

Resources