traveler
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Need Archive for Custom Post TypesI would start by trying to figure out which template is being used for the region listing/archive pages.
I think that’s the issue, the link that was there, which brings up the 404 page, is:
<a href="/blog?filter=" class="more-post"><span>See More Posts</span></a>So I’m having trouble finding what the URL should be to pull up an archive of this taxonomy. I tried the tags from the link you posted above for pagination, none of them showed any output on the front of the site, I had placed them just outside of the loop.
Clearly I’m missing something here or something that I think I understand I’m not.. Nowhere can I find the “region” taxonomy in the admin section. In the CPT UI plugin, there are no new taxonomies listed, and the only taxonomy associated with these custom post types is category (WP-core), which is assigned to be used for the cpt “article”. Only the 6 regions are not each a category, the articles have a custom field dropdown that selects the region it’s part of, or no regions, or all regions.
The custom field attaching articles to regions has field name “regions_selection”, field type “select”, with choices “None, Region_All, Region_One, Region_Two,…, Region_Six”. This dropdown then assigns it to a region page, named as you could guess “Region 1, Region 2,… There is also a meta box with checkbox for regions 1-6 on each region page, no category meta box.
At the top of the region template being used for these region pages, there’s a simple function identifying the page to the system:
/* * This Finds out what Page your on and then gives you a Region Num, * so the page knows what posts to show. Example show region-one or region-six posts*/ if (is_page('region-six')): $pageNum = 'region_six'; elseif(is_page('region-five')): $pageNum = 'region_five'; elseif(is_page('region-four')): $pageNum = 'region_four'; elseif(is_page('region-three')): $pageNum = 'region_three'; elseif(is_page('region-two')): $pageNum = 'region_two'; elseif(is_page('region-one')): $pageNum = 'region_one'; endif;Each region page has a URL of
http://domain.com/region-one/
and the URL that loads taxonomy.php and that I think is the archive for each custom taxonomy, ishttp://domain.com/region/region-1In this case, is it always this way with the URL to pull in a taxonomy’s archive page? So then any link in the regional page template will need to use that URL structure?
Forum: Fixing WordPress
In reply to: Need Archive for Custom Post TypesYes, since I posted I realized that it is a custom taxonomy, it was registered in functions.php instead of in the CPT UI plugin like I thought they would’ve been.
So yes, it is the pagination that needs to be added to the region templates.
Let me ask, am I confused then about if this is in fact an archive?
It looks like I’ll need to create and add a function to functions.php for the pagination and the taxonomy regions, and then call that function on the template file for the regions?
Forum: Developing with WordPress
In reply to: Create archive page for custom post typeHey bcworkz, first off thank you for such detailed responses, I greatly appreciate it. I haven’t responded until now because I needed to do some searching of the issue. Finally it became clear that the CPT’s were not recognizing that they had a category assigned to them, even though it was an option that was selected to use the WP-core categories with the CPT’s as there was no new taxonomy created to work with the CPT’s.
I found a fix from the plugin author, he sent me to this link:
http://docs.pluginize.com/article/17-post-types-in-category-tag-archivesOnce I added that to my functions.php it responded by allowing me to pull up the CPT archives which is what I was trying to do.
Again, thank you for such detailed assistance.
Hey Michael, that worked like a charm! Thank you.
It now shows an archive page of title and date. Thanks for your help – and how quickly you responded on a Friday!
Forum: Developing with WordPress
In reply to: Create archive page for custom post typeHey bcworkz, I understand you in theory, but I’m relatively new to WP and custom themes. Here’s the code block pulling in the articles, including the custom “feature on home page” for the CPT of articles:
<div id="article-left"> <ul> <?php $args = array( 'post_type' => array('slideshow','article'), 'posts_per_page' => 3, 'meta_query' => array( array( 'key' => 'feature_on_home_page', // name of custom field 'value' => '1', ) ), ); ?> <?php $loop = new WP_Query( $args ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); $cats = get_the_category(); $cat_name = $cats[0]->name; ?> <li> <a href="<?php the_permalink() ?>"> <article> <header> <h3 class="dark-underline-text"><u><?php echo $cat_name?></u></h3> <div class="date"><?php the_time('m/d/y') ?></div> </header> <h1><?php the_title(); ?></h1> <div class="article-content-style"> <?php if( get_field('teaser_text') ): echo get_field('teaser_text'); elseif( !get_field('teaser_text') ): ?> <?php $stringContent = get_field('content'); $stringspace = str_replace(" ","",$stringContent); $slength = strlen($stringspace); if ($slength > 180): $shorten = substr($stringContent, 0, 180); $strip = strip_tags($shorten); echo $strip . '...'; ?> <?php else: ?> <?php echo get_field('content'); ?> <?php endif ?> <?php endif; ?> </div> <span>Continue Reading</span> </article> </a> </li> <?php endwhile; ?> <?php wp_reset_postdata(); ?> </li> </ul> <a href="/blog?filter=" class="more-post"><span>See More Posts</span></a> </div>When you mention the URL being what’s shows up under the title of the post/article edit screen, I assume you mean from the admin section, correct? Here’s the link generated when editing an article that’s present on the homepage from the admin section:
/wp-admin/post.php?post=9229&action=edit
That same article, on the front end, produces this URL when clicked:
/article/know-your-rights/
If you have a moment and could share your thoughts on this, it would help me a lot.
Thanks.Forum: Fixing WordPress
In reply to: Page attribute box not working after custom theme updateFound it. The menu was linking to another page with the same name.
Forum: Developing with WordPress
In reply to: Reuse custom post types in a new theme?Hey Patrick,
Thanks for your response, I feel like it’s such a basic question but I’m trying to plan a build time and this has been giving me some issues (in my planning process..). So the site is currently using that custom post type ui plugin you linked to above, and all the custom post types needed were created and live with the current old site that’s being replaced. I’m just building a new theme for the site and don’t wish to change anything in the admin section.Since the site is using that plugin, and I do have the top-level admin screen to manage/create/edit “articles” in the site, does this mean that this custom post type is already registered with my theme?
The way the old site was set up, there were 7 blog feeds on the site, the homepage and then a feed for region pages 1-7. The site has no posts at all. Each blog feed is made up of the articles which have many more options associated with them than a typical post. For each article, when creating or editing there are checkbox options for feature on homepage, hide from blog feed, hide next/previous post bar, and a region selector dropdown to select which region blog feed to assign it to. There are other options for social media, but the above are the ones which are always assigned to determine where an article goes.
So my confusion is coming from how do I get these different custom article feeds to display on my theme. I’ve only displayed pages and posts in the past so I didn’t have to deal with a custom field like this.
Forum: Developing with WordPress
In reply to: Auto truncate blog post excerpts@jakub, thank you this worked perfectly!
Forum: Developing with WordPress
In reply to: Auto truncate blog post excerptsHello Jakub, I will try that. Thank you very much, it would save me so much time!
Forum: Developing with WordPress
In reply to: Auto truncate blog post excerptsHello Steve,
Thanks for your reply. The theme is the Rockettheme base boilerplate if you will, Gantry5/hydrogen. I use it when building Joomla sites as well. They have a content array particle that will not allow pagination, I’ve gotten that from the theme devs, so now I need to rebuild it using the WordPress blog page.I’m much newer to WP than Joomla so I may be mistaken about your question, but my theme’s archive.php file uses get_post_type() to pull in the blog posts.
I’ve posted the archive.php file:
<?php
/**
* @package Gantry 5 Theme
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 – 2016 RocketTheme, LLC
* @license GNU/GPLv2 and later
*
* http://www.gnu.org/licenses/gpl-2.0.html
*/defined(‘ABSPATH’) or die;
/*
* The template for displaying Archive pages.
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*/$gantry = Gantry\Framework\Gantry::instance();
$theme = $gantry[‘theme’];// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context[‘page_head’] = $theme->render(‘partials/page_head.html.twig’, $context);$templates = [‘archive.html.twig’, ‘index.html.twig’];
$context[‘title’] = __(‘Archive’, ‘g5_hydrogen’);
if (is_day()) {
$context[‘title’] = __(‘Archive:’, ‘g5_hydrogen’) . ‘ ‘ . get_the_date(‘j F Y’);
} else if (is_month()) {
$context[‘title’] = __(‘Archive:’, ‘g5_hydrogen’) . ‘ ‘ . get_the_date(‘F Y’);
} else if (is_year()) {
$context[‘title’] = __(‘Archive:’, ‘g5_hydrogen’) . ‘ ‘ . get_the_date(‘Y’);
} else if (is_tag()) {
$context[‘title’] = single_tag_title(”, false);
} else if (is_category()) {
$context[‘title’] = single_cat_title(”, false);
array_unshift($templates, ‘archive-‘ . get_query_var(‘cat’) . ‘.html.twig’);
} else if (is_post_type_archive()) {
$context[‘title’] = post_type_archive_title(”, false);
array_unshift($templates, ‘archive-‘ . get_post_type() . ‘.html.twig’);
}$context[‘posts’] = Timber::get_posts();
Timber::render($templates, $context);
Forum: Plugins
In reply to: Which plugin do you prefer for security?As a followup question, I’ve been getting emails telling me about changed/altered files since I installed this plugin. My site was previously hacked and prior to installing this plugin I did the following:
1. upgraded wordpress to 3.5
2. changed my login password to a random generated one, listed as “strong” by the wordpress password generator tool.
3. changed my database password through phpmyadmin
4. installed “better wp security and changed the database prefixes, got rid of ‘admin’ as a login name, and a bunch of other items suggested by the plugin.If I’m still getting these file change emails, is it possible that someone still has access to my site? There are only 2 registered users now, both of us are admin level and neither of us use ‘admin’ as login name.
My next step I’d like to scan my system files for any trojan horses/malware/spyware/etc., any advice on how to go about doing this and any advice on the rest of my above post regarding the better wp security emails notifying me of file changes?
Forum: Plugins
In reply to: Which plugin do you prefer for security?Thanks for the heads up guys, I’ll check out the ebook!
Forum: Fixing WordPress
In reply to: Site backup prior to software upgradeAwesome thank you Rab.
It definitely says “online backup” through the wordpress admin area, I’m not familiar yet with the standard modules that come with the basic wordpress install, but it does seem to be operated/powered by a 3rd party extension called “backup technology”.
Thank you for clarifying all of this.