Giter VIP home page Giter VIP logo

custom-content-shortcode's Introduction

Custom Content Shortcode

This repository contains the latest development version.

For production use, please see the offical WordPress plugin page.

Deprecation Notice

This plugin is no longer in active development.

Please use the next-generation template system, Loops & Logic.

custom-content-shortcode's People

Contributors

ademayo avatar eliot-akira avatar jrevillini avatar jvcanote avatar pross avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

custom-content-shortcode's Issues

Add orderby, order, key to ACF [related]?

I'm using CCS extensively in my site... it is absolutely fantastic.

I have a lot of custom post types with ACF fields. In particular, I have one post type that contains relationships to another post type. Right now, I've written some php to handle it in the template file but I'd prefer to use the [related] shortcode.

The only thing is the related posts are returned in the order they're stored and I'd like to alphabetize them by title.

I've looked at the acf module and it's waaay beyond my level of php :)

Fix PHP8 warnings

There are a bunch of PHP warnings when using PHP8 that fill the logs even when CC is just activated and you are not even using it.

[22-Dec-2021 17:39:44 UTC] PHP Deprecated:  Required parameter $tag follows optional parameter $content in /Users/pross/Repos/custom-content-shortcode/includes/modules/if.php on line 1375
[22-Dec-2021 17:39:44 UTC] PHP Deprecated:  Required parameter $tag follows optional parameter $content in /Users/pross/Repos/custom-content-shortcode/includes/modules/paging.php on line 92
[22-Dec-2021 17:39:46 UTC] PHP Deprecated:  Required parameter $template follows optional parameter $parameters in /Users/pross/Repos/custom-content-shortcode/includes/core/loop.php on line 94
[22-Dec-2021 17:39:46 UTC] PHP Deprecated:  Required parameter $between_row follows optional parameter $pad in /Users/pross/Repos/custom-content-shortcode/includes/core/loop.php on line 2639
[22-Dec-2021 17:39:46 UTC] PHP Deprecated:  Required parameter $content follows optional parameter $atts in /Users/pross/Repos/custom-content-shortcode/includes/modules/comments.php on line 279
[22-Dec-2021 17:39:46 UTC] PHP Deprecated:  Required parameter $shortcode_name follows optional parameter $content in /Users/pross/Repos/custom-content-shortcode/includes/modules/foreach.php on line 49
[22-Dec-2021 17:39:46 UTC] PHP Deprecated:  Required parameter $shortcode_name follows optional parameter $content in /Users/pross/Repos/custom-content-shortcode/includes/modules/foreach.php on line 352

shortcode outputs extra whitespace - breaks html minifiers

shortcode outputs extra whitespace for every line.

It would be useful if extra line breaks/double space etc between shortcode tags was removed from output

if i have a CCS like this:

[if check={COURSE_TYPE} value="new"][set type]new[/set][else][set type][/set][/if]
£[format decimals=0 point=. thousands=,]
[if check={TYPE} value="new"]
[global][data key="course-information-new" field="total_fees"][/global]
[else]
[global][data key="course-information" field="total_fees"][/global]
[/if]
[/format]
[/pass]

all of those lines create whitespace around the output

normally it's not a problem but when run through an HTML compressor on a line like this it'll end up stripping white space between words because of the extra whitespace from the shortcode

New Courses: [my_shortcode] Fees

will come out something like this after compression

New Courses:£1,000Fees

since the uncompressed HTML is actually something like

New Courses


£1,000


Fees

essentially I'd have to write it like this...
[if check={COURSE_TYPE} value="new"][set type]new[/set][else][set type][/set][/if]£[format decimals=0 point=. thousands=,][if check={TYPE} value="new"][global][data key="course-information-new" field="total_fees"][/global][else][global][data key="course-information" field="total_fees"][/global][/if][/format][/pass]
...which is hard to read

thanks
J

[if check...] fails when shortcode parameter not passed

Hi @eliot-akira,

great plugin but I'm having to rely on a few workarounds for conditionals currently.

this is related to #10

I need to be able to show some html when a shortcode parameter is not passed. in part because there's no [if]...[elseif]...[elseif]...[else]...[/if] structure that i can see?

anyway.. given the following two scenarios eg

[myshortcode param="foo"]
[myshortcode]

and the following meta shortcode logic:

[if check={PARAM} value="foo"]Foo[/if]
[if check={PARAM} value="bar"]Bar[/if]
<!-- this doesn't work -->
[if check={PARAM} value=""]Baz[/if]

I need the second shortcode to output "Baz" when no param is passed

but this doesn't work either (see other issue)

[if exists]{PARAM}
[show]param was passed
[else]param wasn't passed
[/if]

if param is not passed as an empty string like [myshortcode param=""] then {PARAM} inside the [if...] will just be the string "{PARAM}" and therefore exists and breaks the condition ie instead of it being empty it has the content {PARAM}.

I have a workaround but there's a bug if param value sent does not contain a space:

[if check={PARAM} value="{PARAM}"]
param not passed
[else]
{PARAM} 
[/if]

using this code...
[myshortcode] shows "param not passed" (expected)
[myshortcode param="foo"] shows “param not passed” (fail, should show "foo")
[myshortcode param="foo bar"] shows “foo bar” (expected)

in all instances:

  1. if not passed, ideally {PARAM} should resolve to an empty string or maybe value=empty (or null)? (ideally something like [if check={PARAM} value=null]
  2. ..or an alternative syntax to determine if something isn't passed eg [if not check={PARAM}] etc
  3. if passed, param should parse accordingly to the correct value.. mostly it does except in that [if check] as explained

thanks for any input

regards
J

Non-static method CCS_Loop::shortcode_comment() should not be called statically

I have a shortcode that starts with a note
[note]improve logic[/note]

and I call it from my php in a function in an array with
'total_fees' => do_shortcode('[total_fees_formatted course_type='.$course_type.']'),

when I run this i get the error
Non-static method CCS_Loop::shortcode_comment() should not be called statically

all my other CCS functions [global], [format], [if] etc work fine

thanks

Error: Undefined variable: thousands

Hi,

you're trying to check $thousands variable before it is assigned.

$thousands = !empty($atts['thousands']) ? ($thousands==='false' ? '' : $atts['thousands']) : '';

in includes\modules\format.php

this throws an error:
Undefined variable: thousands

(currently this means I have to turn debug off on my dev site to prevent from happening)

maybe you mean to check $atts['thousands']==='false' ?

thanks
J

Undefined variable thousands

This:

$[format decimals="0" point="." thousands=","][field price][/format] 

..causes a warning:

Undefined variable thousands in includes/modules/format.php on line 158

Can't seem to get the the classes parameter to work

[related location_select]
[pass field=menu_title]
[loop menu="{FIELD}" list=true li_class=custom_li_class]
[field title-link]
[/loop]
[/pass]
[/related]

This doesn't seem to be working. I've tried adding it to every shortcode in this setup. I've tried just class= and removing list=true. Can you help or explain how to add classes to fields? The [field title-link] needs to be able to have a class, but I just can't figure it out.

array not working for standard custom field with multiple values

see discussion here
https://wordpress.org/support/topic/accessing-multiple-value-from-a-custom-field/

it should be possible to create a custom field in wordpress multiple times with different values and then process this with [array myfield] or [pass array=myfield]

I've noted some potential changes on that support thread

essentially get_post_meta last parameter single=true in the CCS plugin could theoretically be changed to false to allow for this (this is standard behaviour https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/#multiplevalues)

thanks
J

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.