WordPress.org

Ready to get started?Download WordPress

Forums

WP Photo Album Plus
Confused about Searching Gallery (15 posts)

  1. CBKat
    Member
    Posted 2 years ago #

    I'm completely confused how someone searches through the gallery.

    First of all where is the search? or how do I make it appear? and when you search, what terms does it look for? Whats listed in the description or is there somewhere to insert tags of some sort?

    http://wordpress.org/extend/plugins/wp-photo-album-plus/

  2. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    There is a widget called Search Photos with the subtitle WPPA+ Search Photos.

    On the Photo Albums -> Settings admin page select in Table IX item 2 a page in which the search results have to be displayed. The page should have at least %%wppa%% in its content. Usually one has created a page - like My Album using a wide template (no sidebars) - that contains %%wppa%% only.

    Activate the widget.

    The search alorithm is explained in the FAQ section of the plugins page.

  3. CBKat
    Member
    Posted 2 years ago #

    But I'm not using a sidebar on the gallery so my images can be seen bigger...so therefor I can't use the Search Widget...is there a way to post it at the top of the photo page or something?

  4. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    Try this code in a special template that you use for the display of the photos:

    $page = get_option('wppa_search_linkpage', '0');
    if ($page == '0') {
    _e('Warning. No page defined for search results!', 'wppa');
    }
    else {
    $pagelink = wppa_dbg_url(get_page_link($page));
    ?>
    <form id="wppa_searchform" action="<?php echo($pagelink) ?>" method="post" class="widget_search">
    <div>
    <input type="text" name="wppa-searchstring" id="wppa_s" value="<?php echo($wppa_searchstring) ?>" />
    <input id = "wppa_searchsubmit" type="submit" value="<?php _e('Search', 'wppa'); ?>" />
    </div>
    </form>
    <?php
    }
  5. CBKat
    Member
    Posted 2 years ago #

    I'm sorry, I'm not entirely sure just which file in my custom template to place this in

  6. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    what theme do you use?

  7. CBKat
    Member
    Posted 2 years ago #

    Its the Options Theme which is discontinued, but its the subtemplate of that called Shadow which I use.

  8. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    Cant find the theme. If you mail me the template ( opajaap at opajaap.nl ) i will modify it for you.

  9. CBKat
    Member
    Posted 2 years ago #

    Will do thank you :)

  10. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    If you can not find the file, here is how to:

    On the wp edit page screen there is a selection box in the right hand sidebar where you can select the page template to be used for the page you are editing. It is in the Page Attributes section: Page Template.
    Decide what template you want to modify.

    In your theme directory there are many .php files, also the page templates, but the names need not to be the same as the template you are looking for. You should look for the file that has in its header:

    * Template Name: .......

    as in onecolumn-page.php of the theme twentyten:

    <?php
    /**
     * Template Name: One column, no sidebar
     *
     * A custom page template without sidebar.
     *
     * The "Template Name:" bit above allows this to be selectable
     * from a dropdown menu on the edit page screen.
     *
     * @package WordPress
     * @subpackage Twenty_Ten
     * @since Twenty Ten 1.0
     */

    Once you found the file with the desired Template Name: you've got him.

    You can insert

    <?php
    	/* Display the search field */
    	global $wppa;
    		if ( !isset($wppa['searchstring']) ) $wppa['searchstring'] = '';
    		$page = get_option('wppa_search_linkpage', '0');
    		if ($page == '0') {
    			_e('Warning. No page defined for search results!', 'wppa');
    		}
    		else {
    			if ( function_exists('wppa_dbg_url') ) $pagelink = wppa_dbg_url(get_page_link($page));
    			else $pagelink = get_page_link($page);
    ?>
    			<form id="wppa_searchform" action="<?php echo($pagelink) ?>" method="post" class="widget_search">
    				<div>
    					<input type="text" name="wppa-searchstring" id="wppa_s" value="<?php echo $wppa['searchstring'] ?>" />
    					<input id = "wppa_searchsubmit" type="submit" value="<?php _e('Search', 'wppa_theme'); ?>" />
    				</div>
    			</form>
    <?php
    		}
    ?>

    just before <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> or something the like, it should be in any template.

  11. CBKat
    Member
    Posted 2 years ago #

    I’m so so so sorry its taken me awhile to get back to you about this. I’ve had family emergencies going on so I’ve only been able to do this now. Thank you so much for taking time out to help me with this.

    I tried as you posted above, and it does work, but I do have one issue. I'm using it on a "no sidebar" page. And while it works exactly as I want I have two issues.

    One - I have a "Store" and that has no sidebar, so the searchbar shows up there too. Is there a way to only have it show up on the Gallery page and not other pages that use the "no sidebar" template?

    Two - If #1 can be done, how do I edit the size of the search box and input button? One is too large.

    Thanks so much!

  12. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    You could try this:

    <?php
    $want_searchbar_on_page = '1234'; // assume 1234 is page id where you want the searbar on
    $this_page = get_page();
    
    if ($this_page->ID == $want_searchbar_on_page) {
    .
    .
    .
    the searchbar code
    .
    .
    }
    ?>

    The layout is defined by your themes css.
    If you supply a link to your site (and isnstructions to get on the page involved) i can give you detailed instructions.

  13. CBKat
    Member
    Posted 2 years ago #

    I saw your other post about how to make it so that photos are included with the regular WordPress search. Sounds like I should just go about doing it like that. But I notice a lot of the code I need to switch isn't in my template and I'm not sure how to go about it.

    Here is a link to my gallery
    http://halloween.shiversofhorror.com/blog/multimedia/photo-gallery

  14. CBKat
    Member
    Posted 2 years ago #

    Didn't notice this was marked as resolved. Still looking for help on my previous post.

    I'm using the Options theme, Shadow subtemplate. The theme is not available for download anymore so I'm reposting the code here for help as I can't find any of the items in the directions ( http://wppa.opajaap.nl/?p=1518 ) to change:

    <?php get_header(); ?>
    
    <div class="post">
    	<h2 class="section-header"><?php _e('Search Results','options'); ?></h2>
    	<div class="entry">
    		<p>
    			<?php _e('You are browsing the search results for','options');  ?>
    			"<?php the_search_query(); ?>."
    		</p>
    	</div>
    </div>
    
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    
    	<div class="post">
    
    		<?php echo get_the_image_link(array('Thumbnail'), 'thumbnail'); ?>
    
    		<h3 class="post-title">
    			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    		</h3>
    
    		<div class="entry">
    			<?php the_excerpt(); ?>
    		</div>
    	</div>
    
    	<?php endwhile; ?>
    
    	<?php op_after_archive(); // After archive hook ?>
    
    <?php else: ?>
    
    	<p><?php _e('Sorry, no posts matched your criteria.','options'); ?></p>
    
    <?php endif; ?>
    
    <?php get_footer(); ?>
  15. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    Could not test it of course, but this should work:

    <?php get_header(); ?>
    
        <div class="post">
        	<h2 class="section-header"><?php _e('Search Results','options'); ?></h2>
        	<div class="entry">
        		<p>
        			<?php _e('You are browsing the search results for','options');  ?>
        			"<?php the_search_query(); ?>."
        		</p>
        	</div>
        </div>
    
    	<?php $have_photos = function_exists('wppa_have_photos') && wppa_have_photos('450'); ?>
    	<?php $have_posts  = have_posts(); ?>
    	<?php if ( $have_posts || $have_photos ) : ?>
    
    		<?php if ( $have_posts ) : while(have_posts()) : the_post(); ?>
    
    			<div class="post">
    
    				<?php echo get_the_image_link(array('Thumbnail'), 'thumbnail'); ?>
    
    				<h3 class="post-title">
    					<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    				</h3>
    
    				<div class="entry">
    					<?php the_excerpt(); ?>
    				</div>
    			</div>
    
    		<?php endwhile; ?>
    
    		<?php if ( $have_potos ) wppa_the_photos();
    
        	<?php op_after_archive(); // After archive hook ?>
    
        <?php else: ?>
    
        	<p><?php _e('Sorry, no posts or photos matched your criteria.','options'); ?></p>
    
        <?php endif; ?>
    
        <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic