Form to Add Posts to Custom Post Type

posting from the front-end is a matter of displaying a form and processing it: form: <!– New Post Form –> <div id=”postbox”> <form id=”new_post” name=”new_post” method=”post” action=””> <!– post name –> <p><label for=”title”>Title</label><br /> <input type=”text” id=”title” value=”” tabindex=”1″ size=”20″ name=”title” /> </p> <!– post Category –> <p><label for=”Category”>Category:</label><br /> <p><?php wp_dropdown_categories( ‘show_option_none=Category&tab_index=4&taxonomy=category’ ); ?></p> … Read more

With WordPress themes, where do I store the images and files relatively?

Let me answer your question with a question: Are these images part of your template or for general purpose? The WordPress theme “Responsive” has images files all over its theme folder. The theme should be at yoursite.com/wp-content/themes/responsive. In that theme folder there are a few folders with images: The obvious “images”, also “icons” and “includes/images”. … Read more

Bestway To Define Theme and Plugin path and url

Do not use constants for that. Do not use global constants at all. There are two types of constants: class/interface constants and global constants. Constants in classes or interfaces are fine and sometimes useful. An overly simplistic example: interface Requirements { const MIN_PHP_VERSION = 5.4; public function php_is_good(); } class Theme_Requirements implements Requirements { public … Read more

A way to automatically install pages on theme install?

I got similiar situation where I needed to add page on theme activation and set it as homepage automatically. Here’s how I did it: add_action(‘after_setup_theme’, ‘mytheme_setup’); function mytheme_setup(){ if(get_option(‘page_on_front’)==’0′ && get_option(‘show_on_front’)==’posts’){ // Create homepage $homepage = array( ‘post_type’ => ‘page’, ‘post_title’ => ‘Home’, ‘post_content’ => ”, ‘post_status’ => ‘publish’, ‘post_author’ => 1 ); // Insert … Read more

Custom Image section in Customizer

So I did some research on the matter and I found a solution. Basically WordPress has this cool feature where you can call something called get_theme_mod so what I essentially did was add get_theme_mod inside my <img> src. So this is what I changed my <img> tag to after finding out about get_theme_mod: <img src=”https://wordpress.stackexchange.com/questions/215701/<?php … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)