Posts by UXbarn

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

Congrats! :)

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

Yes, I’ve been using it like that. The function is called in header.php.

After I did var_dump the output like:
..
$attachment = get_post($attachment_id);
echo var_dump($attachment);
..

The object was fetched properly but the outputs were printed out multiple times. The first output is displayed correctly but the second is NULL (in fact there should be only the first one here). :/

I noticed that the problem happened only when I opened the archive page that uses “taxonomy-portfolio-category.php” file and there’s no item to display (no item in the category). If there are some items, the error notices won’t show up.

What I’m curious the most is actually nothing’s wrong with the page result but the error notices showed up. Not sure what I’ve done wrong. Do you have any ideas? :stress:

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

Hi everyone,

I really have no idea when using a custom function to get the attachment object and it throws error. Here is the code:

function get_attachment($attachment_id) {
        $attachment = get_post($attachment_id);

        return array(
            'alt' => get_post_meta($attachment ->ID, '_wp_attachment_image_alt', true),
            'caption' => $attachment ->post_excerpt,
            'description' => $attachment ->post_content,
            'href' => get_permalink($attachment ->ID),
            'src' => $attachment ->guid,
            'title' => $attachment ->post_title
        );
    }

The function is placed in functions.php file. When I call this function in header.php, it returns the error of “Trying to get property of non-object” for all array values. But when I do var_dump the ”$attachment” object, it is there and its attributes are all available as usual.

Not sure what’s wrong with that. Any idea? :/

Thanks.

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

@Jaynesh – I think using any shortcodes from Visual Composer should be fine because it is a plugin.

For the latter point, I used to ask Japh previously about extending some code from the plugin and he said the extension or overriding stuff should be in the theme.

Note that the discussion is on page 15. :)

Edited: Hmm. Perhaps I misunderstood your latter point. If what you mean is about where should any “new” custom shortcodes reside (not just the overriding code for existing ones), I’m not sure about it either. Maybe in our own plugin I guess. :/

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

Thanks! :)

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

I totally agree with the new guidelines. But, i am a little bit concerned about user experience. Imagine this scenario:

Common user, that does not know nothing about what is meta boxes, custom post type, shortcodes, widgets. One day this user buy a theme A, after the installation, he is asked to install a bunch of plugins too, then he do.

Plugins:

- A MetaBoxes - A Custom Post Type - A ShortCodes - A Widgets

Then, he change his mind and buy another theme, B. Oh, and he is asked to install another bunch of plugins too.

- B Widgets - B ShortCodes - B Misc.

I can keep this forever, but lets say, he stops on the fourth theme. And suddenly he realize that his admin has 3 “Portfolios” menu itens, 2 “Sliders” menus and worst, when he try to add a new Post, he discovers a lot of custom fields that he does not know how to get rid off.

In the end, there will be maybe 20-30 plugins installed, and probably with common names like “Nice ShortCodes” or “Awsome ShortCodes”. How the “noob” user, will know how to deal with that information?

I think this is an interesting point. Even though an author only create a few plugins (say 1-2 plugins) to be using with his/her theme, end users still get a number of unwanted and useless plugins installed after switching themes.

By the concept that a theme must port all functionality into plugins, the users are “forced” to install and use the plugins that come with the theme in the first place (*Well, actually they are not forced to and they can choose not to install any, but in order to make the theme works as promoted, they couldn’t refuse right? :) ).

Also, since those theme-specific plugins serve only the functionality and styles for their own brand/theme, they might be useless to be used on any other themes. Unlike other general plugins on repository or other premium third-party plugins that are designed to be used as “stand alone” and independent.

So, how can authors prevent the situation that the users will have useless theme-specific plugins installed after switching the themes?

P.S. I’m all in for the new requirements and that’s totally great for most authors to comply with standards. I think Envato is surely going to the right direction in a long-term business. But there’s just something still unclear to me. :)

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

Congratulations for the awesome achievement! :)

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

Congrats! :)

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

Perhaps they’re randomly picked by staff I guess? :|

443 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+3 more
UXbarn says

Hi Japh,

Thanks for creating Q & A, it’s really helpful! But, regarding the Q & A site, that Q2 of the Phase 2 is not mine actually. My question haven’t yet been answered. Here I quote it again:

Question: What if I use Visual Composer plugin for shortcodes (elements) and want to override some default shortcode outputs and styles with mine? Do I need to create an additional plugin just for that overriding stuff?

Let’s say I want to override the default Tabs shortcode that is, by default, using jQuery UI to use a structure and styles of Zurb Foundation instead. Where should the overriding code reside, in a plugin or theme?

Thanks!

by
by
by
by
by
by