accend4web
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateI’m really sorry to say this, but I’m not 100% sure what your asking, and id rather say just so that I can try it out.
Do you mean to where that plugin is used, does the plugin work? as opposed to me trying to get my shortcode to work which doesnt work
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateI found a bunch of add_shortcode calls but they where all in the plugins folder, and as I’m not using a plugin in this instance, so that wouldnt stop it working for me, but the positive is that the plugins I have used worked, so the add_shortcode must have worked then, just not working on pages.
Nothing dissapointingly showed up in the theme folder.
But the one plugin I use, I have posted the code below as this one works and has the components of what Im trying to do.
<?php namespace ResponsiveMenu\View; use ResponsiveMenu\Factories\CssFactory; use ResponsiveMenu\Factories\JsFactory; use ResponsiveMenu\Collections\OptionsCollection; use ResponsiveMenu\ViewModels\Menu; use ResponsiveMenu\ViewModels\Button; class FrontView implements View { public function __construct(JsFactory $js, CssFactory $css) { $this->js = $js; $this->css = $css; } public function render($location, $l = []) { add_action('wp_footer', function() use ($location, $l) { include dirname(dirname(dirname(__FILE__))) . '/views/' . $location . '.phtml'; }); } public function make($location, $l = []) { ob_start(); include dirname(dirname(dirname(__FILE__))) . '/views/' . $location . '.phtml'; $output = ob_get_contents(); ob_end_clean(); return $output; } public function echoOrIncludeScripts(OptionsCollection $options) { $css = $this->css->build($options); $js = $this->js->build($options); add_filter('body_class', function($classes) use($options) { $classes[] = 'responsive-menu-' . $options['animation_type'] . '-' . $options['menu_appear_from']; return $classes; }); wp_enqueue_script('jquery'); if($options['external_files'] == 'on') : $data_folder_dir = plugins_url(). '/responsive-menu-data'; $css_file = $data_folder_dir . '/css/responsive-menu-' . get_current_blog_id() . '.css'; $js_file = $data_folder_dir . '/js/responsive-menu-' . get_current_blog_id() . '.js'; wp_enqueue_style('responsive-menu', $css_file, null, false); wp_enqueue_script('responsive-menu', $js_file, ['jquery'], false, $options['scripts_in_footer'] == 'on' ? true : false); else : add_action('wp_head', function() use ($css) { echo '<style>' . $css . '</style>'; }, 100); add_action($options['scripts_in_footer'] == 'on' ? 'wp_footer' : 'wp_head', function() use ($js) { echo '<script>' . $js . '</script>'; }, 100); endif; } public function addShortcode($options, Button $button, Menu $menu) { add_shortcode('responsive_menu', function($atts) use($options, $button, $menu) { if($atts) array_walk($atts, function($a, $b) use ($options) { $options[$b]->setValue($a); }); $html = $this->make('button', ['options' => $options, 'button' => $button->getHtml($options)]); return $html . $this->make('menu', ['options' => $options, 'menu' => $menu->getHtml($options)]); }); } } Syntax highlighting powered by GeSHi Back (accesskey b)But the bad news is that I cant find it anywhere else around the wordpress files
- This reply was modified 9 years, 3 months ago by accend4web.
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateI also just added it to the index.php page inside my child folder, as its pretty much on its own code wise, and again nothing. All you get is the shortcode in a string format.
So with that is it looking like a wordpress issue, rather than a theme issue, which is again confusing as from what I can see using shortcode is a pretty reasonable thing to do, without these problems.
I found this article, but not sure what he means about init level and I’m pretty sure I would need to change that code to work for me – http://carlorizzante.com/add_shortcode-not-working/
- This reply was modified 9 years, 3 months ago by accend4web.
- This reply was modified 9 years, 3 months ago by accend4web.
- This reply was modified 9 years, 3 months ago by accend4web.
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateNa just been through all the files again on the server, and only 1 sign of
ic_add_
and thats where I have used it in my child theme folder in that php template.
This is very frustrating isnt it, and thank you again for sticking with me
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateHi, I only went over to the theme support as I thought it maybe worth checking there, just in case it was…
I’ll go through the folders again, one by one, and was I looking for the right thing by searching for – ic_add_
I’m not very confident in honesty, as I did quite a thorough search and only found it when I use it in that tempplate, but I’ll go at it again.
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateI have managed to get into file manager on the server, and am doing a search for ic_add_ in the theme folder and as far outside as I can go and then only instance I’m finding so far is actually inside my template
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateOne thing I did do, is take away all that code to just leave the shortcode, to see if any of the code surrounding it was the cause, and it wasnt, all i got was nothing as in no page design, but the same problem with the shortcode, where it just appeared as a string.
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateOh god sorry, as you can tell Im new to wordpress…
Ok I think I know what you mean, just to say the code in post 3 is all the code within the template, so what your looking for is the code thats surrounding those pages are you?
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateI found a file called shortcodes.php inside wp-includes folder, and there a lot in there. I can see the add_shortcode() function but not the ic_add_posts bit. I was hoping that I could attach a document but cant see the option, so have pasted it all below, its a lot so maybe its easier for you if you copy it out of there and paste it in notepad for easy reading.
[excessive code redacted]
- This reply was modified 9 years, 3 months ago by bcworkz.
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateYes that’s correct, I restored it back to post 3 and as per your advice I took away the conditional plugin too, so the line of code that doesnt seem to be working inside a my template that is only being used for the ‘News’ page is –
<?php echo do_shortcode(“[ic_add_posts category=’Ridgeway Research News’ showposts=’3′]”); ?>
I have pasted [ic_add_posts category=’Ridgeway Research News’ showposts=’3′] directly into the editor part of the news page and again you get the same result, only this time there 2 appearing on the news page as below –
http://www.accend4web.co.uk/ridgeway/news/
Its strange isnt it. I’m happy to give you admin details if that makes it any easier
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateSorry to post again, but tried below I got an error and so it didnt work, but am I on the right path.
<?php [if is_page=’news’] echo do_shortcode(“[ic_add_posts category=’Ridgeway Research News’ showposts=’3′]”); [/if] ?>
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateI think I have found what your describing, but how do you know what the condition is set against, as in is the page name, the category, I’m not sure at all. Found the info here –
https://en-gb.wordpress.org/plugins/conditional-tags-shortcode/
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateThats fine, no worries, i’m just starting out with wordpress so everyday is a new day for me with wordpress.
Umm I have restored the line to –
<?php echo do_shortcode(“[ic_add_posts category=’Ridgeway Research News’ showposts=’3′]”); ?>And like you say there still is a problem, but I havent a clue what your sentence below means.
“Where ever it’s registered is apparently conditionally executed. Some condition that does not include your page.”
Does it mean this isnt going to work, or is there something I need to do to get it to work.
Thanks for getting back to me
Forum: Developing with WordPress
In reply to: Add posts by certain category to templateHi,
The shotcode isnt in the page content, the only place I have it is in the php template page I created to use with the ‘News’ page.
So I did what you said and left the shortcode as you have it above, no php around it, and it still didnt work.
I still when I go to the ‘News’ page, only see the shortcode and not the posts.
http://www.accend4web.co.uk/ridgeway/news/
So now the template called template-ridgeway-news.php which has been associated with the ‘News’ page, looks like this –
<?php /* Template Name: Ridgeway-News-Page */ ?> <?php get_header(); ?> <?php get_template_part('element', 'page-header'); ?> <div id="main" class="main"> <div class="container"> <section id="content" class="content"> <?php do_action('cpotheme_before_content'); ?> <?php if(have_posts()) while(have_posts()): the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="page-content"> <?php do_action('cpotheme_after_title'); ?> <?php the_content(); ?> [ic_add_posts category='Ridgeway Research News' showposts='3'] </div> </div> <?php endwhile; ?> <?php if(get_query_var('paged')) $current_page = get_query_var('paged'); else $current_page = 1;?> <?php $query = new WP_Query('post_type=cpo_service&paged='.$current_page.'&posts_per_page=-1&order=ASC&orderby=menu_order'); ?> <?php if($query->posts): $feature_count = 0; ?> <section id="services" class="services"> <?php cpotheme_grid($query->posts, '', '', 3); ?> </section> <?php cpotheme_numbered_pagination($query); ?> <?php wp_reset_postdata(); ?> <?php endif; ?> <?php do_action('cpotheme_after_content'); ?> </section> <!--<?php get_sidebar(); ?>--> <div class="clear"></div> </div> </div> <?php get_footer(); ?>Forum: Plugins
In reply to: [Responsive Menu - Create Mobile-Friendly Menu] Accordian not workingResolved sorry, my fault