I am probably going about this question in the wrong way but I am at a loss here. My goal is to create a user "account" page where subscribers will be able to see specific info about their account. (This is tied into a donation API... long story). Also on this page the client wants a "news feed" that will show posts only from categories the user is interested in. I am at a complete loss for how to make this happen. The only vague idea I can come up with would be to query all the possible categories into a form and let the user choose what they want to see and then build a WP_Query based on those categories. However, I don't see how I would save this information and show those each time the user logs in. Any advice would be greatly appreciated. Sorry if this is a poorly researched or formatted question I just feel a tad lost today.
lundi 29 décembre 2014
custom search form not working on custom taxonomy template
I am using custom search from on taxonomy template like my custom taxonomy product_category and i have created template taxonomy-product_category.php and i have created a custom from on this file when i click on search and submit its redirect me page not found page .. i don't know how to fix it . can anyone please help ..
i am using this form .
<form method="get" action="http://example.com/product-category/area-scan-camera/" class="form-horizontal">
<div class="form-group text-muted">
<label class="col-sm-4 control-label">Interface :</label>
<div class="col-sm-8 mt8">
<ul class="list-inline">
<li>
<label class="commonradio">
<input type="radio" value="gige" name="sub_category">
<span></span>
<strong>GigE</strong>
</label>
</li>
<li>
<label class="commonradio">
<input type="radio" value="usb2-0" name="sub_category">
<span></span>
<strong>USB2.0</strong>
</label>
</li>
<li>
<label class="commonradio">
<input type="radio" value="usb3-0" name="sub_category">
<span></span>
<strong>USB3.0</strong>
</label>
</li>
<li>
<label class="commonradio">
<input type="radio" value="firewire" name="sub_category">
<span></span>
<strong>Firewire</strong>
</label>
</li>
<li>
<label class="commonradio">
<input type="radio" value="cameralink" name="sub_category">
<span></span>
<strong>CameraLink</strong>
</label>
</li>
<li>
<label class="commonradio">
<input type="radio" value="coaxpress" name="sub_category">
<span></span>
<strong>CoaXPress</strong>
</label>
</li>
</ul>
</div>
</div>
<div class="form-group text-muted">
<label class="col-sm-4 control-label">SENSOR Color:</label>
<div class="col-sm-8 mt8">
<ul class="list-inline">
<li>
<label class="commonradio">
<input type="radio" value="color" name="_vital_area_senser_color">
<span></span>
<strong>COLOR</strong>
</label>
</li>
<li>
<label class="commonradio">
<input type="radio" value="monochrome" name="_vital_area_senser_color">
<span></span>
<strong>MONOCHROME</strong>
</label>
</li>
</ul>
</div>
</div>
<div class="form-group text-muted">
<label class="col-sm-4 control-label">SENSOR Type:</label>
<div class="col-sm-8 mt8">
<ul class="list-inline">
<li>
<label class="commonradio">
<input type="radio" value="ccd" name="_vital_area_senser_type">
<span></span>
<strong>CCD</strong>
</label>
</li>
<li>
<label class="commonradio">
<input type="radio" value="cmos" name="_vital_area_senser_type">
<span></span>
<strong>CMOS</strong>
</label>
</li>
</ul>
</div>
</div>
<div class="form-group text-muted">
<label class="col-sm-4 control-label">OPTICAL CLASS (Sensor Size) :</label>
<div class="col-sm-2">
<select class="form-control">
<option value="all">All</option>
<option value="1/4">1/4"</option>
<option value="1/3">1/3"</option>
</select>
</div>
</div>
<div class="form-group text-muted">
<label class="col-sm-4 control-label">FRAME RATE :</label>
<div class="col-sm-2">
<select name="frame_rate" class="form-control">
<option value="<10">< 10fps</option>
<option value=">10">> 10fps</option>
<option value=">20">> 20fps</option>
<option value=">40">> 40fps</option>
<option value=">60">> 60fps</option>
<option value=">80">> 80fps</option>
<option value=">100">> 100fps</option>
</select>
</div>
</div>
<div class="form-group text-muted">
<label class="col-sm-4 control-label">RESOLUTION CLASS (Mega Pixel) :</label>
<div class="col-sm-2">
<select name="resolution" class="form-control">
<option value="<1">< 1MP</option>
<option value=">1-2">> 1-2MP</option>
<option value=">2-4">> 2-4MP</option>
<option value=">4-5">> 4-5MP</option>
<option value=">5-8">> 5-8MP</option>
<option value=">8-10">> 8-10MP</option>
<option value=">10-20">> 10-20MP</option>
<option value=">20">> 20MP</option>
</select>
</div>
</div>
<div class="form-group text-muted">
<label class="col-sm-4 control-label">FEATURE :</label>
<div class="col-sm-2">
<select name="feature" class="form-control">
<option value="">-- Select Feature --</option>
<option value="poe">PoE</option>
</select>
</div>
</div>
<input type="hidden" value="area-scan-camera" name="category_name">
<div class="form-group mt30">
<div class="col-sm-offset-4 col-sm-2">
<input type="submit" value="Search" class="btn btn-info btn-common btn-lg btn-block" name="custom_search_form">
</div>
</div>
</form>
Thanks
Custom Post Type Not Displaying - Is my Structure Wrong?
im trying to display 5 Recent custom post types on my home page side bar, which ive managed to do.
I also want to created a page to display all the 9 recent posts within that custom post type. (this is where im getting confused) Ive called the page template page-podium.php (my custom post type is podium, see link)
my page-podium.php is http://pastebin.com/Ld9FCz7J It kinda of works. it displays them but im having trouble getting the pagination to work, is it in the correct place? it seems to multiply the links over and over.
And lastly. when i click on the custom post type post to go to the actual page it says page not found, this is the bit im confused the most about, is it loading them via page.php or single.php? or do i need a page-podium-page.php or something?
Kind regards Thomas
Link to post author but exclude administrator (on single.php)
How to exclude administrators from the code below? So if the current post author has the role of administrator, nothing will show.
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" ><?php the_author_meta( 'display_name' ); ?></a>
thank you
Only the latest post shows up on post page?
disclaimer: this is my first foray into wordpress
I'm creating a custom theme and in the single.php file, i have the main loop, however if i navigate to different posts, all that shows up is the latest post. I could go to the different permalinks, but the only post that shows up is the latest one. How do I make it so that the correct post shows up?
I tried changing the permalinks and deleting and adding pages, but I get the same result.
Here is single.php
<?php while(have_posts()): the_post();?>
<section class="main-section">
<header>
<h1 class="section-header"><?php the_category('/');?></h1>
<ul class="section-nav">
<?php
$cat = get_the_category()[0];
$categoryPosts = get_posts(array('category' => $cat->term_id));
foreach($categoryPosts as $post): setup_postdata($post);
?>
<li><a href="<?php the_permalink();?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</ul>
</header>
<h2 class="section-blurb"><?php the_title();?></h2>
<div class="info">
<?php the_content(); ?>
</div>
</section>
<?php endwhile;?>
Everything works..but only for the latest post.
Edit:
I reinstalled wordpress fresh and made new pages, but the result is the same. I even stripped the code down to just
<?php the_title(); ?>
in the single.php file, but the result is the same. No matter which post you're supposed to be viewing, it only shows the latest post.
Help with a wordpress three column theme getting to next column
Hi all I am new to this and I need help.
I am working in a three Column theme. I have finished my first Colum. How do I start the next one?
Note: I don't know what im doing. When I think I am starting another Colum I keep pushing down items in the first Column. How do I start my second column.
Thanks for the help Greg
custom template for custom url
I've tried registering an URL for which I want a custom template to load up (and list maybe ten or twelve items of a CPT I have already registered and have working elsewhere).
I have the following code:
public function url_for_calendar() {
add_rewrite_rule( 'events', 'index.php?upcoming-events=true', 'top' );
}
public function upcoming_event_query_var ( $vars ) {
$vars[]='upcoming-events';
return $vars;
}
public function template_for_calendar( $path ) {
if ( get_query_var( 'upcoming-events' ) ) {
$template = get_template_directory() . '/upcoming-events.php';
return $template;
}
return $path;
}
And the corresponding (it's all happening inside a class):
add_action ( 'init', array( $this, 'url_for_calendar' ) );
add_action ( 'query_vars', array( $this, 'upcoming_event_query_var' ) );
add_action ( 'template_redirect', array( $this, 'template_for_calendar' ) );
Custom URL is registered (yes, I resaved my permalink settings), and I can see in the debugger that I'm going through template_for_calendar and that the query_var is registered and caught, and that I'm returning the path for my custom template at the end of template_for_calendar... but instead of seeing that template I'm just getting home.php.
What I'm doing wrong here? Thanks and regards.