wpconfig

package
v0.0.0-...-1f40810 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLang

func GetLang() string

func GetOption

func GetOption(k string) string

func GetPHPArrayVal

func GetPHPArrayVal[T any](optionName string, defaults T, key ...any) T

func GetTerm

func GetTerm(termId uint64) (models.Terms, bool)

func GetTermMy

func GetTermMy(termId uint64) (models.TermsMy, bool)

func GetTermTaxonomy

func GetTermTaxonomy(termId uint64) (models.TermTaxonomy, bool)

func GetThemeModsVal

func GetThemeModsVal[T any](theme, k string, defaults T) (r T)

func InitOptions

func InitOptions() error

func InitTerms

func InitTerms() (err error)

func IsCustomBackground

func IsCustomBackground(theme string) bool

func SetTemplateFs

func SetTemplateFs(fs embed.FS)

func SetThemeSupport

func SetThemeSupport(theme string, support ThemeSupport)

func Thumbnail

func Thumbnail(metadata models.WpAttachmentMetadata, Type, host string, except ...string) (r models.PostThumbnail)

Types

type ColorScheme

type ColorScheme struct {
	Label  string   `json:"label,omitempty"`
	Colors []string `json:"colors,omitempty"`
}

type CustomHeader

type CustomHeader struct {
	DefaultImage         string `json:"default-image"`
	RandomDefault        bool   `json:"random-default"`
	Width                int    `json:"width"`
	Height               int    `json:"height"`
	FlexHeight           bool   `json:"flex-height"`
	FlexWidth            bool   `json:"flex-width"`
	DefaultTextColor     string `json:"default-text-color"`
	HeaderText           bool   `json:"header-text"`
	Uploads              bool   `json:"uploads"`
	WpHeadCallback       string `json:"wp-head-callback"`
	AdminHeadCallback    string `json:"admin-head-callback"`
	AdminPreviewCallback string `json:"admin-preview-callback"`
	Video                bool   `json:"video"`
	VideoActiveCallback  string `json:"video-active-callback"`
}
type CustomLogo struct {
	Width              int    `json:"width"`
	Height             int    `json:"height"`
	FlexWidth          bool   `json:"flex-width"`
	FlexHeight         bool   `json:"flex-height"`
	HeaderText         string `json:"header-text"`
}

type ImageData

type ImageData struct {
	AttachmentId int64  `json:"attachment_id,omitempty"`
	Url          string `json:"url,omitempty"`
	ThumbnailUrl string `json:"thumbnail_url,omitempty"`
	Height       int64  `json:"height,omitempty"`
	Width        int64  `json:"width,omitempty"`
}
type Sidebars struct {
	Time int          `json:"time,omitempty"`
	Data SidebarsData `json:"data,omitempty"`
}

type SidebarsData

type SidebarsData struct {
	WpInactiveWidgets []string `json:"wp_inactive_widgets,omitempty"`
	Sidebar1          []string `json:"sidebar-1,omitempty"`
	Sidebar2          []string `json:"sidebar-2,omitempty"`
	Sidebar3          []string `json:"sidebar-3,omitempty"`
}

type ThemeMods

type ThemeMods struct {
	CustomCssPostId       int            `json:"custom_css_post_id,omitempty"`
	NavMenuLocations      map[string]int `json:"nav_menu_locations,omitempty"`
	HeaderImage           string         `json:"header_image,omitempty"`
	BackgroundImage       string         `json:"background_image,omitempty"`
	BackgroundSize        string         `json:"background_size,omitempty"`
	BackgroundRepeat      string         `json:"background_repeat,omitempty"`
	BackgroundColor       string         `json:"background_color,omitempty"`
	BackgroundPreset      string         `json:"background_preset"`
	BackgroundPositionX   string         `json:"background_position_x,omitempty"`
	BackgroundPositionY   string         `json:"background_position_y"`
	BackgroundAttachment  string         `json:"background_attachment"`
	ColorScheme           string         `json:"color_scheme"`
	SidebarTextcolor      string         `json:"sidebar_textcolor,omitempty"`
	HeaderBackgroundColor string         `json:"header_background_color,omitempty"`
	HeaderTextcolor       string         `json:"header_textcolor,omitempty"`
	HeaderVideo           int            `json:"header_video,omitempty"`
	ExternalHeaderVideo   string         `json:"external_header_video,omitempty"`
	HeaderImagData        ImageData      `json:"header_image_data,omitempty"`
	SidebarsWidgets       Sidebars       `json:"sidebars_widgets,omitempty"`
	ThemeSupport          ThemeSupport
}

ThemeMods 只有部分公共的参数,其它的参数调用 GetThemeModsVal 函数获取

func GetThemeMods

func GetThemeMods(theme string) (r ThemeMods, err error)

type ThemeSupport

type ThemeSupport struct {
	CoreBlockPatterns                bool         `json:"core-block-patterns"`
	WidgetsBlockEditor               bool         `json:"widgets-block-editor"`
	AutomaticFeedLinks               bool         `json:"automatic-feed-links"`
	TitleTag                         bool         `json:"title-tag"`
	PostThumbnails                   bool         `json:"post-thumbnails"`
	Menus                            bool         `json:"menus"`
	HTML5                            []string     `json:"html5"`
	PostFormats                      []string     `json:"post-formats"`
	CustomizeSelectiveRefreshWidgets bool         `json:"customize-selective-refresh-widgets"`
	EditorStyle                      bool         `json:"editor-style"`
	EditorStyles                     bool         `json:"editor-styles"`
	WpBlockStyles                    bool         `json:"wp-block-styles"`
	ResponsiveEmbeds                 bool         `json:"responsive-embeds"`
	CustomHeader                     CustomHeader `json:"custom-header"`
	Widgets                          bool         `json:"widgets"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL