Git Product home page Git Product logo

pixtypes's Introduction

=== PixTypes === Build Status

WordPress plugin for managing custom post types and custom meta boxes.

The main idea of this plugin is to allow a WordPress theme to define what custom post-types or metaboxes are needed for that theme.

=== #Configuration ===

Note: We still have to add things in this documentation.

The PixTypes plugin is taking configurations from the pixtypes_themes_settings option.

All we have to do is to add our settings in this option when the theme gets active, so we need to use the after_switch_theme filter.

Here is a small example, which adds a portfolio post type, a portfolio taxonomy and some custom metaboxes for a contact page template(kinda fictive, I know).

function theme_getting_active () {

	// first get the old settings if there are ones.
	$types_options = get_option( 'pixtypes_themes_settings' );
	if ( empty( $types_options ) ) {
		$types_options = array();
	}

	// now add your settings
	$types_options[ 'theme_name' ] = array(
		'first_activation' => true,
		'post_types' => array(
			'theme_name_portfolio' => array(
				'labels'        => array(
					'name'               => esc_html__( 'Project', 'theme_name_txtd' ),
					'singular_name'      => esc_html__( 'Project', 'theme_name_txtd' ),
					'add_new'            => esc_html__( 'Add New', 'theme_name_txtd' ),
					'add_new_item'       => esc_html__( 'Add New Project', 'theme_name_txtd' ),
					'edit_item'          => esc_html__( 'Edit Project', 'theme_name_txtd' ),
					'new_item'           => esc_html__( 'New Project', 'theme_name_txtd' ),
					'all_items'          => esc_html__( 'All Projects', 'theme_name_txtd' ),
					'view_item'          => esc_html__( 'View Project', 'theme_name_txtd' ),
					'search_items'       => esc_html__( 'Search Projects', 'theme_name_txtd' ),
					'not_found'          => esc_html__( 'No Project found', 'theme_name_txtd' ),
					'not_found_in_trash' => esc_html__( 'No Project found in Trash', 'theme_name_txtd' ),
					'menu_name'          => esc_html__( 'Projects', 'theme_name_txtd' ),
				),
				'public'        => true,
				'rewrite'       => array(
					'slug'       => 'theme_name_portfolio',
					'with_front' => false,
				),
				'has_archive'   => 'portfolio-archive',
				'menu_icon'     => 'dashicons-portfolio',
				'menu_position' => null,
				'hierarchical' => true,
				'supports'      => array(
					'title',
					'editor',
					'page-attributes',
					'thumbnail',
				),
				'yarpp_support' => true,
			)
		),
		'taxonomies' => array(
			'theme_name_portfolio_categories' => array(
				'hierarchical'      => true,
				'labels'            => array(
					'name'              => esc_html__( 'Project Categories', 'theme_name_txtd' ),
					'singular_name'     => esc_html__( 'Project Category', 'theme_name_txtd' ),
					'search_items'      => esc_html__( 'Search Project Categories', 'theme_name_txtd' ),
					'all_items'         => esc_html__( 'All Project Categories', 'theme_name_txtd' ),
					'parent_item'       => esc_html__( 'Parent Project Category', 'theme_name_txtd' ),
					'parent_item_colon' => esc_html__( 'Parent Project Category: ', 'theme_name_txtd' ),
					'edit_item'         => esc_html__( 'Edit Project Category', 'theme_name_txtd' ),
					'update_item'       => esc_html__( 'Update Project Category', 'theme_name_txtd' ),
					'add_new_item'      => esc_html__( 'Add New Project Category', 'theme_name_txtd' ),
					'new_item_name'     => esc_html__( 'New Project Category Name', 'theme_name_txtd' ),
					'menu_name'         => esc_html__( 'Portfolio Categories', 'theme_name_txtd' ),
				),
				'show_admin_column' => true,
				'rewrite'           => array( 'slug' => 'portfolio-category', 'with_front' => false ),
				'sort'              => true,
				'post_types'        => array( 'theme_name_portfolio' )
			),
		),
		'metaboxes' => array(
			//for the Contact Page template
			'_gmap_settings' => array(
				'id'         => '_gmap_settings',
				'title'      => esc_html__( 'Map Coordinates & Display Options', 'theme_name_txtd' ),
				'pages'      => array( 'page' ), // Post type
				'context'    => 'normal',
				'priority'   => 'high',
				'hidden'     => true,
				'show_on'    => array(
					'key' => 'page-template',
					'value' => array( 'page-templates-contact.php' ),
				),
				'show_names' => true, // Show field names on the left
				'fields'     => array(
					array(
						'name' => esc_html__( 'Map Height', 'theme_name_txtd' ),
						'desc' => __( '<p class="cmb_metabox_description">Select the height of the Google Map area in relation to the browser window.</p>', 'theme_name_txtd' ),
						'id'   => 'page_gmap_height',
						'type'    => 'select',
						'options' => array(
							array(
								'name'  => esc_html__( '&nbsp; &#9673;&#9711; &nbsp;Half', 'theme_name_txtd' ),
								'value' => 'half-height',
							),
							array(
								'name'  => esc_html__( '&#9673;&#9673;&#9711; Two Thirds', 'theme_name_txtd' ),
								'value' => 'two-thirds-height',
							),
							array(
								'name'  => esc_html__( '&#9673;&#9673;&#9673; Full Height', 'theme_name_txtd' ),
								'value' => 'full-height',
							)
						),
						'std'     => 'two-thirds-height',
					),
					array(
						'name' => esc_html__( 'Google Maps Pins', 'theme_name_txtd' ),
						'desc' => __( 'Paste here the Share URL you have taken from <a href="http://www.google.com/maps" target="_blank">Google Maps</a>.', 'theme_name_txtd' ),
						'id'   => 'gmap_urls',
						'type' => 'gmap_pins',
						'std' => array(
							1 => array(
								'location_url' => "https://www.google.ro/maps/@51.5075586,-0.1284425,18z",
								'name' => esc_html__('London', 'theme_name_txtd')
							)
						)
					),
				),
			),
		),
	);
	update_option( 'pixtypes_themes_settings', $types_options );
}

Development Notes

Gulp 3.x doesn't work on Node.js 12.x or above. You have to downgrade Node.js to 11.5.0

nvm install 11.15.0
nvm use 11.15.0 # Just in case it didn't automatically select the 11.15.0 as the main node.
nvm uninstall 13.1.0
npm rebuild node-sass

pixtypes's People

Contributors

andreilupu avatar burloiucosmin avatar cristian-frumusanu avatar cristianfrumusanu avatar georgeolaru avatar madalingorbanescu avatar pixelgradebot avatar razwan avatar srcspider avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pixtypes's Issues

Change Author Name

  • din Pixelgrade in PixelGrade sau PixelGrade Media (dar idee e ca toate sa aiba acelasi autor)

jQuery.fn.load() is deprecated

After installing WordPress 5.5, using jQuery Migrate Helper plugin, I've got this warning:

wp-content/plugins/pixtypes/features/metaboxes/js/pixgallery.js: jQuery.fn.load() is deprecated

Also, it might help to test the plugin with the latest version of WordPress and release an update, with a mention of the compatibility. For now, the plugin isn't tested with the latest 3 major releases of WordPress and it has been updated more than a year ago.

https://wordpress.org/plugins/pixtypes/

wpgrade class dependence

Try to lose the dependence of wpgrade class - I was young back then.

This is related to pixelgrade/timber#23

CSRF Vulnerability via Patchstack

There seems to be an issue regarding a missing WP Nonce which could allow a malicious actor to force higher privileged users to execute unwanted actions under their current authentication.

Reference


@pixelgradebot whenever you have some free time, please take a look over this. Thanks!

Pixtypes does not work for multisite wordpress

I have a multisite wordpress. I installed and activated pixtypes. In the theme, I set up the metaboxes as below. The metaboxes successfully appears on my main site in the multisite., but none of the sub sites shows the metabox. I verfied that in the subsites, pixtypes_themes_settings is set correctly in the options table.

$pixtypes_conf_settings = array(
'first_activation' => true,
'metaboxes' => array(
'job_listing_the_aside' => array(
'id' => 'job_listing_aside',
'title' => esc_html
_( 'Gallery Images', 'mvp' ),
'pages' => array( 'job_listing' ), // Post type
'context' => 'side',
'priority' => 'low',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => esc_html__( 'Gallery Image', 'mvp' ),
'id' => 'main_image',
'type' => 'gallery',
),
)
),

Improve compatibility with WordPress 5.7

WordPress 5.7 should be released on March 9, and what's important about this version, is the jump from jQuery 1.12.4 to jQuery 3.5.1. This is important because, in jQuery 3, some events and functions are removed (.eg .load).

  • Uncaught TypeError: e.indexOf is not a function at pixgallery.js?ver=5.7-RC1-50440:2 and :214
  • Uncaught TypeError: e.indexOf is not a function at pixplaylist.js?ver=5.7-RC1-50440:2 at pixplaylist.js?ver=5.7-RC1-50440:2 and :163
  • Uncaught TypeError: e.indexOf is not a function at pix_builder.js?ver=1.4.13:356 and :521
  • Uncaught TypeError: e.indexOf is not a function at HTMLDocument.<anonymous> (cmb.js?ver=1.4.13:47)

Small refactor / check

Things to keep in sight

  • __( should turn in esc_html__(
  • Every label from js should be localized for #27
  • Move all the config examples on gist

Make meta fields visible with the new Editor

Within the new WordPress editor (Gutenberg), the options created using CMB seems to be there and working, only that they are hidden through CSS or JS:
image

If we're making these options respond again to Page Template changes, the Hero Area section from all of our themes will be compatible with the new editor (eg. Rosa, Osteria, Mies, Pile,

Restrict styles enqueuing

Am observat o suprapunere a stilurilor de la PixTypes cu cele de la Fonto.
Stilurile de la PixTypes ar trebui sa fie incarcate doar pe post type-urile inregistrate de catre PixTypes.

Projects does not display content

Au venit câțiva clienți cu o problemă foarte ciudată la tema Timber, plugin-ul PixTypes nu funcționează cum trebuie ( nu mai apare Project Settings și nu o găsești nici in Screen Options ) și face ca proiectele să nu fie vizibile atunci când le deschizi. Dacă șterg plugin-ul și îl instalez din nou, atunci opțiunea Project Settings apar. Ca să faci imaginile din proiect să apară, trebuie să dai update fără să faci nimic la proiect și abia atunci se salvează și apare conținutul proiectului.

Video

Ticket

Din păcate nu am reușit să reproduc dar am să fac niște teste și revin.

Remove slug fro URL

I have a WP website with PixTypes and fail to get rid of slug. Currently my URLs of portfolio projects are like mysite.com/portfolio/item, and I want to remove the /portfolio/ part and have just mysite.com/item. In Settings --> PixTypes I tried to make the name of the “New Single Item Slug” blank, but this does mysite.com/ /item. Settings -> PixTypes -> Change Archive Slug also doesn't help.

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.