Search results not showing full post, only excerpt (Wordpress) - wordpress

this is my first time posting on this site so apologies if the question isn't totally appropriate but I'm building a portfolio site for my brother who is a composer and he needs his music library to be able to be checkbox filter-able. The problem is that when I conduct a search with filters, the results show only the excerpt, and not the audio player like I need.
Library page displaying the full posts with audio player
Search results page showing just the post title and nothing else
Also, excuse the sheer crudeness of the site. I just started it this morning... Thanks in advance!

To show the full content you have to use the_content function, in your search.php file replace the following
<?php the_excerpt(); // partial content ?>
with
<?php the_content(); // full content ?>
Also remember. the_excerpt function strips out all HTML tags so it could be a problem, you can read this article.

Related

Wordpress: Passing $tags to [shortcode] in sidebar for dynamic content relevant to current page

I'm using Testimonials Widget shortcode, which uses a custom post type for its content. I'm trying to put it in the sidebar displaying testimonials which share tags with the current post, and in the case of pages just display all in a rotator (testimonials_widget) rather than a list (testimonials_list). So far I can't even get this part of it to work.
<?php
if ($all_the_tags);
$all_the_tags = get_the_tags();
foreach($all_the_tags as $this_tag) {
echo do_shortcode('[testimonialswidget_list tags="<?php echo $this_tag->name; ?>" limit=2]');
}
?>
I realized after it went up that of course this wouldn't work - it's parsing through all the tags and showing every testimonial regardless, repeating as many times as there are tags. But at least on the posts without tags, it's not showing anything - so I know at least some of the code is working.
Total PHP newbie here (well I've been working with it for years but I'm still no good at it obviously) so bear with me please, and use simple words ;)

Wordpress search results on external page

I have a custom search engine on a non-wordpress page. This search engine searches a database for a city (specified by a text input) and then returns the relevant information about that city and displays it on the page.
What I want to do now, is to below those results, display the results of a wordpress search of the same term on a blog that resides on the same server/domain. So basically I want to show the same results that a wordpress search of that keyword would return, but I want to display them on a non-wordpress page, not in the blog's theme.
What I have:
a variable holding a search term, the search term has already been shampooed and conditioned to be search engine friendly.
What I don't want to do
I don't want to use an iframe and have the blog template be displayed on the page.
I can't have a secondary search box. I need to somehow use the value of the variable that I have, I can't ask the user to submit a second form or anything.
My ideas so far
Is there a way to run the wordpress search function and grab the data that it returns? I've gotten as far as including wp_blog_header.php on my static page so that I can make use of the wordpress functions.
Or would it be better to write a function that duplicates what the wordpress search does on the wordpress databases, but returns the data in a way that I can use?
Or is there a different approach that I should take for this that I've overlooked? Thanks!
You must first include the Wordpress files
<?php define('WP_USE_THEMES', false);
require('/server/path/to/your/wordpress/site/htdocs/blog/wp-blog-header.php');
then use query_posts and the loop
query_posts('s='.keyword);
while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<p>Read more...</p><?php
endwhile;

Wordpress Embedded Videos in Post versus Template

I've tried creating a post with a video embedded into the post (e.g. html instead of visual), and at the same time also insert an embed code into the template (e.g. single.php) The source view of those two code look identical in format, two videos are both visible on the page, yet only one video shows in RSS feed. The one that's embedded into the post.
Anyone knows why this is happening? I want my video to be called using a function, and still work in RSS, but I don't think I can do that unless... I know the differences? At least maybe I'll know what other operation I'm missing.
If you're embedding the video in single.php, you may have put it outside of the loop, ie. outside of
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
(more of the loop)
<?php endif; ?>
and as result not showing up in RSS.
If it's in the post via the post editor, it's inside the loop and available as RSS as a single post.
If you need to execute php in a post/page, there are plugins for that.

Alternatively presentation of the archive

I'm searching for an alternativ view of the archiv output page.
So if you click on a archiv link you get a view e.g. of the Month.
And exactly this Page where i get the filtered output i want to apply some changes.
So i mean not:
wp_get_archives()
Best regards Illu
If you just want to make a few small changes, then just filter it with the wordpress function is_archive(), e.g.
<?php if (is_archive()) { ?>
Say hello to the archeologist users
<?php } ?>
...otherwise, if you want to have a completly different template for that page, then just create a file called archive.php in your theme directory. Hope I understood your question right :)
Some more resources for the is_archive() function is to be found here - well explained examples. And some more information about template files are here

adding single.php page to wordpress or if condition for main page or post detail page

I use Barecity Theme for WordPress. i built everything, but now i need to add a single.php file to theme. now it displays all post content at homepage, I created a short_desc Custom Field. and I call it from code with;
<?php //get_post_meta($post->ID, 'short_desc', true); ?>
it is fine. but i need to display this short desc at home page listing, and the main content at details page. how can do that?
I appreciate helps!!
It sounds like what you are trying to do is show a custom field that you have set on a post on the index page (which lists all the posts).
To do that you'll need to modify index.php by adding your snippet where you would like to have the short description.
<?php echo get_post_meta($post->ID, 'short_desc', true); ?>
You need to use echo to display the results from the get_post_meta function.
Depending on how your posts are setup you can also use the More button when you write your posts. This will cut off your post at a certain point that you decide and only show that short part on the index and archive pages.
Another option would be to use
<?php the_excerpt(); ?>
Which shows the first 55 words (this can be adjusted though) of the post.
Hope that helps,
Paul

Resources