I need to display the spotify preview along with the post thumbnail on the archive page.
It doesn't necessarily have to embedded on the Excerpt, but I'm wondering how is it possible to create a iframe per post which is easy to mantain (using a simple posting system)
2 things I can think about - 1st you can actually create your iFrame inside the archive.php and the excerpt field to be just the url, so inside the file you can have something like:
//the loop
...//some content
<iframe src="<?=get_the_excerpt()?>"></iframe>
...//more content
//end loop
2nd thing I can think about is too use some pluging to add extra fields to your posts which you can call. I personally like CMB2 they have a really good documentation and all sorts of custom fields you can add to your posts.
Related
There is Post that have certain data could be viewed in blog nav-menu that is using index.php and for the single post it retrieves data from single.php. I also have another custom post type that is client could be viewed from Our- client nav menu and it is using client template. Now the problem is i also want a custom single page for single client so i am using single-client.php but when i click to any client it leads to single.php not single-client. php.
You can use single.php and both post types will use it, as long as you remove the other two files from your theme.
Then you could fetch different template parts depending on the post type being queried.
However you do it, you're going to need separate files with stuff for the two different post types, unless the to are going to have the exact same design.
EDIT
I think I may have misunderstood.
Is your issue that the single posts are not displaying, but you want to keep using the two separate single templates?
In that case, make sure the post types are called blog and client.
To check, go to each post type's section in the admin panel. On each of these pages check the post_type URL parameter in your address bar.
I'm not a super-experienced Wordpress guy, but I generally know what I'm doing, and have been programming for years.
I'm in the middle of building a fairly simple Wordpress site, but lots of posts will be added in the future by the client.
It suddenly dawned on me that all my posts are static, so if changes in design are needed they will need to be applied manually across many pages.
I've searched Google but to no avail. What I need is a plugin or method that allows me to have templates for my posts, into which the unique content for each page are added. Then, if design changes are needed, I simply edit the template and the design will change instantly across all the pages using this template.
I've found plugins which seem to offer post templates, but all they seem to do is create a new post with a pre-made design, but do not make it possible to make changes to that design which are reflected across all the posts that use that template. Maybe I'm missing something simple here, as I can't be the only WP author who wants to achieve this?
I'm not talking about dynamic content. ie I have no need to pull constantly updated data like weather or prices from an API. The content is hand-written for each page, but I would like to separate it from the design, so if design changes are needed they can be made only once from some kind of post template manager, and not individually on each page.
Actually, I'm already using the simple post-snippets plugin, and I realise that I could use this or something similar to achieve my aim, but I don't think this would be very user-friendly for non-technical authors. Instead, it would be ideal if I had a set of custom fields under each post which the authors filled in, and the content was then taken from there and inserted in the page's template.
In principle you should be able to change the design just using CSS selectors. Of course that may have its limitations but there is never a design that fits it all.
For bigger changes you will need to change the WordPress template.
Ok, after some research and poking around, this is what I've come up with.
Install the 'Advanced Custom Fields' and 'Custom Post Templates' plugins , although neither are strictly necessary.
Create a group of custom fields which defines the unique data (URL, media selector etc) for each post.
Most importantly, create a new custom post template following the instructions for the 'Custom Post Templates' plugin. In this template remove the line that outputs the post content (the_content()), and replace it with code that outputs all the shortcodes or whatever for this page type, with placeholders string replaced with the values of the custom variables for that post. Then (in my case) I do something like do_shortcode($page_template) to correctly output the correct content for that page.
I create a new post, leaving the content field completely empty, and filling in the custom field's values as required. Also, you must choose the post template, so it matches the new custom template you create.
$v=get_post_custom_values("image_url")[0];//gets the id of the post which contains the image
$image_url = wp_get_attachment_image_src($v, 'medium')[0]; //get the image (URL?) from the reference
$page_template='[one_third last="no" spacing="yes" background_color="" background_image="" background_repeat="no-repeat" background_position="left top" border_size="2px" border_color="#eaeaea" border_style="solid" padding="20px" class="" id=""][imageframe lightbox="no" style_type="none" bordercolor="" bordersize="0px" borderradius="0" stylecolor="" align="none" link="" linktarget="_self" animation_type="0" animation_direction="down" animation_speed="0.1" class="" id=""] <img src="#image_url#" alt="" />[/imageframe][fusion_text]Email Me | Website[/fusion_text][/one_third][two_third last="yes" spacing="yes" background_color="" background_image="" background_repeat="no-repeat" background_position="left top" border_size="0px" border_color="" border_style="" padding="" class="" id=""][fusion_text]#main_text_html#[/fusion_text][/two_third]';
$page_template=str_replace ( "#image_url#" , $image_url , $page_template );
echo do_shortcode($page_template);
The code above contains the page template hard-coded into the $page_template variable, but it could also be loaded by referencing the id of the post which is acting as the template.
This code currently only inserts the correct image URL. Once it's finished it will also insert the personal email link, website link, and main text.
I have a custom post type for a Slideshow which uses Custom Post Meta to insert the different slides. How can I code the <!--nextpage--> tag in between the sides in my slideshow.php so that they slides will paginate? Right now when I try to do it the code doesn't show because it by it's nature it commented out.
If the slides are each separate custom posts, the <!--nextpage--> tag won't work anyway. <!--nextpage--> is designed to add pagination to long posts ... i.e. break a long, single post (or custom post type) over multiple pages.
From the sound of things, you want a pagination setup that will work for multiple individual custom posts.
What you want is the PHP function next_post_link(). This "template tag displays a link to the next post which exists in chronological order from the current post."
I have 2 custom fields in my WordPress system when creating new posts. One is called homethumb (is the title of an image) and another called description.
I would like to edit the RSS feed so it shows the image and the description rather than the complete post.
But I don't know how to do this. I would like to fetch that RSS with simple pie to integrate it on another website (sort of auto-submit system).
You also have
do_action('rss_item')
that runs in the loop for every item in the RSS feed.
Hook in to that and output anything extra you need in to the feed item.
To show the excerpt instead of the entire article, go to "reading" in Settings section of your admin menu and half way through the options there's a setting to use excerpts instead of full text.
No plugins required. Just a little custom programming.
Custom fields for Feeds Wordpress plugin
This puts images or videos into your feeds through the use of custom
fields. You can alter the custom field Keys and what is displayed.
Update 11/27/2015: The plugin is old, but the site says it still works
I found some tutorials on how to add things to your rss reader, so I fixed this.
it's in french -> http://www.webinventif.fr/wordpress-ajouter-du-contenu-dans-son-flux/
Here is another option if you want to display anything other than images and videos in your feed: http://wordpress.org/extend/plugins/rss-custom-fields/
All of your custom fields will now be displayed in your feed.
Further options to be able to select which custom fields display in a feed will be available in subsequent releases of the plugin!
I'm implementing our school's website using WordPress as CMS. So far, it works well and I'm 80% done. Our website is basically 11 WordPress pages and a blog.
Now, there is one feature i'm not sure how to resolve. We want to have "testimonies" of past students to be displayed across WordPress pages, in a specific area of the page. They will either be videos or written text with an image.
They will be embedded on regular WordPress pages either a specific video for a specific page, or just random testimony video for a given page.
Is it possible to do that with WordPress? If so, how?
Thanks for any hints.
Alex
There are quite a few Wordpress plugins which handle testimonials gracefully:
http://wordpress.org/extend/plugins/search.php?q=testimony
You should be able to do this with categories. Create a testimony category and and then create a new template called 'testimony-page.php'. In that template, put a separate loop that pulls a random testimony from the database. Voila, page in a page.
If you feel like building this yourself, it can be handled with custom post types. Here is a great guide that will give you a lot of useful information: http://www.smashingmagazine.com/2012/11/complete-guide-custom-post-types/
I like to use this plugin:
http://wordpress.org/extend/plugins/more-types/
To manage my custom post types.
To query posts from a new post type, use something like:
query_posts({
'post_type' => 'testimonials'
});
So, if you wanted to add testimonials to your site, you'd query them like above with whatever parameters you need, and do a simple loop to output the posts.