CodeyMonkey
Forum Replies Created
-
Hi Miles,
This has now been fixed, I had some legacy code in functions.php leftover from my first post, which was causing them not to display, e.g.function custom_allowed_block_types( $allowed_blocks ) { return array( 'core/paragraph', 'core/heading', 'core/list', Etc.Removed this and now all is well.
Thank you.Hi Miles,
Thank you kindly for your response and for looking into this issue.
I can confirm that the boxes were unticked, although interestingly upon saving, it doesn’t appear to have the issue anymore, so that’s some improvement, thank you.
The issue now appears to be more UX/block list bug – I’ve found that neither the QI Blocks nor the Bootstrap blocks are not visible in the side panel (Qi Blocks were there previously) – any ideas, please?
Forum: Hacks
In reply to: Skip first attachment on a get_children arrayThanks very much, appreciated.
So with 3.3 – how do you the check “If has children” (e.g. I want to show a “Placeholder” image if the post doesn’t have any attachments? (But does have a featured image)
Forum: Hacks
In reply to: Skip first attachment on a get_children arrayThis doesn’t work in WordPress 3.3
e.g. I want to skip the first image…which will be my featured image…and just show the other images attached to the post…
But this no longer works as of WordPress 3.3. – do you have a solution?
(I also use the “else” part to just show a “no Image” graphic, but as I say, it no longer shows since the update to 3.3
Forum: Themes and Templates
In reply to: Created a new theme…no need for index.php – this ok?It’s not what I intended, but it’s the way it’s happened…
home.php – is my homepage
I use page for contact, portfolio blog index
single-portfolio.php takes care of the single portfolio items
single.php takes care of single blog posts
archive.php, search.php, 404.php and pages.php take care of the rest…So you can see why index.php isn’t needed with any code inside.
It’s fine, I have 404.php and search.php…search works fine, I have everything, even an index.php file…. there’s just no code in it…
Everything seems to work great….
Shall I put some default code in there? Seems like I can leave it blank, just wondered if therer would be any repurcussions?
[No bumping, thank you.]
Forum: Fixing WordPress
In reply to: Only show posts of current category?Hi,
Sorry I meant to use a “-” instead of an “_”… So if I was to go the category route…
How would I show only the current categories posts?
e.g. posts of /category/portfolio/
Forum: Fixing WordPress
In reply to: Only show posts of current category?Hi Alchymyth,
I’m pretty new to wordpress, so I might have to use archive.php instead of category_portfolio.php, but i’ll see what you think.
I’m building a Portfolio website with just
Home/Portfolio/Blog/Contact
Home = index.php
Portfolio = category_portfolio.php
Blog = category_blog.php
Contact = (I havn’t got this far yet, might use “Pages” and a plugin)/blog/ & /portfolio/sub-categories – will need different looking archives.
Portfolio has sub categories like “Web Design/Illustartion/Print etc” and if a user goes to /category/portolio it would list all posts posted within those child categories…
But currently it shows posts from both “Portfolio” and “Blog” I don’t know how to differentiate, what do you suggest?
I can currently list the “child Categories” only using:
<?php $args=array( 'orderby' => 'name', 'order' => 'ASC' ); $categories= get_categories('child_of='.get_query_var('cat')); foreach($categories as $category) { echo '<li class="segment-' . $category->cat_ID.'"><a href="#" class="' . $category->cat_ID.'">' . $category->name.'</a></li>'; } ?>But… I don’t know how to pull the posts from these child categories only.
Forum: Fixing WordPress
In reply to: Display Sub Categories of Current Parent Category if there are postsI have a “Parent Category” which works as /category/portfolio/
And the category is named category-portfolio.php.
All I have inside is:
<?php query_posts('showposts=25'); while (have_posts()) : the_post(); ?> <li data-type="<?php $category = get_the_category(); echo $category[0]->cat_ID; ?>"></li> <?php endwhile; ?> <?php $args=array( 'orderby' => 'name', 'order' => 'ASC' ); $categories= get_categories('child_of='.get_query_var('cat')); foreach($categories as $category) { echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> '; echo '<p> Description:'. $category->description . '</p>'; echo '<p> Post Count: '. $category->count . '</p>'; } ?>And this produces:
Category: Photography
Description:Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Post Count: 1Category: Portfolio
Description:Portfolio description would go here
Post Count: 0Category: Illustration
Description:Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Post Count: 1Why is portfolio even showing!!?
Forum: Fixing WordPress
In reply to: Display Sub Categories of Current Parent Category if there are postsCan someone help please, the above code pulls the parent as well as the child categories, when I only want just the “children” only.
Forum: Fixing WordPress
In reply to: Display Sub Categories of Current Parent Category if there are postsOK, to be more specfic, I chnaged the first line of the example, to what you said e.g.
<?php $categories= get_categories('child_of='.get_query_var('cat')); foreach ($categories as $category) {But it’s still pulling the title of the “Parent” e.g. “Portfolio”, within the results any ideas? – Whcih it shouldn’t if I want it to show only ones with posts within it. (excluding the parent)
Forum: Fixing WordPress
In reply to: Display Sub Categories of Current Parent Category if there are postsThis doesn’t work unfortauntely 🙁
I’d like to have more styling over this for example, ideally i’d like:
-
(Query loop here)
<li >(Sub Category ID)(Sub Category Title)</li >
(End Queryy)Hope that makes sense.
Forum: Fixing WordPress
In reply to: Template per Category?Hi,
I don’t know what you mean by “Single posts don’t have the category in the url.” – Of course they do, otherwise would just be mysite.com/single-post/… which is weird.
They have a category or sub category in the url like mysite.com/cat/subcat/single-post/
Or have i missed something…
Forum: Fixing WordPress
In reply to: Template per Category?Hi,
Thanks for your response, The only thing I really want to hardcore is “portfolio” – As mentioned above, the sub-category (e.g. ID7) – I want to remain as a variable so I don’t have to keep hardcoding things everytime I add a new category, hope that makes sense.
OK so from what your’re saying.
category.php would handle /portfolio/ & /portfolio/subcategories
&
single.php would handle /portfolio/subcategory/single-post-here
?
Forum: Fixing WordPress
In reply to: Template per Category?Same thing again, thanks for repsonding, though perhaps I havn’t explained my self properly.
/Portfolio/ – will be an index of sub categories
/portfolio/photogrpahy – will be an index of all photography items
/portfolio/$anycategory(e.g.photography/single-post-item/ – Will be an individual post item from a subcategory e.g. (A phto with all the text)Hope that clears it up.
So essentially I need:
1. – One template for /portfolio/
2. – One template for the sub category /portfolio/photography/
3. – One for the individual post item.Note: the subcategory page e.g. /photography/ -will be dynamic, so I don’t want to have to hard code that part, so I can add any category e.g. illustration/art/design etc etc without having to create a new template each time.
[No bumping, thank you – especially after less than 20 minutes! If it’s that urgent, hire someone.]
Forum: Fixing WordPress
In reply to: Template per Category?But if I created category-portfolio.php – I assume this would give the styling for /portfolio/ ok, but wouldn’t the same styling be applied for /portfilio/photography/some-post-heere/..
As it’s still got the “portfolio” identifier in the url?